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
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 Summary

    Modifier and Type
    Method
    Description
    This builds a map from a ContentItemId to the ContentZoneItems they belong to.
    protected com.broadleafcommerce.common.extension.cache.CacheStateManager
     
     
    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)
    void
    hydrateContentItems(P zone, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    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 of ContentZones 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

  • 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 of ContentZones with a name filter.
      Specified by:
      readAllByName in interface ContentZoneService<P extends ContentZone>
      Parameters:
      name - Name to filter by
      filters - Additional field filters
      page - Pagination parameters
      context - 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 interface ContentZoneService<P extends ContentZone>
      Parameters:
      name - The name of the zone.
      contextInfo - Additional sandbox and multitenant information
      Returns:
      The zone matching name or Optional.empty().
    • hydrateContentItems

      public void hydrateContentItems(@NonNull P zone, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ContentZoneService
      Specified by:
      hydrateContentItems in interface ContentZoneService<P extends ContentZone>
      Parameters:
      zone - ContentZone to hydrate
      contextInfo - 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
      Specified by:
      hydrateContentItems in interface ContentZoneService<P extends ContentZone>
      Parameters:
      zones - Page of ContentZones to hydrate
      contextInfo - Additional sandbox and multitenant info
    • buildContentItemToZoneItemMap

      protected Map<String,List<ContentZoneItem>> buildContentItemToZoneItemMap(@NonNull P zone)
      This builds a map from a ContentItemId to the ContentZoneItems they belong to. Useful when hydrating all of the ContentZoneItems of a ContentZone with their ContentItems.
      Parameters:
      zone - The parent ContentZone
      Returns:
      A map from a ContentItemId to the ContentZoneItems they belong to.
    • onApplicationEvent

      public void onApplicationEvent(ContentCacheInvalidationEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<P extends ContentZone>
    • getRepository

      protected ContentZoneRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends ContentZone>
    • getContentItemService

      protected ContentItemService<ContentItem> 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()