Class DefaultDataDrivenEnumService<D extends DataDrivenEnum>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<D>
com.broadleafcommerce.catalog.service.enumeration.DefaultDataDrivenEnumService<D>
All Implemented Interfaces:
DataDrivenEnumService<D>, com.broadleafcommerce.data.tracking.core.service.CrudEntityService<D>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<D>

public class DefaultDataDrivenEnumService<D extends DataDrivenEnum> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<D> implements DataDrivenEnumService<D>
Author:
Sunny Yu
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultDataDrivenEnumService(DataDrivenEnumRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, 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
    protected com.broadleafcommerce.common.extension.cache.CacheStateManager
     
    protected com.broadleafcommerce.common.extension.cache.key.ContextKeyGen
     
    protected DataDrivenEnumRepository<com.broadleafcommerce.data.tracking.core.Trackable>
     
     
    readAllByContextIds(Collection<String> dataDrivenEnumIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Return all of the data driven enums with IDs in the supplied collection.
    readAllByContextIds(Collection<String> dataDrivenEnumIds, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    org.springframework.data.domain.Page<D>
    readAllByType(String type, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns all of the data driven enums with the given type and filters.
    org.springframework.data.domain.Page<D>
    readAllByValue(String value, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns all of the data driven enums with the given value and filters.
    readAllTypes(cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns data driven enum types currently in the system.
    readByTypeAndValue(String type, String value, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns the DataDrivenEnum that has the given type and value.
    void
    setCacheStateManager(com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
     
    void
    setEnumCacheByIds(com.broadleafcommerce.common.extension.cache.key.ContextKeyGen enumCacheByIds)
     

    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 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

    • DefaultDataDrivenEnumService

      public DefaultDataDrivenEnumService(DataDrivenEnumRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, 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

    • readAllTypes

      public List<String> readAllTypes(@Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: DataDrivenEnumService
      Returns data driven enum types currently in the system.
      Specified by:
      readAllTypes in interface DataDrivenEnumService<D extends DataDrivenEnum>
      Parameters:
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      context - the context to query within
      Returns:
      all the data driven enum types
    • readAllByType

      public org.springframework.data.domain.Page<D> readAllByType(@Nullable String type, @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: DataDrivenEnumService
      Returns all of the data driven enums with the given type and filters.
      Specified by:
      readAllByType in interface DataDrivenEnumService<D extends DataDrivenEnum>
      Parameters:
      type - the data driven enum type to filter by
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      page - the requested page of results from the database
      context - the context to query within
      Returns:
      all of the data driven enums matching the given type and filters
    • readAllByValue

      public org.springframework.data.domain.Page<D> readAllByValue(@Nullable String value, @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: DataDrivenEnumService
      Returns all of the data driven enums with the given value and filters.
      Specified by:
      readAllByValue in interface DataDrivenEnumService<D extends DataDrivenEnum>
      Parameters:
      value - the data driven enum value to filter by
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      page - the requested page of results from the database
      context - the context to query within
      Returns:
      all of the data driven enums matching the given value and filters
    • readByTypeAndValue

      public Optional<D> readByTypeAndValue(String type, String value, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: DataDrivenEnumService
      Returns the DataDrivenEnum that has the given type and value.
      Specified by:
      readByTypeAndValue in interface DataDrivenEnumService<D extends DataDrivenEnum>
      Parameters:
      type - the data driven enum type to filter by
      value - the data driven enum value to filter by
      context - context information surrounding sandboxing and multitenant state
      Returns:
      the data driven enum that has the given type and value
    • readAllByContextIds

      public Stream<D> readAllByContextIds(@NonNull Collection<String> dataDrivenEnumIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: DataDrivenEnumService
      Return all of the data driven enums with IDs in the supplied collection.
      Specified by:
      readAllByContextIds in interface DataDrivenEnumService<D extends DataDrivenEnum>
      Parameters:
      dataDrivenEnumIds - the data driven enum context IDs to search for
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      the data driven enums that matched with the IDs in the given collection
    • readAllByContextIds

      public Stream<D> readAllByContextIds(@NonNull Collection<String> dataDrivenEnumIds, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Specified by:
      readAllByContextIds in interface DataDrivenEnumService<D extends DataDrivenEnum>
    • getRepositoryDomain

      @NonNull public String getRepositoryDomain()
      Specified by:
      getRepositoryDomain in interface DataDrivenEnumService<D extends DataDrivenEnum>
    • getRepository

      protected DataDrivenEnumRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<D extends DataDrivenEnum>
    • setCacheStateManager

      @Autowired(required=false) public void setCacheStateManager(com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
    • getCacheStateManager

      protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager()
    • setEnumCacheByIds

      @Autowired(required=false) @Qualifier("dataDrivenEnumCacheById") public void setEnumCacheByIds(@Nullable com.broadleafcommerce.common.extension.cache.key.ContextKeyGen enumCacheByIds)
    • getEnumCacheByIds

      @Nullable protected com.broadleafcommerce.common.extension.cache.key.ContextKeyGen getEnumCacheByIds()