Class NewsServiceImpl
java.lang.Object
transmatter.platform.administration.news.service.NewsServiceImpl
- All Implemented Interfaces:
NewsService
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeleteContent(String id) This method is used to delete specific news using news id the method will be fetching the news to make sure if news is already existed after that it will delete the newsThis method is used to get all news from News Databaseorg.springframework.data.domain.Page<News>getAllContents(org.springframework.data.domain.PageRequest page) This method is used to get all news from News Database with require a Pagination format that require page number and size of elementorg.springframework.data.domain.Page<News>getAllEmptyAltNews(org.springframework.data.domain.PageRequest page) this method used to get all Empty alternate text from News Database when this method called, it will create and empty list that will collect empty alternate text news after that, method will search through each individual news and check if news have an empty alternate text when the method check if news have empty alternate text it will add to the list after that finding empty alternate text ended, the method will push the list in to pagination format and return list of news that had empty alternate text as pagination formatgetContent(String id) This method is used to get news from News Database to get individual news it will require an existed news if from news databaseorg.springframework.data.domain.Page<News>getNewsBySource(String source, org.springframework.data.domain.PageRequest page) this method used to fetch the news by given source when this method called, it will fetch the news that have exact given source after the fetch finish, it will return the fetch news in pagination formatorg.springframework.data.domain.Page<News>searchNews(String title, org.springframework.data.domain.PageRequest page) this method used to search the news by given title when this method called, it will search news that contain a given title after the searching process finish, it will return the matched news in pagination formatupdateImageContent(String id, List<Image> ImageText) this method used to update the image alternated text by choosing the specific news id when this method called, it will fetch the news by given id then it will set the image alternate text value index by index after the update process finished it will return the updated news
-
Field Details
-
newsDao
This Field is a news Data Access Object that have a method to access directly to news database
-
-
Constructor Details
-
NewsServiceImpl
public NewsServiceImpl()
-
-
Method Details
-
getContent
This method is used to get news from News Database to get individual news it will require an existed news if from news database- Specified by:
getContentin interfaceNewsService- Parameters:
id- the id of existed news from news Database- Returns:
- individual news from news database
- Throws:
NewsNotFoundException
-
getAllContents
public org.springframework.data.domain.Page<News> getAllContents(org.springframework.data.domain.PageRequest page) This method is used to get all news from News Database with require a Pagination format that require page number and size of element- Specified by:
getAllContentsin interfaceNewsService- Parameters:
page- pagination format- Returns:
- all the news from News Database in pagination format
-
getAllContents
This method is used to get all news from News Database- Specified by:
getAllContentsin interfaceNewsService- Returns:
- all the news from News Database as List
-
deleteContent
This method is used to delete specific news using news id the method will be fetching the news to make sure if news is already existed after that it will delete the news- Specified by:
deleteContentin interfaceNewsService- Parameters:
id- the id of news that going to be deleted- Returns:
- the deleted news
-
getAllEmptyAltNews
public org.springframework.data.domain.Page<News> getAllEmptyAltNews(org.springframework.data.domain.PageRequest page) this method used to get all Empty alternate text from News Database when this method called, it will create and empty list that will collect empty alternate text news after that, method will search through each individual news and check if news have an empty alternate text when the method check if news have empty alternate text it will add to the list after that finding empty alternate text ended, the method will push the list in to pagination format and return list of news that had empty alternate text as pagination format- Specified by:
getAllEmptyAltNewsin interfaceNewsService- Parameters:
page- pagination format- Returns:
- list of news that had empty alternate text as pagination format
-
updateImageContent
this method used to update the image alternated text by choosing the specific news id when this method called, it will fetch the news by given id then it will set the image alternate text value index by index after the update process finished it will return the updated news- Specified by:
updateImageContentin interfaceNewsService- Parameters:
id- the id of specific newsImageText- list of input of alternate text from user- Returns:
- news that alternate text of news images are updated
-
searchNews
public org.springframework.data.domain.Page<News> searchNews(String title, org.springframework.data.domain.PageRequest page) this method used to search the news by given title when this method called, it will search news that contain a given title after the searching process finish, it will return the matched news in pagination format- Specified by:
searchNewsin interfaceNewsService- Parameters:
title- query of word that going to search news titlepage- pagination format- Returns:
- list of news that matched query by given title in pagination format
-
getNewsBySource
public org.springframework.data.domain.Page<News> getNewsBySource(String source, org.springframework.data.domain.PageRequest page) this method used to fetch the news by given source when this method called, it will fetch the news that have exact given source after the fetch finish, it will return the fetch news in pagination format- Specified by:
getNewsBySourcein interfaceNewsService- Parameters:
source- source of news Thairath, Sanook, Dek-Dpage- pagination format- Returns:
- list of news that fetched by given source in pagination format
-