Class InsightServiceMain
java.lang.Object
com.endurancetrio.business.insight.service.InsightServiceMain
- All Implemented Interfaces:
InsightService
-
Constructor Summary
ConstructorsConstructorDescriptionInsightServiceMain(ArticleRepository articleRepository, ArticleMapper articleMapper) -
Method Summary
Modifier and TypeMethodDescriptiongetArticleBySlug(String slug, Locale locale) Returns anArticleDTOidentified by its unique URL slug, with content resolved for the requested locale.getArticles(int page, org.springframework.data.domain.Pageable pageable, Locale locale) Returns anInsightPageDTOcontaining a paginated list of allarticles, ordered by published date descending.getArticlesByAthleteId(Long athleteId, org.springframework.data.domain.Pageable pageable, Locale locale) Returns anInsightPageDTOcontaining a paginated list ofarticlesauthored by the athlete with the given ID, with content resolved for the requested locale.getArticlesByEvent(Long eventId, org.springframework.data.domain.Pageable pageable, Locale locale) Returns anInsightPageDTOcontaining a paginated list ofarticlesassociated with the given event ID, with content resolved for the requested locale.getArticlesByIds(List<Long> ids, Locale locale) Returns a list ofarticlesfor the given IDs, preserving the order of the provided ID list.longgetArticlesCountByEvent(Long eventId) Returns the number ofarticlesrelated to the event with the given ID.
-
Constructor Details
-
InsightServiceMain
@Autowired public InsightServiceMain(ArticleRepository articleRepository, ArticleMapper articleMapper)
-
-
Method Details
-
getArticleBySlug
Description copied from interface:InsightServiceReturns anArticleDTOidentified by its unique URL slug, with content resolved for the requested locale.- Specified by:
getArticleBySlugin interfaceInsightService- Parameters:
slug- the unique URL slug of the articlelocale- the requested locale for content resolution- Returns:
- the
ArticleDTOwith locale-resolved content
-
getArticles
@Transactional(readOnly=true) public InsightPageDTO getArticles(int page, org.springframework.data.domain.Pageable pageable, Locale locale) Description copied from interface:InsightServiceReturns anInsightPageDTOcontaining a paginated list of allarticles, ordered by published date descending.- Specified by:
getArticlesin interfaceInsightService- Parameters:
page- the 0-based page number, pre-clamped by the controllerpageable- the pagination information (page number, page size, etc.)locale- the requested locale for content resolution- Returns:
- an
InsightPageDTOwith the articles for the requested page and pagination metadata
-
getArticlesByIds
@Transactional(readOnly=true) public List<ArticleDTO> getArticlesByIds(List<Long> ids, Locale locale) Description copied from interface:InsightServiceReturns a list ofarticlesfor the given IDs, preserving the order of the provided ID list. Articles that are not found or have no locale-resolved content are silently excluded.- Specified by:
getArticlesByIdsin interfaceInsightService- Parameters:
ids- the list of article IDs to fetch, in the desired display orderlocale- the requested locale for content resolution- Returns:
- an ordered list of
articlesmatching the given IDs
-
getArticlesByAthleteId
@Transactional(readOnly=true) public InsightPageDTO getArticlesByAthleteId(Long athleteId, org.springframework.data.domain.Pageable pageable, Locale locale) Description copied from interface:InsightServiceReturns anInsightPageDTOcontaining a paginated list ofarticlesauthored by the athlete with the given ID, with content resolved for the requested locale.- Specified by:
getArticlesByAthleteIdin interfaceInsightService- Parameters:
athleteId- the ID of the athlete to filter articles bypageable- the pagination information (page number, page size, etc.)locale- the requested locale for content resolution- Returns:
- an
InsightPageDTOwith the articles authored by the given athlete and pagination metadata
-
getArticlesByEvent
@Transactional(readOnly=true) public InsightPageDTO getArticlesByEvent(Long eventId, org.springframework.data.domain.Pageable pageable, Locale locale) Description copied from interface:InsightServiceReturns anInsightPageDTOcontaining a paginated list ofarticlesassociated with the given event ID, with content resolved for the requested locale.- Specified by:
getArticlesByEventin interfaceInsightService- Parameters:
eventId- the ID of the event to filter articles bypageable- the pagination information (page number, page size, etc.)locale- the requested locale for content resolution- Returns:
- an
InsightPageDTOwith the articles linked to the given event and pagination metadata
-
getArticlesCountByEvent
Description copied from interface:InsightServiceReturns the number ofarticlesrelated to the event with the given ID.- Specified by:
getArticlesCountByEventin interfaceInsightService- Parameters:
eventId- the ID of the event to count articles for- Returns:
- the number of articles related to the given event (0 if none)
-