Interface SubscriptionOperationService<SWI extends SubscriptionWithItems>

All Known Implementing Classes:
DefaultSubscriptionOperationService

public interface SubscriptionOperationService<SWI extends SubscriptionWithItems>
Service for operations on subscriptions and their items
  • Method Details

    • readSubscriptionActions

      SubscriptionActionResponse readSubscriptionActions(SubscriptionActionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      This method reads subscriptions for a given user type and user id, additionally filtered and paginated by given parameters
      Parameters:
      request - the SubscriptionActionRequest
      contextInfo - context information around multi-tenant state
      Returns:
      Subscriptions with items matching the given criteria
    • populateSubscriptionActions

      void populateSubscriptionActions(@NonNull SWI subscription, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Parameters:
      subscription - The SubscriptionWithItems to populate.
      contextInfo - Additional sandbox and multitenant info.
    • readSubscriptionsForUserRefTypeAndUserRef

      org.springframework.data.domain.Page<SWI> readSubscriptionsForUserRefTypeAndUserRef(String userRefType, String userRef, boolean getActions, @Nullable org.springframework.data.domain.Pageable page, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      This method reads subscriptions for a given user type and user id, additionally filtered and paginated by given parameters
      Parameters:
      userRefType - user type, see DefaultUserRefTypes
      userRef - id of owning user or account
      getActions - whether to get available actions for the subscriptions
      page - information about which page of results to return from the database.
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      contextInfo - context information around multi-tenant state
      Returns:
      Subscriptions with items matching the given criteria
    • readUserSubscriptionById

      SWI readUserSubscriptionById(String userRefType, String userRef, String subscriptionId, boolean getActions, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      This method attempts to find a SubscriptionWithItems by id which is owned by the user/account
      Parameters:
      userRefType - user type, see DefaultUserRefTypes
      userRef - id of owning user or account
      subscriptionId - The id of the Subscription that is intended to be gathered
      getActions - whether to get available actions for the subscription
      contextInfo - context information around multi-tenant state
      Returns:
      Subscriptions with items matching the given criteria
    • readSubscriptionById

      default SWI readSubscriptionById(String subscriptionId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      This method reads a subscription for the given id
      Parameters:
      subscriptionId - The id of the Subscription that is intended to be gathered
      contextInfo - context information around multi-tenant state
      Returns:
      a subscription with items identified by the subscription id
    • readSubscriptionById

      default SWI readSubscriptionById(String subscriptionId, boolean isSandboxAware, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      This method reads a subscription for the given id
      Parameters:
      subscriptionId - The id of the Subscription that is intended to be gathered
      isSandboxAware - Whether to look for sandbox records
      contextInfo - context information around multi-tenant state
      Returns:
      a subscription with items identified by the subscription id
    • readSubscriptionById

      SWI readSubscriptionById(String subscriptionId, boolean isSandboxAware, boolean ignoreDeleteFiltering, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      This method reads a subscription for the given id
      Parameters:
      subscriptionId - The id of the Subscription that is intended to be gathered
      isSandboxAware - Whether to look for sandbox records
      ignoreDeleteFiltering - Whether to ignore sandbox delete filtering
      contextInfo - context information around multi-tenant state
      Returns:
      a subscription with items identified by the subscription id
    • createSubscriptionWithItems

      SWI createSubscriptionWithItems(SubscriptionCreationRequest subscriptionCreationRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Builds out a SubscriptionWithItems and calls a provider to persist them in the resource-tier service
      Parameters:
      subscriptionCreationRequest - request DTO with necessary fields to build a subscription
      contextInfo - context information around multi-tenant state
      Returns:
      a created subscription with its items
    • createSubscriptionFromOrder

      List<SWI> createSubscriptionFromOrder(CreateSubscriptionFromOrderRequest createSubscriptionFromOrderRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Builds out a SubscriptionWithItems from order details, and calls a provider to persist them in the resource-tier service.
      Parameters:
      createSubscriptionFromOrderRequest - request DTO with necessary fields to build a Subscription.
      contextInfo - context information around multi-tenant state
      Returns:
      a created subscription with its items
    • updateSubscriptionStatus

      SWI updateSubscriptionStatus(UpdateSubscriptionStatusRequest request, boolean isSandboxAware, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Handles updating the Subscription's status.
      Parameters:
      request - The request to modify a subscription's status.
      isSandboxAware - Whether sandboxing should be enabled for the scope of the operation
      contextInfo - context information around multi-tenant state
      Returns:
      The updated SubscriptionWithItems
      Throws:
      InvalidSubscriptionStatusChangeRequestException - if the status update request is invalid relative to the subscription's current status
    • replaceSubscriptionWithItems

      SWI replaceSubscriptionWithItems(SWI subscriptionWithItems, boolean isSandboxAware, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Handles updating the Subscription's status.
      Parameters:
      subscriptionWithItems - the SubscriptionWithItems to replace
      isSandboxAware - Whether sandboxing should be enabled for the scope of the operation
      contextInfo - context information around multi-tenant state
      Returns:
      The updated SubscriptionWithItems
      Throws:
      InvalidSubscriptionStatusChangeRequestException - if the status update request is invalid relative to the subscription's current status
    • modifySubscription

      ModifySubscriptionResponse modifySubscription(ModifySubscriptionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Handles modifying Subscriptions based on the allowed actions. By default, this should defer the actual business logic to the appropriate ModifySubscriptionHandler.
      Parameters:
      request - The request to modify a subscription.
      contextInfo - context information around multi-tenant state
      Returns:
      Details about the result of the action.
      Throws:
      UnsupportedSubscriptionModificationRequestException - when the request has no matching ModifySubscriptionHandler.
    • lockSubscription

      LockStatus lockSubscription(String subscriptionId, @Nullable List<String> reservations)
      Attempt to create a lock on a subscription. While a subscription is locked, no other changes can be made to the subscription.
      Parameters:
      subscriptionId - The subscription to lock
      reservations - The list of reservation identifiers (i.e. child locks) to make on the subscription
      Returns:
      The status of the lock request
    • clearLock

      LockStatus clearLock(String subscriptionId, boolean isRevert)
      Forcefully clear a lock on a subscription. This will release all child locks as well.
      Parameters:
      subscriptionId - The subscription to unlock
      isRevert - Whether the unlock operation is the result of a revert operation. Optional. Default is true.
      Returns:
      The status of the lock request
    • unlockToken

      LockStatus unlockToken(String subscriptionId, String token, boolean propagate)
      Unlock a child lock on a subscription. If the child lock is the last lock on the subscription, the subscription will be unlocked as well.
      Parameters:
      subscriptionId - The subscription to unlock
      token - The token of the child lock to unlock
      propagate - Whether to propagate the token unlock to the parent lock (if applicable).
      Returns:
      The status of the lock request
    • createToken

      LockStatus createToken(String subscriptionId, @Nullable String tokenIdentifier)
      Create a child lock on a subscription.
      Parameters:
      subscriptionId - The subscription identifier
      tokenIdentifier - The identifier for the child lock. Optional. Will generate an identifier if null.
      Returns:
      The status of the lock request
    • addAdjustment

      void addAdjustment(AddAdjustmentRequest addAdjustmentRequest, String subscriptionId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Adds the requested adjustments onto the Subscription that matches the passed ID.
      Parameters:
      addAdjustmentRequest - the request to add adjustments onto a subscription
      subscriptionId - the Subscription to add the adjustment to
      contextInfo - context information around multi-tenant state
    • updatePriceData

      void updatePriceData(String priceDataId, PriceChangeRequest priceChangeRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)