Class DefaultFeeService<F extends Fee>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<F>
com.broadleafcommerce.pricing.service.DefaultFeeService<F>
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<F>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<F>,FeeService<F>,EventListener,org.springframework.context.ApplicationListener<PricingCacheInvalidationEvent>
public class DefaultFeeService<F extends Fee>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<F>
implements FeeService<F>, org.springframework.context.ApplicationListener<PricingCacheInvalidationEvent>
Default implementation of
FeeService.- Since:
- Pricing Services 2.2.0, Release Train 2.3.0
- Author:
- Julia Lopez-Pozas (jlopezpozas)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultFeeService(FeeRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser, com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager) -
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsByFeeCode(@NonNull String feeCode, String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Whether there exists aFeewhere theFee.getFeeCode()matchesfeeCodeand theFee.getId()does not matchid.protected com.broadleafcommerce.common.extension.cache.CacheStateManagerprotected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node>protected @NonNull FeeRepository<com.broadleafcommerce.data.tracking.core.Trackable>@NonNull Stringprotected com.broadleafcommerce.common.extension.TypeFactoryvoidreadAllByApplicationId(@NonNull String applicationId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetches and returns allFeesthat exist in an application that matches the given application ID.org.springframework.data.domain.Page<F>readAllByLabel(String label, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read allFeesthat match the given label.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
-
CACHE_BY_APPLICATION
- See Also:
-
-
Constructor Details
-
DefaultFeeService
public DefaultFeeService(FeeRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser, @Nullable com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
-
-
Method Details
-
onApplicationEvent
-
readAllByApplicationId
public List<F> readAllByApplicationId(@NonNull @NonNull String applicationId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FeeServiceFetches and returns allFeesthat exist in an application that matches the given application ID.- Specified by:
readAllByApplicationIdin interfaceFeeService<F extends Fee>- Parameters:
applicationId- the application ID to use for matching when fetching feescontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a list of
Feesthat exist in an application that matches the given application ID
-
existsByFeeCode
public boolean existsByFeeCode(@NonNull @NonNull String feeCode, @Nullable String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FeeServiceWhether there exists aFeewhere theFee.getFeeCode()matchesfeeCodeand theFee.getId()does not matchid.- Specified by:
existsByFeeCodein interfaceFeeService<F extends Fee>- Parameters:
feeCode- The fee code to matchid- The id to not matchcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- Whether there exists a
Feewhere theFee.getFeeCode()matchesfeeCodeand theFee.getId()does not matchid.
-
readAllByLabel
public org.springframework.data.domain.Page<F> readAllByLabel(@Nullable String label, @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:FeeServiceRead allFeesthat match the given label.- Specified by:
readAllByLabelin interfaceFeeService<F extends Fee>- Parameters:
label- the fee label to filter byfilters- additional filters to apply in the query. Should beEmptyNodeif no additional filters should be applied.page- the requested page of results from the databasecontext- context information surrounding sandboxing and multitenant state- Returns:
- all fees that match the given label
-
getRepositoryDomain
- Specified by:
getRepositoryDomainin interfaceFeeService<F extends Fee>
-
getRepository
@NonNull protected @NonNull FeeRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getCacheStateManager
@Nullable protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager() -
getParser
protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> getParser()
-