java.lang.Object
com.broadleafcommerce.subscription.web.endpoint.LockEndpoint

@FrameworkRestController @FrameworkMapping("/locks") @DataRouteByKey("billing") public class LockEndpoint extends Object
REST API for managing subscription locks.
  • Field Details

  • Constructor Details

    • LockEndpoint

      public LockEndpoint()
  • Method Details

    • lockSubscription

      @FrameworkPostMapping("/{subscriptionId}") @Policy(permissionRoots="SUBSCRIPTION", operationTypes=CREATE) public LockStatus lockSubscription(@PathVariable("subscriptionId") String subscriptionId, @RequestParam(value="reservationCount",required=false) Integer reservationCount, @RequestParam(value="reservationList",required=false) List<String> reservationList, @RequestParam(value="duration",required=false) Long duration)
      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
      reservationCount - The number of reservations (i.e. child locks) to make on the subscription. Optional.
      reservationList - The list of reservation identifiers (i.e. child locks) to make on the subscription. Optional. If provided, will be favored over reservationCount.
      duration - The duration a lock may be held before it is considered available for automatic release
      Returns:
      The status of the lock request
      See Also:
    • clearLock

      @FrameworkDeleteMapping("/{subscriptionId}") @Policy(permissionRoots="SUBSCRIPTION", operationTypes=DELETE) public LockStatus clearLock(@PathVariable("subscriptionId") String subscriptionId, @RequestParam(value="isRevert",required=false,defaultValue="true") 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
    • createToken

      @FrameworkPostMapping("/{subscriptionId}/tokens") @Policy(permissionRoots="SUBSCRIPTION", operationTypes=CREATE) public LockStatus createToken(@PathVariable("subscriptionId") String subscriptionId, @RequestParam(value="childIdentifier",required=false) String childIdentifier)
      Create a child lock on a subscription.
      Parameters:
      subscriptionId - The subscription identifier
      childIdentifier - The identifier for the child lock. Optional. Will generate an identifier if null.
      Returns:
      The status of the lock request
    • unlockToken

      @FrameworkDeleteMapping("/{subscriptionId}/tokens/{token}") @Policy(permissionRoots="SUBSCRIPTION", operationTypes=UPDATE) public LockStatus unlockToken(@PathVariable("subscriptionId") String subscriptionId, @PathVariable("token") String token, @RequestParam(value="propagate",required=false,defaultValue="true") 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). Optional. Default is true.
      Returns:
      The status of the lock request
    • setLockService

      @Autowired public void setLockService(SubscriptionLockService lockService)
    • getLockService

      protected SubscriptionLockService getLockService()
    • setTypeFactory

      @Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()