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

    Constructors
    Constructor
    Description
    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, com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    existsByFeeCode(@NonNull String feeCode, String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Whether there exists a Fee where the Fee.getFeeCode() matches feeCode and the Fee.getId() does not match id.
    protected com.broadleafcommerce.common.extension.cache.CacheStateManager
     
    protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node>
     
    protected @NonNull FeeRepository<com.broadleafcommerce.data.tracking.core.Trackable>
     
    @NonNull String
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    void
     
    readAllByApplicationId(@NonNull String applicationId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Fetches and returns all Fees that 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 all Fees that match the given label.

    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

    • 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

      public void onApplicationEvent(PricingCacheInvalidationEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<F extends Fee>
    • readAllByApplicationId

      public List<F> readAllByApplicationId(@NonNull @NonNull String applicationId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: FeeService
      Fetches and returns all Fees that exist in an application that matches the given application ID.
      Specified by:
      readAllByApplicationId in interface FeeService<F extends Fee>
      Parameters:
      applicationId - the application ID to use for matching when fetching fees
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      a list of Fees that 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: FeeService
      Whether there exists a Fee where the Fee.getFeeCode() matches feeCode and the Fee.getId() does not match id.
      Specified by:
      existsByFeeCode in interface FeeService<F extends Fee>
      Parameters:
      feeCode - The fee code to match
      id - The id to not match
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      Whether there exists a Fee where the Fee.getFeeCode() matches feeCode and the Fee.getId() does not match id.
    • 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: FeeService
      Read all Fees that match the given label.
      Specified by:
      readAllByLabel in interface FeeService<F extends Fee>
      Parameters:
      label - the fee label 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 - context information surrounding sandboxing and multitenant state
      Returns:
      all fees that match the given label
    • getRepositoryDomain

      @NonNull public @NonNull String getRepositoryDomain()
      Specified by:
      getRepositoryDomain in interface FeeService<F extends Fee>
    • getRepository

      @NonNull protected @NonNull FeeRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<F extends Fee>
    • 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()