Interface B2BPermissionService<T extends UserModel,P extends B2BPermissionResultModel>

Type Parameters:
T - the user (subtype of UserModel)
P - the permission result (subtype of B2BPermissionResultModel)
All Known Implementing Classes:
DefaultB2BPermissionService

public interface B2BPermissionService<T extends UserModel,P extends B2BPermissionResultModel>
A service around B2BPermissionResultModel. This interface evaluates the permissions(credit limits or budget thresholds) on an order to determine if the order needs to be sent for approval. If the order needs to be approved, the associated approver is applied to the permission so that an Approve or Reject decision on the order can be made.
Spring Bean ID:
b2bPermissionService
  • Method Details

    • evaluatePermissions

      Set<P> evaluatePermissions(AbstractOrderModel order, T employee, List<Class<? extends B2BPermissionModel>> permissionTypes)
      Evaluate permissions of an order to determine if a violation has occurred and that an approver needs to intervene and approve/reject an order.
      Parameters:
      order - the order to be evaluated
      employee - the person who placed the order
      permissionTypes - the permission types that will be checked
      Returns:
      the set of B2BPermissionResultModel
    • getApproversForOpenPermissions

      Set<P> getApproversForOpenPermissions(AbstractOrderModel order, T customer, Collection<P> openPermissions)
      Get the approvers for an order's associated permissions with a status of OPEN. Approvers are assigned to a customer or it's unit and this evaluates/gathers the approvers for all units up the hierarchy.
      Parameters:
      order - the order
      customer - the customer whom placed the order
      openPermissions - the permissions to be checked for status of OPEN
      Returns:
      B2BPermissionResult the set of approvers
    • getOpenPermissions

      List<P> getOpenPermissions(AbstractOrderModel order)
      Gets permissions with OPEN status.
      Parameters:
      order - the order
      Returns:
      the open permissions
    • getB2BPermissionForCode

      B2BPermissionModel getB2BPermissionForCode(String code)
      Gets the b2b permission for the code provided.
      Parameters:
      code - the code
      Returns:
      the b2b permission model
    • getAllB2BPermissions

      Set<B2BPermissionModel> getAllB2BPermissions()
      Get all b2b permissions.
      Returns:
      the set of B2BPermissionModel
    • permissionExists

      boolean permissionExists(String code)
      Determine if a b2b permission exists based on a code.
      Parameters:
      code - the code
      Returns:
      True if permission exists
    • needsApproval

      boolean needsApproval(AbstractOrderModel order)
      Checks if the order requires approval by someone other than customer who placed the order.
      Parameters:
      order - A b2b order.
      Returns:
      True if order needs approval.
    • getEligableApprovers

      Map<T,P> getEligableApprovers(OrderModel order)
      Get all approvers who have permissions to approve the order.
      Parameters:
      order - A b2b order
      Returns:
      approvers who are eligible to approve the order.
    • getAllB2BPermissionTypes

      List<String> getAllB2BPermissionTypes()
      Get all permission types
      Returns:
      permission types list