Interface B2BUnitService<T extends CompanyModel,​U extends UserModel>

    • Method Detail

      • getAllUnitsOfOrganization

        @Deprecated(since="6.0")
        java.util.Set<T> getAllUnitsOfOrganization​(T unit)
        Deprecated.
        Since 6.0. Use #getBranch(T) instead
        Retrieves all units of an organization the unit belongs too.
        Parameters:
        unit - A B2BUnitModel within an organization
        Returns:
        A list of all units within an organization.
      • getAllUnitsOfOrganization

        java.util.Set<T> getAllUnitsOfOrganization​(B2BCustomerModel customer)
        Retrieves all units of an organization the customer belongs too.
        Parameters:
        customer - the session user.
        Returns:
        the all units of organization
      • getAllUserGroupMembersForType

        <M extends PrincipalModel> java.util.Set<M> getAllUserGroupMembersForType​(UserGroupModel userGroup,
                                                                                  java.lang.Class<M> memberType)
        Retrieves all members of a User Group of the specified type
        Parameters:
        userGroup - the user group
        memberType - the principle's member type
        Returns:
        the principle members
      • getParent

        T getParent​(B2BCustomerModel employee)
        Gets the parent unit of a user.
        Parameters:
        employee - the employee
        Returns:
        the parent
      • getParent

        T getParent​(T unit)
        Gets the parent unit of a unit.
        Parameters:
        unit - the child unit
        Returns:
        the parent unit or null if unit was the root unit.
      • getRootUnit

        T getRootUnit​(T unit)
        Gets the root unit.
        Parameters:
        unit - the unit
        Returns:
        the root unit
      • findUnitByUid

        @Deprecated(since="4.4")
        T findUnitByUid​(java.lang.String uid)
        Deprecated.
        Since 4.4. Use getUnitForUid(String) instead
        Find unit by uid.
        Parameters:
        uid - the uid
        Returns:
        the b2 b unit model
      • getUnitForUid

        T getUnitForUid​(java.lang.String uid)
        Find unit by uid.
        Parameters:
        uid - the uid
        Returns:
        the b2 b unit model
      • getBranch

        java.util.Set<T> getBranch​(T unit)
        Gets the branch of a unit.
        Parameters:
        unit - the unit
        Returns:
        the branch
      • getCustomers

        java.util.Set<U> getCustomers​(java.util.Set<T> branch)
        Gets the employees.
        Parameters:
        branch - the branch
        Returns:
        the employees
      • disableBranch

        void disableBranch​(T unit)
        Disable branch. Mark all units in the branch as active = false
        Parameters:
        unit - the unit
      • enableBranch

        void enableBranch​(T unit)
        Enable branch. Mark all unit in the branch as active = true.
        Parameters:
        unit - the unit
      • getAllParents

        java.util.List<T> getAllParents​(T unit)
        Get all the parent units in the organization hierarchy all the way up to the root.
        Parameters:
        unit - the unit
        Returns:
        A Set of all b2b units (CompanyModel)
      • addMember

        void addMember​(T group,
                       PrincipalModel member)
        Adds the member to a group. The model is not saved.
        Parameters:
        group - the group
        member - the member
      • getB2BCustomers

        java.util.Set<U> getB2BCustomers​(T unit)
        Gets the b2 b customers.
        Parameters:
        unit - the unit
        Returns:
        the b2 b customers
      • getB2BUnits

        java.util.Set<T> getB2BUnits​(T unit)
        Gets units that are children of the current unit.
        Parameters:
        unit - the unit
        Returns:
        the b2 b units
      • updateParentB2BUnit

        void updateParentB2BUnit​(T parentB2BUnit,
                                 PrincipalModel member)
        Set the parent unit of a given principal. The member is not saved.
        Parameters:
        parentB2BUnit - the parent b2 b unit
        member - the member
      • getUsersOfUserGroup

        @Deprecated(since="6.0")
        java.util.Collection<U> getUsersOfUserGroup​(T unit,
                                                    java.lang.String userGroupId)
        Gets all members from the unit who belong to specified User Group
        Parameters:
        unit - the unit
        userGroupId - the user group id
        Returns:
        A collection of users who are members of the unit with group userGroupId
      • getUsersOfUserGroup

        java.util.Collection<B2BCustomerModel> getUsersOfUserGroup​(B2BUnitModel unit,
                                                                   java.lang.String userGroupId,
                                                                   boolean recursive)
        Gets all members from the unit who belong to specified User Group
        Parameters:
        unit - the unit
        userGroupId - the user group id
        recursive - If true the lookup of users will continue for unit parent until at least one is found.
        Returns:
        A collection of users who are members of the unit with group userGroupId
      • findApprovalProcessCodeForUnit

        @Deprecated(since="4.4")
        java.lang.String findApprovalProcessCodeForUnit​(T unit)
        Deprecated.
        Get approval process code from unit, checking parent units up the organization tree up to the root unit if process is not set in the unit
        Parameters:
        unit -
        Returns:
        approval process code
      • getApprovalProcessCodeForUnit

        @Deprecated(since="1905")
        java.lang.String getApprovalProcessCodeForUnit​(T unit)
        Deprecated.
        since 1905. Please use {@link de.hybris.platform.b2b.process.approval.services.impl.DefaultB2BApprovalProcessService.getApprovalProcessCodeForUnit(B2BUnitModel)} instead.
        Get approval process code from unit, checking parent units up the organization tree up to the root unit if process is not set in the unit
        Parameters:
        unit -
        Returns:
        approval process code
      • getAllApprovalProcesses

        @Deprecated(since="6.0")
        java.util.List<java.lang.String> getAllApprovalProcesses()
        Deprecated.
        Get All Approval Process codes defined in local.properties
        Returns:
        List of approval process codes
      • findAccountManagerForUnit

        @Deprecated(since="4.4")
        EmployeeModel findAccountManagerForUnit​(T unit)
        Deprecated.
        Get salesrep from unit, checking parent units up the organization tree up to the root unit if salesrep is not set in the unit
        Parameters:
        unit -
        Returns:
        the account manager
      • getAccountManagerForUnit

        EmployeeModel getAccountManagerForUnit​(T unit)
        Get salesrep from unit, checking parent units up the organization tree up to the root unit if salesrep is not set in the unit
        Parameters:
        unit -
        Returns:
        the account manager
      • findUnitWithCreditLimit

        @Deprecated(since="4.4")
        T findUnitWithCreditLimit​(T unit,
                                  CurrencyModel currency)
        Deprecated.
        Get unit with credit limit/credit check group value, checking parent units up the organization tree up to the root unit if credit limit / credit check group is not set in the unit
        Parameters:
        unit -
        currency -
        Returns:
        unit with credit limit/check
      • getUnitWithCreditLimit

        T getUnitWithCreditLimit​(T unit)
        Get unit with credit limit/credit check group value, checking parent units up the organization tree up to the root unit if credit limit / credit check group is not set in the unit
        Parameters:
        unit -
        Returns:
        unit with credit limit/check
      • updateBranchInSession

        void updateBranchInSession​(Session session,
                                   UserModel currentUser)
        Sets the branch for the current use in the session.
        Parameters:
        session -
        currentUser -
      • getAllProcessDefinitionsNames

        java.util.Set<java.lang.String> getAllProcessDefinitionsNames()
        Gets all process definition name registered with the ProcessDefinitionFactory
        Returns:
        A unique list of all Business process names.
      • disableUnit

        void disableUnit​(B2BUnitModel unit)
        Disables a b2b unit
        Parameters:
        unit - the unit
      • enableUnit

        void enableUnit​(B2BUnitModel unit)
        Enables a b2b unit
        Parameters:
        unit - the unit
      • setCurrentUnit

        void setCurrentUnit​(B2BCustomerModel customer,
                            B2BUnitModel unit)
        Assigns a default unit for a customer who may be a member of multiple units. and modifies a branch for this customers session based on the unit
        Parameters:
        customer - The current customer
        unit - A B2BUnitModel to be assigned as the default for a customer