Class DefaultContentZoneService<P extends ContentZone>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.content.service.DefaultContentZoneService<P>
- All Implemented Interfaces:
ContentZoneService<P>,com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>,EventListener,org.springframework.context.ApplicationListener<ContentCacheInvalidationEvent>
public class DefaultContentZoneService<P extends ContentZone>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
implements ContentZoneService<P>, org.springframework.context.ApplicationListener<ContentCacheInvalidationEvent>
- Author:
- Nathan Moore (nathandmoore)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultContentZoneService(ContentZoneRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, ContentItemService<ContentItem> contentItemService, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser) -
Method Summary
Modifier and TypeMethodDescriptionprotected Map<String,List<ContentZoneItem>> This builds a map from aContentItemIdto theContentZoneItemsthey belong to.protected com.broadleafcommerce.common.extension.cache.CacheStateManagerprotected ContentItemService<ContentItem>protected com.broadleafcommerce.common.extension.cache.key.ContextKeyGenprotected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node>protected ContentZoneRepository<com.broadleafcommerce.data.tracking.core.Trackable>voidhydrateContentItems(@NonNull org.springframework.data.domain.Page<P> zones, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates theContentItems for the ContentZoneItems.voidhydrateContentItems(P zone, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates theContentItems for the ContentZoneItems.voidorg.springframework.data.domain.Page<P>readAllByName(String name, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a page ofContentZoneswith a name filter.readByName(String name, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the zone by name.voidsetCacheStateManager(com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager) voidsetContentZoneCacheByNameKeyGen(com.broadleafcommerce.common.extension.cache.key.ContextKeyGen contentZoneCacheByNameKeyGen) Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAllMethods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecutionMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Field Details
-
BY_ZONE_NAME_CACHE
- See Also:
-
-
Constructor Details
-
DefaultContentZoneService
public DefaultContentZoneService(ContentZoneRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, ContentItemService<ContentItem> contentItemService, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser)
-
-
Method Details
-
readAllByName
public org.springframework.data.domain.Page<P> readAllByName(@Nullable String name, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ContentZoneServiceReads a page ofContentZoneswith a name filter.- Specified by:
readAllByNamein interfaceContentZoneService<P extends ContentZone>- Parameters:
name- Name to filter byfilters- Additional field filterspage- Pagination parameterscontext- Additional sandbox and multitenant information- Returns:
- A page of
ContentZoneswith a name filter applied.
-
readByName
public Optional<P> readByName(String name, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ContentZoneServiceRetrieves the zone by name.- Specified by:
readByNamein interfaceContentZoneService<P extends ContentZone>- Parameters:
name- The name of the zone.contextInfo- Additional sandbox and multitenant information- Returns:
- The zone matching
nameorOptional.empty().
-
hydrateContentItems
public void hydrateContentItems(@NonNull P zone, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ContentZoneServiceHydrates theContentItems for the ContentZoneItems.- Specified by:
hydrateContentItemsin interfaceContentZoneService<P extends ContentZone>- Parameters:
zone-ContentZoneto hydratecontextInfo- Additional sandbox and multitenant info
-
hydrateContentItems
public void hydrateContentItems(@NonNull @NonNull org.springframework.data.domain.Page<P> zones, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ContentZoneServiceHydrates theContentItems for the ContentZoneItems.- Specified by:
hydrateContentItemsin interfaceContentZoneService<P extends ContentZone>- Parameters:
zones- Page ofContentZonesto hydratecontextInfo- Additional sandbox and multitenant info
-
buildContentItemToZoneItemMap
This builds a map from aContentItemIdto theContentZoneItemsthey belong to. Useful when hydrating all of theContentZoneItemsof aContentZonewith theirContentItems.- Parameters:
zone- The parentContentZone- Returns:
- A map from a
ContentItemIdto theContentZoneItemsthey belong to.
-
onApplicationEvent
- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<P extends ContentZone>
-
getRepository
- Overrides:
getRepositoryin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends ContentZone>
-
getContentItemService
-
getParser
protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> getParser() -
getCacheStateManager
@Nullable protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager() -
setCacheStateManager
@Autowired(required=false) public void setCacheStateManager(@Nullable com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager) -
setContentZoneCacheByNameKeyGen
@Autowired(required=false) @Qualifier("contentZoneCacheByName") public void setContentZoneCacheByNameKeyGen(@Nullable com.broadleafcommerce.common.extension.cache.key.ContextKeyGen contentZoneCacheByNameKeyGen) -
getContentZoneCacheByNameKeyGen
@Nullable protected com.broadleafcommerce.common.extension.cache.key.ContextKeyGen getContentZoneCacheByNameKeyGen()
-