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 voidaddMember(B2BUnitModel group, PrincipalModel member)Adds the member to a group.voiddisableBranch(B2BUnitModel unit)Disable branch.voiddisableUnit(B2BUnitModel unit)Disables a b2b unitvoidenableBranch(B2BUnitModel unit)Enable branch.voidenableUnit(B2BUnitModel unit)Enables a b2b unitEmployeeModelfindAccountManagerForUnit(B2BUnitModel unit)Deprecated.Since 4.4.java.lang.StringfindApprovalProcessCodeForUnit(B2BUnitModel unit)Deprecated.Since 4.4.B2BUnitModelfindUnitByUid(java.lang.String uid)Deprecated.Since 4.4.B2BUnitModelfindUnitWithCreditLimit(B2BUnitModel unit, CurrencyModel currency)Deprecated.Since 4.4.EmployeeModelgetAccountManagerForUnit(B2BUnitModel unit)Get salesrep from unit, checking parent units up the organization tree up to the root unit if salesrep is not set in theunitprotected B2BCreditLimitModelgetActiveCreditLimit(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 theProcessDefinitionFactoryjava.util.Set<B2BUnitModel>getAllUnitsOfOrganization(B2BCustomerModel employee)Retrieves all units of an organization thecustomerbelongs 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.StringgetApprovalProcessCodeForUnit(B2BUnitModel unit)Deprecated.since 1905.java.util.Set<B2BCustomerModel>getB2BCustomers(B2BUnitModel unit)Gets the b2 b customers.protected B2BUnitDaogetB2bUnitDao()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 voidgetBranch(B2BUnitModel parent, java.util.Set<B2BUnitModel> organizationSet)protected ConfigurationServicegetConfigurationService()java.util.Set<B2BCustomerModel>getCustomers(java.util.Set<B2BUnitModel> branch)Gets the employees.protected ModelServicegetModelService()B2BUnitModelgetParent(B2BCustomerModel employee)Gets the parent unit of a user.B2BUnitModelgetParent(B2BUnitModel unit)Gets the parent unit of a unit.protected PrincipalGroupMembersDaogetPrincipalGroupMembersDao()protected ProcessDefinitionFactorygetProcessDefinitionFactory()B2BUnitModelgetRootUnit(B2BUnitModel unit)Gets the root unit.protected SearchRestrictionServicegetSearchRestrictionService()protected SessionServicegetSessionService()protected TypeServicegetTypeService()B2BUnitModelgetUnitForUid(java.lang.String uid)Find unit by uid.B2BUnitModelgetUnitWithCreditLimit(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 theunitprotected UserServicegetUserService()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 EnumerationValueModellookupPriceGroupFromClosestParent(B2BUnitModel unitOfCustomer)voidsetB2bUnitDao(B2BUnitDao b2bUnitDao)voidsetConfigurationService(ConfigurationService configurationService)voidsetCurrentUnit(B2BCustomerModel customer, B2BUnitModel unit)Assigns a default unit for a customer who may be a member of multiple units.voidsetModelService(ModelService modelService)voidsetPrincipalGroupMembersDao(PrincipalGroupMembersDao principalGroupMembersDao)voidsetProcessDefinitionFactory(ProcessDefinitionFactory processDefinitionFactory)voidsetSearchRestrictionService(SearchRestrictionService searchRestrictionService)voidsetSessionService(SessionService sessionService)voidsetTypeService(TypeService typeService)voidsetUserService(UserService userService)protected voidtoggleBranch(B2BUnitModel unit, java.lang.Boolean enable)Enables or disables a branch and it sibling typesB2BCostCenterModelB2BBudgetModelandB2BCustomerModelassigned to all units in the branch.protected voidtoggleUnit(B2BUnitModel b2bUnitModel, java.lang.Boolean enable)voidupdateBranchInSession(Session session, UserModel currentUser)Sets the branch for the current use in the session.voidupdateParentB2BUnit(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:B2BUnitServiceRetrieves all units of an organization theunitbelongs too.- Specified by:
getAllUnitsOfOrganizationin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
unit- AB2BUnitModelwithin an organization- Returns:
- A list of all units within an organization.
-
getBranch
public java.util.Set<B2BUnitModel> getBranch(B2BUnitModel unit)
Description copied from interface:B2BUnitServiceGets the branch of a unit.- Specified by:
getBranchin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
unit- the unit- Returns:
- the branch
-
disableBranch
public void disableBranch(B2BUnitModel unit)
Description copied from interface:B2BUnitServiceDisable branch. Mark all units in the branch as active = false- Specified by:
disableBranchin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
unit- the unit
-
enableBranch
public void enableBranch(B2BUnitModel unit)
Description copied from interface:B2BUnitServiceEnable branch. Mark all unit in the branch as active = true.- Specified by:
enableBranchin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
unit- the unit
-
disableUnit
public void disableUnit(B2BUnitModel unit)
Description copied from interface:B2BUnitServiceDisables a b2b unit- Specified by:
disableUnitin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
unit- the unit
-
enableUnit
public void enableUnit(B2BUnitModel unit)
Description copied from interface:B2BUnitServiceEnables a b2b unit- Specified by:
enableUnitin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
unit- the unit
-
setCurrentUnit
public void setCurrentUnit(B2BCustomerModel customer, B2BUnitModel unit)
Description copied from interface:B2BUnitServiceAssigns 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:
setCurrentUnitin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
customer- The current customerunit- AB2BUnitModelto 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 typesB2BCostCenterModelB2BBudgetModelandB2BCustomerModelassigned 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.TRUEall 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:B2BUnitServiceGets units that are children of the current unit.- Specified by:
getB2BUnitsin 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:B2BUnitServiceGets the b2 b customers.- Specified by:
getB2BCustomersin 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:B2BUnitServiceRetrieves all units of an organization thecustomerbelongs too.- Specified by:
getAllUnitsOfOrganizationin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
employee- the session user.- Returns:
- the all units of organization
-
getParent
public B2BUnitModel getParent(B2BCustomerModel employee)
Description copied from interface:B2BUnitServiceGets the parent unit of a user.- Specified by:
getParentin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
employee- the employee- Returns:
- the parent
-
getParent
public B2BUnitModel getParent(B2BUnitModel unit)
Description copied from interface:B2BUnitServiceGets the parent unit of a unit.- Specified by:
getParentin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
unit- the child unit- Returns:
- the parent unit or null if
unitwas the root unit.
-
getRootUnit
public B2BUnitModel getRootUnit(B2BUnitModel unit)
Description copied from interface:B2BUnitServiceGets the root unit.- Specified by:
getRootUnitin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
unit- the unit- Returns:
- the root unit
-
getAllParents
public java.util.List<B2BUnitModel> getAllParents(B2BUnitModel unit)
Description copied from interface:B2BUnitServiceGet all the parent units in the organization hierarchy all the way up to the root.- Specified by:
getAllParentsin 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:B2BUnitServiceFind unit by uid.- Specified by:
findUnitByUidin 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:B2BUnitServiceFind unit by uid.- Specified by:
getUnitForUidin 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:B2BUnitServiceGets the employees.- Specified by:
getCustomersin 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:B2BUnitServiceRetrieves all members of a User Group of the specified type- Specified by:
getAllUserGroupMembersForTypein 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:B2BUnitServiceAdds the member to a group. The model is not saved.- Specified by:
addMemberin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Parameters:
group- the groupmember- the member
-
updateParentB2BUnit
public void updateParentB2BUnit(B2BUnitModel parentB2BUnit, PrincipalModel member)
Description copied from interface:B2BUnitServiceSet the parent unit of a given principal. The member is not saved.- Specified by:
updateParentB2BUnitin 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:B2BUnitServiceGets all members from the unit who belong to specified User Group- Specified by:
getUsersOfUserGroupin 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:B2BUnitServiceGets all members from the unit who belong to specified User Group- Specified by:
getUsersOfUserGroupin 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:B2BUnitServiceSets the branch for the current use in the session.- Specified by:
updateBranchInSessionin 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:B2BUnitServiceGet 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:
findApprovalProcessCodeForUnitin 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:B2BUnitServiceGet 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:
getApprovalProcessCodeForUnitin 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:B2BUnitServiceGet All Approval Process codes defined in local.properties- Specified by:
getAllApprovalProcessesin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Returns:
- List of approval process codes
-
getAllProcessDefinitionsNames
public java.util.Set<java.lang.String> getAllProcessDefinitionsNames()
Description copied from interface:B2BUnitServiceGets all process definition name registered with theProcessDefinitionFactory- Specified by:
getAllProcessDefinitionsNamesin 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:B2BUnitServiceGet salesrep from unit, checking parent units up the organization tree up to the root unit if salesrep is not set in theunit- Specified by:
findAccountManagerForUnitin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Returns:
- the account manager
-
getAccountManagerForUnit
public EmployeeModel getAccountManagerForUnit(B2BUnitModel unit)
Description copied from interface:B2BUnitServiceGet salesrep from unit, checking parent units up the organization tree up to the root unit if salesrep is not set in theunit- Specified by:
getAccountManagerForUnitin 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:B2BUnitServiceGet 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:
findUnitWithCreditLimitin interfaceB2BUnitService<B2BUnitModel,B2BCustomerModel>- Returns:
- unit with credit limit/check
-
getUnitWithCreditLimit
public B2BUnitModel getUnitWithCreditLimit(B2BUnitModel unit)
Description copied from interface:B2BUnitServiceGet 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:
getUnitWithCreditLimitin 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()
-
-