Class DefaultOrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.order.service.DefaultOrderFulfillmentService<P>
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>, OrderFulfillmentService<P>

public class DefaultOrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P> implements OrderFulfillmentService<P>
Default implementation of OrderFulfillmentService.
Author:
Samarth Dhruva (samarthd)
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultOrderFulfillmentService(OrderFulfillmentRepository<com.broadleafcommerce.data.tracking.core.Trackable> orderFulfillmentRepository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<P>
    createFulfillments(List<P> fulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node>
     
    protected OrderFulfillmentRepository<com.broadleafcommerce.data.tracking.core.Trackable>
     
    org.springframework.data.domain.Page<P>
    readAllByGroupReferenceNumber(String groupReferenceNumber, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the order fulfillments matching the provided groupReferenceNumber and filters.
    org.springframework.data.domain.Page<P>
    readAllByGroupReferenceNumberAndMatchingTenant(String groupReferenceNumber, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the order fulfillments matching the provided groupReferenceNumber and filters, and the tenant from ContextInfo if present.
    readAllByOrderId(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads all of the OrderFulfillments that are associated with the given orderId.
    org.springframework.data.domain.Page<P>
    readAllByOrderId(String orderId, 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 all of the OrderFulfillments that are associated with the given orderId.
    readAllByOrderIdAndMatchingTenant(String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the order fulfillment matching the provided ID and the tenant from ContextInfo if present.
    readAllByOrderIdAndStatus(String orderId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads all of the order OrderFulfillments which are associated with the given orderId.
    readAllByOrderIdAndStatusAndMatchingTenant(String orderId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads all of the order OrderFulfillments which are associated with the given orderId, and the tenant from ContextInfo if present.
    readAllByOrderIdIn(Collection<String> orderIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads all of the OrderFulfillments which are associated with any of the given orderIds.
    readAllByOrderIdInAndExcludeFulfillmentItems(@NonNull List<String> orderIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the order fulfillments for the provided orderIds.
    org.springframework.data.domain.Page<P>
    readAllByStatus(String status, 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 OrderFulfillments in the given status.
    org.springframework.data.domain.Page<P>
    readAllMatchingTenant(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the order fulfillments matching the provided filters and the tenant from ContextInfo if present.
    readAllUniqueIds(int page, cz.jirutka.rsql.parser.ast.Node filters)
    Retrieves a list of unique order fulfillment context IDs no larger than page.
    readByContextIdAndMatchingTenant(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the order fulfillment matching the provided ID and the tenant from ContextInfo if present.
    readByContextIdAndStatus(String id, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads the OrderFulfillment for the given id and status.
    readByContextIdAndStatusAndMatchingTenant(String id, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads the OrderFulfillment for the given id and status, and the tenant from ContextInfo if present.
    org.springframework.data.domain.Page<P>
    readPageByOrderIdMatchingTenant(String orderId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the order fulfillments matching the orderId and the provided filters and the tenant from ContextInfo if present.
    protected List<P>
    replaceFulfillments(List<P> fulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    replaceMatchingTenant(String id, P updates, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Update the given order fulfillment at the tenant level.
    replaceOrCreateAll(Collection<P> fulfillments, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Replace all of the given fulfillments which already exist, or create them.
    void
    setParser(com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser)
     

    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
  • Constructor Details

    • DefaultOrderFulfillmentService

      public DefaultOrderFulfillmentService(OrderFulfillmentRepository<com.broadleafcommerce.data.tracking.core.Trackable> orderFulfillmentRepository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
  • Method Details

    • readAllByOrderId

      public org.springframework.data.domain.Page<P> readAllByOrderId(String orderId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: OrderFulfillmentService
      Reads a page of all of the OrderFulfillments that are associated with the given orderId.
      Specified by:
      readAllByOrderId in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      orderId - The ID of the order to find fulfillments for
      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:
      A page of fulfillments that are associated with the given orderId
    • readAllByOrderIdIn

      public List<P> readAllByOrderIdIn(Collection<String> orderIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: OrderFulfillmentService
      Reads all of the OrderFulfillments which are associated with any of the given orderIds.
      Specified by:
      readAllByOrderIdIn in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      orderIds - The IDs of the orders to find fulfillments for
      context - context information surrounding sandboxing and multitenant state
      Returns:
      the fulfillments which are associated with the given orderIds
    • replaceOrCreateAll

      @Transactional public List<P> replaceOrCreateAll(Collection<P> fulfillments, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: OrderFulfillmentService
      Replace all of the given fulfillments which already exist, or create them.
      Specified by:
      replaceOrCreateAll in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      fulfillments - the fulfillments to replace or create
      context - context information surrounding sandboxing and multitenant state
      Returns:
      the replaced and created fulfillments
    • readAllUniqueIds

      @NonNull public List<String> readAllUniqueIds(int page, @NonNull cz.jirutka.rsql.parser.ast.Node filters)
      Description copied from interface: OrderFulfillmentService
      Retrieves a list of unique order fulfillment context IDs no larger than page. It is expected that any appropriate offset is achieved through criteria designated in filters.
      Specified by:
      readAllUniqueIds in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      page - the requested page of results from the database. -1 indicates no limit.
      filters - An RSQL filter used to narrow query results. May be EmptyNode if no filters should be applied.
      Returns:
      unique order fulfillment IDs
    • readAllByOrderIdAndStatus

      public List<P> readAllByOrderIdAndStatus(String orderId, String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: OrderFulfillmentService
      Reads all of the order OrderFulfillments which are associated with the given orderId.
      Specified by:
      readAllByOrderIdAndStatus in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      orderId - The ID of the parent Order
      status - The OrderFulfillment.getStatus()
      context - context information surrounding sandboxing and multitenant state
      Returns:
      the OrderFulfillments which are associated with the given orderId
    • readAllByStatus

      public org.springframework.data.domain.Page<P> readAllByStatus(String status, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: OrderFulfillmentService
      Reads a page of OrderFulfillments in the given status.
      Specified by:
      readAllByStatus in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      status - The OrderFulfillment.getStatus() to filter on
      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:
      A page of fulfillments that are associated with the given status
    • readByContextIdAndStatus

      public Optional<P> readByContextIdAndStatus(String id, String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: OrderFulfillmentService
      Reads the OrderFulfillment for the given id and status.
      Specified by:
      readByContextIdAndStatus in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      id - The ID of the OrderFulfillment
      status - The OrderFulfillment.getStatus()
      context - context information surrounding sandboxing and multitenant state
      Returns:
      Reads the OrderFulfillment for the given id and status.
    • readAllByOrderId

      public List<P> readAllByOrderId(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: OrderFulfillmentService
      Reads all of the OrderFulfillments that are associated with the given orderId.
      Specified by:
      readAllByOrderId in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      id - The ID of the order to find fulfillments for
      context - context information surrounding sandboxing and multitenant state
      Returns:
      the fulfillments that are associated with the given orderId
    • replaceFulfillments

      protected List<P> replaceFulfillments(List<P> fulfillments, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • createFulfillments

      protected List<P> createFulfillments(List<P> fulfillments, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • readByContextIdAndMatchingTenant

      public Optional<P> readByContextIdAndMatchingTenant(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentService
      Retrieves the order fulfillment matching the provided ID and the tenant from ContextInfo if present.

      Differs from the standard narrowing behavior of CrudEntityService.readByContextId(String, ContextInfo), which only returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation finds all records within the tenant regardless of whether they're associated to an application.

      Specified by:
      readByContextIdAndMatchingTenant in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      id - the id of the order fulfillment to find
      contextInfo - context information surrounding multitenant state
      Returns:
      an Optional containing the requested order fulfillment if found within the tenant, or Optional.empty() otherwise
    • replaceMatchingTenant

      public P replaceMatchingTenant(String id, P updates, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentService
      Update the given order fulfillment at the tenant level.
      Specified by:
      replaceMatchingTenant in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      id - Id of the fulfillment to update
      updates - Updates to apply
      contextInfo - Additional multitenant and sandbox info
      Returns:
      The updated fulifllment if found.
    • readAllByOrderIdAndMatchingTenant

      public List<P> readAllByOrderIdAndMatchingTenant(String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentService
      Retrieves the order fulfillment matching the provided ID and the tenant from ContextInfo if present.

      Differs from the standard narrowing behavior of OrderFulfillmentService.readAllByOrderId(String, ContextInfo), which only returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation finds all records within the tenant regardless of whether they're associated to an application.

      Specified by:
      readAllByOrderIdAndMatchingTenant in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      orderId - The ID of the order to find fulfillments for
      contextInfo - context information surrounding multitenant state
      Returns:
      the fulfillments that are associated with the given orderId
    • readPageByOrderIdMatchingTenant

      public org.springframework.data.domain.Page<P> readPageByOrderIdMatchingTenant(String orderId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentService
      Retrieves the order fulfillments matching the orderId and the provided filters and the tenant from ContextInfo if present.

      Differs from the standard narrowing behavior of OrderFulfillmentService.readAllByOrderId(String, Node, Pageable, ContextInfo) , which only returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation finds all records within the tenant regardless of whether they're associated to an application.

      Specified by:
      readPageByOrderIdMatchingTenant in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      contextInfo - context information surrounding multitenant state
      Returns:
      an Optional containing the requested order fulfillment if found within the tenant, or Optional.empty() otherwise
    • readAllMatchingTenant

      public org.springframework.data.domain.Page<P> readAllMatchingTenant(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentService
      Retrieves the order fulfillments matching the provided filters and the tenant from ContextInfo if present.

      Differs from the standard narrowing behavior of {@link OrderFulfillmentService#readAll(Node, Pageable, ContextInfo), which only returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation finds all records within the tenant regardless of whether they're associated to an application.

      Specified by:
      readAllMatchingTenant in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      contextInfo - context information surrounding multitenant state
      Returns:
      an Optional containing the requested order fulfillment if found within the tenant, or Optional.empty() otherwise
    • readAllByGroupReferenceNumber

      public org.springframework.data.domain.Page<P> readAllByGroupReferenceNumber(String groupReferenceNumber, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentService
      Retrieves the order fulfillments matching the provided groupReferenceNumber and filters.
      Specified by:
      readAllByGroupReferenceNumber in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      groupReferenceNumber - the group reference number to match on
      filters - An RSQL filter used to narrow query results. May be EmptyNode if no filters should be applied.
      pageable - the requested page of results from the database
      contextInfo - context information surrounding multitenant state
      Returns:
      A page of fulfillments that are associated with the given groupReferenceNumber
    • readAllByGroupReferenceNumberAndMatchingTenant

      public org.springframework.data.domain.Page<P> readAllByGroupReferenceNumberAndMatchingTenant(String groupReferenceNumber, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentService
      Retrieves the order fulfillments matching the provided groupReferenceNumber and filters, and the tenant from ContextInfo if present.
      Specified by:
      readAllByGroupReferenceNumberAndMatchingTenant in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      groupReferenceNumber - the group reference number to match on
      filters - An RSQL filter used to narrow query results. May be EmptyNode if no filters should be applied.
      pageable - the requested page of results from the database
      contextInfo - context information surrounding multitenant state
      Returns:
      A page of fulfillments that are associated with the given groupReferenceNumber
    • readAllByOrderIdInAndExcludeFulfillmentItems

      public List<P> readAllByOrderIdInAndExcludeFulfillmentItems(@NonNull @NonNull List<String> orderIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentService
      Retrieves the order fulfillments for the provided orderIds. This method doesn't fetch the associated OrderFulfillmentItem.
      Specified by:
      readAllByOrderIdInAndExcludeFulfillmentItems in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      orderIds - the order ids
      contextInfo - context information surrounding multitenant state
      Returns:
      the fulfillments that are associated with the given orderIds
    • readAllByOrderIdAndStatusAndMatchingTenant

      public List<P> readAllByOrderIdAndStatusAndMatchingTenant(String orderId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: OrderFulfillmentService
      Reads all of the order OrderFulfillments which are associated with the given orderId, and the tenant from ContextInfo if present.
      Specified by:
      readAllByOrderIdAndStatusAndMatchingTenant in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      orderId - The ID of the parent Order
      status - The OrderFulfillment.getStatus()
      context - context information surrounding sandboxing and multitenant state
      Returns:
      the OrderFulfillments which are associated with the given orderId and tenant.
    • readByContextIdAndStatusAndMatchingTenant

      public Optional<P> readByContextIdAndStatusAndMatchingTenant(String id, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: OrderFulfillmentService
      Reads the OrderFulfillment for the given id and status, and the tenant from ContextInfo if present.
      Specified by:
      readByContextIdAndStatusAndMatchingTenant in interface OrderFulfillmentService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      id - The ID of the OrderFulfillment
      status - The OrderFulfillment.getStatus()
      context - context information surrounding sandboxing and multitenant state
      Returns:
      Reads the OrderFulfillment for the given id, status, and tenant.
    • getRepository

      protected OrderFulfillmentRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
    • getParser

      protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> getParser()
    • setParser

      @Autowired public void setParser(com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser)