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 Summary
Modifier and TypeMethodDescriptionvoidaddAdjustment(AddAdjustmentRequest addAdjustmentRequest, String subscriptionId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds the requestedadjustmentsonto theSubscriptionthat matches the passed ID.Forcefully clear a lock on a subscription.createSubscriptionFromOrder(CreateSubscriptionFromOrderRequest createSubscriptionFromOrderRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds out aSubscriptionWithItemsfrom order details, and calls a provider to persist them in the resource-tier service.createSubscriptionWithItems(SubscriptionCreationRequest subscriptionCreationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds out aSubscriptionWithItemsand calls a provider to persist them in the resource-tier servicecreateToken(String subscriptionId, String tokenIdentifier) Create a child lock on a subscription.lockSubscription(String subscriptionId, List<String> reservations) Attempt to create a lock on a subscription.modifySubscription(ModifySubscriptionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles modifyingSubscriptionsbased on the allowedactions.voidpopulateSubscriptionActions(SWI subscription, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) readSubscriptionActions(SubscriptionActionRequest request, 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 parametersreadSubscriptionById(String subscriptionId, boolean isSandboxAware, boolean ignoreDeleteFiltering, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This method reads a subscription for the given iddefault SWIreadSubscriptionById(String subscriptionId, boolean isSandboxAware, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This method reads a subscription for the given iddefault SWIreadSubscriptionById(String subscriptionId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This method reads a subscription for the given idorg.springframework.data.domain.Page<SWI>readSubscriptionsForUserRefTypeAndUserRef(String userRefType, String userRef, boolean getActions, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, 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 parametersreadUserSubscriptionById(String userRefType, String userRef, String subscriptionId, boolean getActions, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This method attempts to find aSubscriptionWithItemsby id which is owned by the user/accountreplaceSubscriptionWithItems(SWI subscriptionWithItems, boolean isSandboxAware, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles updating theSubscription'sstatus.unlockToken(String subscriptionId, String token, boolean propagate) Unlock a child lock on a subscription.voidupdatePriceData(String priceDataId, PriceChangeRequest priceChangeRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) updateSubscriptionStatus(UpdateSubscriptionStatusRequest request, boolean isSandboxAware, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles updating theSubscription'sstatus.
-
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- theSubscriptionActionRequestcontextInfo- 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) PopulatesSubscriptionWithItems.getAvailableActions()andSubscriptionWithItems.getUnavailableReasonsByActionType().- Parameters:
subscription- TheSubscriptionWithItemsto 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, seeDefaultUserRefTypesuserRef- id of owning user or accountgetActions- whether to get available actions for the subscriptionspage- information about which page of results to return from the database.filters- additional filters to apply in the query. Should beEmptyNodeif 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 aSubscriptionWithItemsby id which is owned by the user/account- Parameters:
userRefType- user type, seeDefaultUserRefTypesuserRef- id of owning user or accountsubscriptionId- The id of theSubscriptionthat is intended to be gatheredgetActions- whether to get available actions for the subscriptioncontextInfo- 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 theSubscriptionthat is intended to be gatheredcontextInfo- 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 theSubscriptionthat is intended to be gatheredisSandboxAware- Whether to look for sandbox recordscontextInfo- 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 theSubscriptionthat is intended to be gatheredisSandboxAware- Whether to look for sandbox recordsignoreDeleteFiltering- Whether to ignore sandbox delete filteringcontextInfo- 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 aSubscriptionWithItemsand calls a provider to persist them in the resource-tier service- Parameters:
subscriptionCreationRequest- request DTO with necessary fields to build a subscriptioncontextInfo- 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 aSubscriptionWithItemsfrom order details, and calls a provider to persist them in the resource-tier service.- Parameters:
createSubscriptionFromOrderRequest- request DTO with necessary fields to build aSubscription.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 theSubscription'sstatus.- Parameters:
request- The request to modify a subscription's status.isSandboxAware- Whether sandboxing should be enabled for the scope of the operationcontextInfo- 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 theSubscription'sstatus.- Parameters:
subscriptionWithItems- theSubscriptionWithItemsto replaceisSandboxAware- Whether sandboxing should be enabled for the scope of the operationcontextInfo- 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 modifyingSubscriptionsbased on the allowedactions. By default, this should defer the actual business logic to the appropriateModifySubscriptionHandler.- 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 matchingModifySubscriptionHandler.
-
lockSubscription
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 lockreservations- The list of reservation identifiers (i.e. child locks) to make on the subscription- Returns:
- The status of the lock request
-
clearLock
Forcefully clear a lock on a subscription. This will release all child locks as well.- Parameters:
subscriptionId- The subscription to unlockisRevert- Whether the unlock operation is the result of a revert operation. Optional. Default is true.- Returns:
- The status of the lock request
-
unlockToken
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 unlocktoken- The token of the child lock to unlockpropagate- Whether to propagate the token unlock to the parent lock (if applicable).- Returns:
- The status of the lock request
-
createToken
Create a child lock on a subscription.- Parameters:
subscriptionId- The subscription identifiertokenIdentifier- 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 requestedadjustmentsonto theSubscriptionthat matches the passed ID.- Parameters:
addAdjustmentRequest- the request to add adjustments onto a subscriptionsubscriptionId- theSubscriptionto add the adjustment tocontextInfo- context information around multi-tenant state
-
updatePriceData
void updatePriceData(String priceDataId, PriceChangeRequest priceChangeRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-