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 aContentItemId
to theContentZoneItems
they belong to.protected com.broadleafcommerce.common.extension.cache.CacheStateManager
protected ContentItemService<ContentItem>
protected com.broadleafcommerce.common.extension.cache.key.ContextKeyGen
protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node>
protected ContentZoneRepository<com.broadleafcommerce.data.tracking.core.Trackable>
void
hydrateContentItems
(@NonNull org.springframework.data.domain.Page<P> zones, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates theContentItems for the ContentZoneItems
.void
hydrateContentItems
(P zone, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates theContentItems for the ContentZoneItems
.void
org.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 ofContentZones
with a name filter.readByName
(String name, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the zone by name.void
setCacheStateManager
(com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager) void
setContentZoneCacheByNameKeyGen
(com.broadleafcommerce.common.extension.cache.key.ContextKeyGen contentZoneCacheByNameKeyGen) Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAll
Methods 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, updateSort
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
Methods 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, updateSort
Methods 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:ContentZoneService
Reads a page ofContentZones
with a name filter.- Specified by:
readAllByName
in interfaceContentZoneService<P extends ContentZone>
- Parameters:
name
- Name to filter byfilters
- Additional field filterspage
- Pagination parameterscontext
- Additional sandbox and multitenant information- Returns:
- A page of
ContentZones
with a name filter applied.
-
readByName
public Optional<P> readByName(String name, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ContentZoneService
Retrieves the zone by name.- Specified by:
readByName
in interfaceContentZoneService<P extends ContentZone>
- Parameters:
name
- The name of the zone.contextInfo
- Additional sandbox and multitenant information- Returns:
- The zone matching
name
orOptional.empty()
.
-
hydrateContentItems
public void hydrateContentItems(@NonNull P zone, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ContentZoneService
Hydrates theContentItems for the ContentZoneItems
.- Specified by:
hydrateContentItems
in interfaceContentZoneService<P extends ContentZone>
- Parameters:
zone
-ContentZone
to 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:ContentZoneService
Hydrates theContentItems for the ContentZoneItems
.- Specified by:
hydrateContentItems
in interfaceContentZoneService<P extends ContentZone>
- Parameters:
zones
- Page ofContentZones
to hydratecontextInfo
- Additional sandbox and multitenant info
-
buildContentItemToZoneItemMap
This builds a map from aContentItemId
to theContentZoneItems
they belong to. Useful when hydrating all of theContentZoneItems
of aContentZone
with theirContentItems
.- Parameters:
zone
- The parentContentZone
- Returns:
- A map from a
ContentItemId
to theContentZoneItems
they belong to.
-
onApplicationEvent
- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<P extends ContentZone>
-
getRepository
- Overrides:
getRepository
in 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()
-