Class DefaultCommonCatalogService<P extends Catalog>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.tenant.service.DefaultCommonCatalogService<P>
- All Implemented Interfaces:
CrudEntityService<P>
,CommonCatalogService<P>
public class DefaultCommonCatalogService<P extends Catalog>
extends BaseCrudEntityService<P>
implements CommonCatalogService<P>
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultCommonCatalogService
(CommonCatalogRepository<Trackable> repository, CrudEntityHelper helper, com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.common.extension.cache.CacheStateManager
readApplicationOwnedInheritedCatalog
(String startingCatalogId, String applicationId) Find any application owned catalog that inherits from the starting catalog based on the requested application.readByContextId
(String contextId, ContextInfo context) Read a single instance of an entity in the form of a business domain.readByVendorRefs
(@NonNull Set<String> vendorRefs, ContextInfo contextInfo) Finds all catalogs associated to the givenvendorRefs
viaCatalog.getVendorRef()
.readCatalogChildren
(String startingCatalogId) Find one level deep of child catalogs whoseCatalog.getParents()
includes this catalog.readCatalogInheritanceGraph
(List<org.springframework.data.util.Pair<String, String>> catalogRefs) Given a list of catalog ids, find all parent catalog ids up the inheritance graph.Find the calculated sorting level for the given catalogreadTopDownCatalogInheritanceGraph
(List<String> catalogRefs) Given a list of catalog ids, find all child catalog ids down the inheritance graph.Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getRepository, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, 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, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
-
Field Details
-
CACHE_BY_CATALOG_CONTEXTID
- See Also:
-
CACHE_BY_CATALOG_VENDORREF
- See Also:
-
CACHE_BY_CATALOG_INHERITANCE_GRAPH
- See Also:
-
CACHE_BY_CATALOG_TOP_DOWN_INHERITANCE
- See Also:
-
CACHE_BY_CATALOG_CHILDREN
- See Also:
-
CACHE_BY_CATALOG_APPLICATION_OWNED
- See Also:
-
CACHE_BY_CATALOG_LEVEL
- See Also:
-
-
Constructor Details
-
DefaultCommonCatalogService
public DefaultCommonCatalogService(CommonCatalogRepository<Trackable> repository, CrudEntityHelper helper, @Nullable com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
-
-
Method Details
-
readByContextId
@Cacheable(value="trackingCacheByCatalogContextId", keyGenerator="trackingCacheByCatalogContextId", condition="@cacheStateManager.isEnabled(#root.caches, #root.args)") public P readByContextId(@NonNull String contextId, ContextInfo context) Description copied from interface:CrudEntityService
Read a single instance of an entity in the form of a business domain.- Specified by:
readByContextId
in interfaceCrudEntityService<P extends Catalog>
- Overrides:
readByContextId
in classBaseCrudEntityService<P extends Catalog>
- Parameters:
contextId
- The context id for the entity. This is the id by which the business recognizes the item.context
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The narrowed entity instance in the form of a business instance
-
readCatalogInheritanceGraph
@Cacheable(value="trackingCacheByCatalogInheritanceGraph", condition="@cacheStateManager.isEnabled(#root.caches, #root.args)") public InheritanceLines readCatalogInheritanceGraph(@NonNull List<org.springframework.data.util.Pair<String, String>> catalogRefs) Description copied from interface:CommonCatalogService
Given a list of catalog ids, find all parent catalog ids up the inheritance graph. This should demonstrate the full tree of catalogs up to the originating root nodes.- Specified by:
readCatalogInheritanceGraph
in interfaceCommonCatalogService<P extends Catalog>
- Parameters:
catalogRefs
- A list of catalog ids and immediate assigned mutabilities (seeMutabilityType
).- Returns:
- All parent catalog ids up the inheritance graph
-
readTopDownCatalogInheritanceGraph
@Cacheable(value="trackingCacheByCatalogTopDownInheritance", condition="@cacheStateManager.isEnabled(#root.caches, #root.args)") public InheritanceLines readTopDownCatalogInheritanceGraph(@NonNull List<String> catalogRefs) Description copied from interface:CommonCatalogService
Given a list of catalog ids, find all child catalog ids down the inheritance graph. This should demonstrate the full tree of catalogs down to leaf nodes.- Specified by:
readTopDownCatalogInheritanceGraph
in interfaceCommonCatalogService<P extends Catalog>
- Parameters:
catalogRefs
- A list of catalog ids.- Returns:
- All parent catalog ids up the inheritance graph
-
readCatalogChildren
@Cacheable(value="trackingCacheByCatalogChildren", condition="@cacheStateManager.isEnabled(#root.caches, #root.args)") public List<String> readCatalogChildren(@NonNull String startingCatalogId) Description copied from interface:CommonCatalogService
Find one level deep of child catalogs whoseCatalog.getParents()
includes this catalog.- Specified by:
readCatalogChildren
in interfaceCommonCatalogService<P extends Catalog>
- Parameters:
startingCatalogId
- The parent catalog whose immediate children will be returned- Returns:
- The immediate children
-
readApplicationOwnedInheritedCatalog
@Nullable @Cacheable(value="trackingCacheByCatalogApplicationOwned", condition="@cacheStateManager.isEnabled(#root.caches, #root.args)") public P readApplicationOwnedInheritedCatalog(@NonNull String startingCatalogId, @NonNull String applicationId) Description copied from interface:CommonCatalogService
Find any application owned catalog that inherits from the starting catalog based on the requested application.- Specified by:
readApplicationOwnedInheritedCatalog
in interfaceCommonCatalogService<P extends Catalog>
- Parameters:
startingCatalogId
- The ancestor catalog from which to check inheritanceapplicationId
- The id of the application that should own the inherited catalog- Returns:
- The id of the application owned catalog
-
readLevel
@Cacheable(value="trackingCacheByCatalogLevel", condition="@cacheStateManager.isEnabled(#root.caches, #root.args)") public Long readLevel(@NonNull String catalogContextId) Description copied from interface:CommonCatalogService
Find the calculated sorting level for the given catalog- Specified by:
readLevel
in interfaceCommonCatalogService<P extends Catalog>
- Parameters:
catalogContextId
- The contextId for the catalog- Returns:
- The sorting level
-
readByVendorRefs
public List<P> readByVendorRefs(@NonNull @NonNull Set<String> vendorRefs, @Nullable ContextInfo contextInfo) Description copied from interface:CommonCatalogService
Finds all catalogs associated to the givenvendorRefs
viaCatalog.getVendorRef()
.- Specified by:
readByVendorRefs
in interfaceCommonCatalogService<P extends Catalog>
- Parameters:
vendorRefs
- the set of vendor refs to find associated catalogs for. Must be non-empty.contextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- all catalogs found for the given vendor refs
-
getCacheStateManager
@Nullable protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager()
-