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 Detail

      • evaluatePermissions

        java.util.Set<P> evaluatePermissions​(AbstractOrderModel order,
                                             T employee,
                                             java.util.List<java.lang.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

        java.util.Set<P> getApproversForOpenPermissions​(AbstractOrderModel order,
                                                        T customer,
                                                        java.util.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

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

        @Deprecated(since="4.4")
        B2BPermissionModel findB2BPermissionByCode​(java.lang.String code)
        Deprecated.
        As of hybris 4.4, replaced by getB2BPermissionForCode(String)
        Parameters:
        code - the permission code
        Returns:
        the permission
      • getB2BPermissionForCode

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

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

        boolean permissionExists​(java.lang.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

        java.util.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.
      • findAllB2BPermissionTypes

        @Deprecated(since="4.4")
        java.util.List<java.lang.String> findAllB2BPermissionTypes()
        Deprecated.
        As of hybris 4.4, replaced by getAllB2BPermissionTypes()
        Returns:
        the List of permission types
      • getAllB2BPermissionTypes

        java.util.List<java.lang.String> getAllB2BPermissionTypes()
        Get all permission types
        Returns:
        permission types list