Class DefaultB2BUnitService
- java.lang.Object
-
- de.hybris.platform.b2b.services.impl.DefaultB2BUnitService
-
- All Implemented Interfaces:
B2BUnitService<B2BUnitModel,B2BCustomerModel>
- Direct Known Subclasses:
DefaultSAPB2BUnitService
public class DefaultB2BUnitService extends java.lang.Object implements B2BUnitService<B2BUnitModel,B2BCustomerModel>
Default implementation of theB2BUnitService
- Spring Bean ID:
- b2bUnitService
-
-
Constructor Summary
Constructors Constructor Description DefaultB2BUnitService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addMember(B2BUnitModel group, PrincipalModel member)
Adds the member to a group.void
disableBranch(B2BUnitModel unit)
Disable branch.void
disableUnit(B2BUnitModel unit)
Disables a b2b unitvoid
enableBranch(B2BUnitModel unit)
Enable branch.void
enableUnit(B2BUnitModel unit)
Enables a b2b unitEmployeeModel
findAccountManagerForUnit(B2BUnitModel unit)
Deprecated.Since 4.4.java.lang.String
findApprovalProcessCodeForUnit(B2BUnitModel unit)
Deprecated.Since 4.4.B2BUnitModel
findUnitByUid(java.lang.String uid)
Deprecated.Since 4.4.B2BUnitModel
findUnitWithCreditLimit(B2BUnitModel unit, CurrencyModel currency)
Deprecated.Since 4.4.EmployeeModel
getAccountManagerForUnit(B2BUnitModel unit)
Get salesrep from unit, checking parent units up the organization tree up to the root unit if salesrep is not set in theunit
protected B2BCreditLimitModel
getActiveCreditLimit(B2BUnitModel unit)
java.util.List<java.lang.String>
getAllApprovalProcesses()
Deprecated.Since 6.0.java.util.List<B2BUnitModel>
getAllParents(B2BUnitModel unit)
Get all the parent units in the organization hierarchy all the way up to the root.java.util.Set<java.lang.String>
getAllProcessDefinitionsNames()
Gets all process definition name registered with theProcessDefinitionFactory
java.util.Set<B2BUnitModel>
getAllUnitsOfOrganization(B2BCustomerModel employee)
Retrieves all units of an organization thecustomer
belongs too.java.util.Set<B2BUnitModel>
getAllUnitsOfOrganization(B2BUnitModel unit)
Deprecated.Since 6.0.<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 typejava.lang.String
getApprovalProcessCodeForUnit(B2BUnitModel unit)
Deprecated.since 1905.java.util.Set<B2BCustomerModel>
getB2BCustomers(B2BUnitModel unit)
Gets the b2 b customers.protected B2BUnitDao
getB2bUnitDao()
java.util.Set<B2BUnitModel>
getB2BUnits(B2BUnitModel unit)
Gets units that are children of the current unit.java.util.Set<B2BUnitModel>
getBranch(B2BUnitModel unit)
Gets the branch of a unit.protected void
getBranch(B2BUnitModel parent, java.util.Set<B2BUnitModel> organizationSet)
protected ConfigurationService
getConfigurationService()
java.util.Set<B2BCustomerModel>
getCustomers(java.util.Set<B2BUnitModel> branch)
Gets the employees.protected ModelService
getModelService()
B2BUnitModel
getParent(B2BCustomerModel employee)
Gets the parent unit of a user.B2BUnitModel
getParent(B2BUnitModel unit)
Gets the parent unit of a unit.protected PrincipalGroupMembersDao
getPrincipalGroupMembersDao()
protected ProcessDefinitionFactory
getProcessDefinitionFactory()
B2BUnitModel
getRootUnit(B2BUnitModel unit)
Gets the root unit.protected SearchRestrictionService
getSearchRestrictionService()
protected SessionService
getSessionService()
protected TypeService
getTypeService()
B2BUnitModel
getUnitForUid(java.lang.String uid)
Find unit by uid.B2BUnitModel
getUnitWithCreditLimit(B2BUnitModel 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 theunit
protected UserService
getUserService()
java.util.Collection<B2BCustomerModel>
getUsersOfUserGroup(B2BUnitModel unit, java.lang.String userGroupId)
Deprecated.Since 6.0.java.util.Collection<B2BCustomerModel>
getUsersOfUserGroup(B2BUnitModel unit, java.lang.String userGroupId, boolean recursive)
Gets all members from the unit who belong to specified User Groupprotected EnumerationValueModel
lookupPriceGroupFromClosestParent(B2BUnitModel unitOfCustomer)
void
setB2bUnitDao(B2BUnitDao b2bUnitDao)
void
setConfigurationService(ConfigurationService configurationService)
void
setCurrentUnit(B2BCustomerModel customer, B2BUnitModel unit)
Assigns a default unit for a customer who may be a member of multiple units.void
setModelService(ModelService modelService)
void
setPrincipalGroupMembersDao(PrincipalGroupMembersDao principalGroupMembersDao)
void
setProcessDefinitionFactory(ProcessDefinitionFactory processDefinitionFactory)
void
setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
void
setSessionService(SessionService sessionService)
void
setTypeService(TypeService typeService)
void
setUserService(UserService userService)
protected void
toggleBranch(B2BUnitModel unit, java.lang.Boolean enable)
Enables or disables a branch and it sibling typesB2BCostCenterModel
B2BBudgetModel
andB2BCustomerModel
assigned to all units in the branch.protected void
toggleUnit(B2BUnitModel b2bUnitModel, java.lang.Boolean enable)
void
updateBranchInSession(Session session, UserModel currentUser)
Sets the branch for the current use in the session.void
updateParentB2BUnit(B2BUnitModel parentB2BUnit, PrincipalModel member)
Set the parent unit of a given principal.
-
-
-
Method Detail
-
getAllUnitsOfOrganization
@Deprecated(since="6.0") public java.util.Set<B2BUnitModel> getAllUnitsOfOrganization(B2BUnitModel unit)
Deprecated.Since 6.0. UsegetBranch(B2BUnitModel)
insteadDescription copied from interface:B2BUnitService
Retrieves all units of an organization theunit
belongs too.- Specified by:
getAllUnitsOfOrganization
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- AB2BUnitModel
within an organization- Returns:
- A list of all units within an organization.
-
getBranch
public java.util.Set<B2BUnitModel> getBranch(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Gets the branch of a unit.- Specified by:
getBranch
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unit- Returns:
- the branch
-
disableBranch
public void disableBranch(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Disable branch. Mark all units in the branch as active = false- Specified by:
disableBranch
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unit
-
enableBranch
public void enableBranch(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Enable branch. Mark all unit in the branch as active = true.- Specified by:
enableBranch
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unit
-
disableUnit
public void disableUnit(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Disables a b2b unit- Specified by:
disableUnit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unit
-
enableUnit
public void enableUnit(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Enables a b2b unit- Specified by:
enableUnit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unit
-
setCurrentUnit
public void setCurrentUnit(B2BCustomerModel customer, B2BUnitModel unit)
Description copied from interface:B2BUnitService
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- Specified by:
setCurrentUnit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
customer
- The current customerunit
- AB2BUnitModel
to be assigned as the default for a customer
-
toggleBranch
protected void toggleBranch(B2BUnitModel unit, java.lang.Boolean enable)
Enables or disables a branch and it sibling typesB2BCostCenterModel
B2BBudgetModel
andB2BCustomerModel
assigned to all units in the branch.- Parameters:
unit
- A unit to look up a branch for viagetBranch(de.hybris.platform.b2b.model.B2BUnitModel)
enable
- IfBoolean.TRUE
all units in the branch will be activated by setting active attribute to true. If false the reverse will happen.
-
toggleUnit
protected void toggleUnit(B2BUnitModel b2bUnitModel, java.lang.Boolean enable)
-
getB2BUnits
public java.util.Set<B2BUnitModel> getB2BUnits(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Gets units that are children of the current unit.- Specified by:
getB2BUnits
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unit- Returns:
- the b2 b units
-
getB2BCustomers
public java.util.Set<B2BCustomerModel> getB2BCustomers(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Gets the b2 b customers.- Specified by:
getB2BCustomers
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unit- Returns:
- the b2 b customers
-
getBranch
protected void getBranch(B2BUnitModel parent, java.util.Set<B2BUnitModel> organizationSet)
-
getAllUnitsOfOrganization
public java.util.Set<B2BUnitModel> getAllUnitsOfOrganization(B2BCustomerModel employee)
Description copied from interface:B2BUnitService
Retrieves all units of an organization thecustomer
belongs too.- Specified by:
getAllUnitsOfOrganization
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
employee
- the session user.- Returns:
- the all units of organization
-
getParent
public B2BUnitModel getParent(B2BCustomerModel employee)
Description copied from interface:B2BUnitService
Gets the parent unit of a user.- Specified by:
getParent
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
employee
- the employee- Returns:
- the parent
-
getParent
public B2BUnitModel getParent(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Gets the parent unit of a unit.- Specified by:
getParent
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the child unit- Returns:
- the parent unit or null if
unit
was the root unit.
-
getRootUnit
public B2BUnitModel getRootUnit(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Gets the root unit.- Specified by:
getRootUnit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unit- Returns:
- the root unit
-
getAllParents
public java.util.List<B2BUnitModel> getAllParents(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Get all the parent units in the organization hierarchy all the way up to the root.- Specified by:
getAllParents
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unit- Returns:
- A Set of all b2b units (CompanyModel)
-
findUnitByUid
@Deprecated(since="4.4") public B2BUnitModel findUnitByUid(java.lang.String uid)
Deprecated.Since 4.4. UsegetUnitForUid(String)
insteadDescription copied from interface:B2BUnitService
Find unit by uid.- Specified by:
findUnitByUid
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
uid
- the uid- Returns:
- the b2 b unit model
-
getUnitForUid
public B2BUnitModel getUnitForUid(java.lang.String uid)
Description copied from interface:B2BUnitService
Find unit by uid.- Specified by:
getUnitForUid
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
uid
- the uid- Returns:
- the b2 b unit model
-
getCustomers
public java.util.Set<B2BCustomerModel> getCustomers(java.util.Set<B2BUnitModel> branch)
Description copied from interface:B2BUnitService
Gets the employees.- Specified by:
getCustomers
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
branch
- the branch- Returns:
- the employees
-
getAllUserGroupMembersForType
public <M extends PrincipalModel> java.util.Set<M> getAllUserGroupMembersForType(UserGroupModel userGroup, java.lang.Class<M> memberType)
Description copied from interface:B2BUnitService
Retrieves all members of a User Group of the specified type- Specified by:
getAllUserGroupMembersForType
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
userGroup
- the user groupmemberType
- the principle's member type- Returns:
- the principle members
-
addMember
public void addMember(B2BUnitModel group, PrincipalModel member)
Description copied from interface:B2BUnitService
Adds the member to a group. The model is not saved.- Specified by:
addMember
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
group
- the groupmember
- the member
-
updateParentB2BUnit
public void updateParentB2BUnit(B2BUnitModel parentB2BUnit, PrincipalModel member)
Description copied from interface:B2BUnitService
Set the parent unit of a given principal. The member is not saved.- Specified by:
updateParentB2BUnit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
parentB2BUnit
- the parent b2 b unitmember
- the member
-
getUsersOfUserGroup
@Deprecated(since="6.0") public java.util.Collection<B2BCustomerModel> getUsersOfUserGroup(B2BUnitModel unit, java.lang.String userGroupId)
Deprecated.Description copied from interface:B2BUnitService
Gets all members from the unit who belong to specified User Group- Specified by:
getUsersOfUserGroup
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unituserGroupId
- the user group id- Returns:
- A collection of users who are members of the unit with group userGroupId
-
getUsersOfUserGroup
public java.util.Collection<B2BCustomerModel> getUsersOfUserGroup(B2BUnitModel unit, java.lang.String userGroupId, boolean recursive)
Description copied from interface:B2BUnitService
Gets all members from the unit who belong to specified User Group- Specified by:
getUsersOfUserGroup
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Parameters:
unit
- the unituserGroupId
- the user group idrecursive
- 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
-
updateBranchInSession
public void updateBranchInSession(Session session, UserModel currentUser)
Description copied from interface:B2BUnitService
Sets the branch for the current use in the session.- Specified by:
updateBranchInSession
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
-
findApprovalProcessCodeForUnit
@Deprecated(since="4.4") public java.lang.String findApprovalProcessCodeForUnit(B2BUnitModel unit)
Deprecated.Since 4.4. UsegetApprovalProcessCodeForUnit(B2BUnitModel)
insteadDescription copied from interface:B2BUnitService
Get approval process code from unit, checking parent units up the organization tree up to the root unit if process is not set in theunit
- Specified by:
findApprovalProcessCodeForUnit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Returns:
- approval process code
-
getApprovalProcessCodeForUnit
@Deprecated(since="1905") public java.lang.String getApprovalProcessCodeForUnit(B2BUnitModel unit)
Deprecated.since 1905. Please use {@link de.hybris.platform.b2b.process.approval.services.impl.DefaultB2BApprovalProcessService.getApprovalProcessCodeForUnit(B2BUnitModel)} instead.Description copied from interface:B2BUnitService
Get approval process code from unit, checking parent units up the organization tree up to the root unit if process is not set in theunit
- Specified by:
getApprovalProcessCodeForUnit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Returns:
- approval process code
-
setUserService
public void setUserService(UserService userService)
-
getAllApprovalProcesses
@Deprecated(since="6.0") public java.util.List<java.lang.String> getAllApprovalProcesses()
Deprecated.Since 6.0. UsegetAllProcessDefinitionsNames()
Description copied from interface:B2BUnitService
Get All Approval Process codes defined in local.properties- Specified by:
getAllApprovalProcesses
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Returns:
- List of approval process codes
-
getAllProcessDefinitionsNames
public java.util.Set<java.lang.String> getAllProcessDefinitionsNames()
Description copied from interface:B2BUnitService
Gets all process definition name registered with theProcessDefinitionFactory
- Specified by:
getAllProcessDefinitionsNames
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Returns:
- A unique list of all Business process names.
-
findAccountManagerForUnit
@Deprecated(since="4.4") public EmployeeModel findAccountManagerForUnit(B2BUnitModel unit)
Deprecated.Since 4.4. UsegetAccountManagerForUnit(B2BUnitModel)
insteadDescription copied from interface:B2BUnitService
Get salesrep from unit, checking parent units up the organization tree up to the root unit if salesrep is not set in theunit
- Specified by:
findAccountManagerForUnit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Returns:
- the account manager
-
getAccountManagerForUnit
public EmployeeModel getAccountManagerForUnit(B2BUnitModel unit)
Description copied from interface:B2BUnitService
Get salesrep from unit, checking parent units up the organization tree up to the root unit if salesrep is not set in theunit
- Specified by:
getAccountManagerForUnit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Returns:
- the account manager
-
findUnitWithCreditLimit
@Deprecated(since="4.4") public B2BUnitModel findUnitWithCreditLimit(B2BUnitModel unit, CurrencyModel currency)
Deprecated.Since 4.4. UsegetUnitWithCreditLimit(B2BUnitModel)
insteadDescription copied from interface:B2BUnitService
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 theunit
- Specified by:
findUnitWithCreditLimit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Returns:
- unit with credit limit/check
-
getUnitWithCreditLimit
public B2BUnitModel getUnitWithCreditLimit(B2BUnitModel unit)
Description copied from interface:B2BUnitService
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 theunit
- Specified by:
getUnitWithCreditLimit
in interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>
- Returns:
- unit with credit limit/check
-
getActiveCreditLimit
protected B2BCreditLimitModel getActiveCreditLimit(B2BUnitModel unit)
-
getConfigurationService
protected ConfigurationService getConfigurationService()
-
getSearchRestrictionService
protected SearchRestrictionService getSearchRestrictionService()
-
lookupPriceGroupFromClosestParent
protected EnumerationValueModel lookupPriceGroupFromClosestParent(B2BUnitModel unitOfCustomer)
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
setSearchRestrictionService
public void setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
-
setB2bUnitDao
public void setB2bUnitDao(B2BUnitDao b2bUnitDao)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getSessionService
protected SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getUserService
protected UserService getUserService()
-
getProcessDefinitionFactory
protected ProcessDefinitionFactory getProcessDefinitionFactory()
-
setProcessDefinitionFactory
public void setProcessDefinitionFactory(ProcessDefinitionFactory processDefinitionFactory)
-
getPrincipalGroupMembersDao
protected PrincipalGroupMembersDao getPrincipalGroupMembersDao()
-
setPrincipalGroupMembersDao
public void setPrincipalGroupMembersDao(PrincipalGroupMembersDao principalGroupMembersDao)
-
getB2bUnitDao
protected B2BUnitDao getB2bUnitDao()
-
setTypeService
public void setTypeService(TypeService typeService)
-
getTypeService
protected TypeService getTypeService()
-
-