Class DefaultPunchOutUserSelectionStrategy
- java.lang.Object
-
- de.hybris.platform.b2bpunchoutaddon.security.impl.DefaultPunchOutUserSelectionStrategy
-
- All Implemented Interfaces:
PunchOutUserSelectionStrategy
public class DefaultPunchOutUserSelectionStrategy extends java.lang.Object implements PunchOutUserSelectionStrategy
Default strategy implementation forPunchOutUserSelectionStrategythat makes sure we create a new user if none exists for the providedPunchOutContact.
-
-
Constructor Summary
Constructors Constructor Description DefaultPunchOutUserSelectionStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected UserModelfindUser(java.lang.String userId)java.util.Collection<java.lang.String>getAcceptedUserTypes()CustomerAccountServicegetCustomerAccountService()ModelServicegetModelService()UserServicegetUserService()UserModelselect(java.lang.String userId, java.util.Collection<UserGroupModel> userGroups, PunchOutSession punchoutSession)Tries to find a user with the givenuserId.voidsetAcceptedUserTypes(java.util.Collection<java.lang.String> acceptedUserTypes)voidsetCustomerAccountService(CustomerAccountService customerAccountService)voidsetModelService(ModelService modelService)voidsetUserService(UserService userService)protected voidvalidateUser(UserModel user, java.util.Collection<UserGroupModel> groups)Validates that the given user is part of allgroupsand is at least one ofgetAcceptedUserTypes().
-
-
-
Method Detail
-
select
public UserModel select(java.lang.String userId, java.util.Collection<UserGroupModel> userGroups, PunchOutSession punchoutSession)
Tries to find a user with the givenuserId. If the user does not exist, creates a new one.- Specified by:
selectin interfacePunchOutUserSelectionStrategy- Parameters:
userId- The user's ID.userGroups- The user groups related to the given user (not mandatory for existent users).punchoutSession- The Punch Out session.- Returns:
- The
UserModelfor the givenuserId.
-
findUser
protected UserModel findUser(java.lang.String userId)
-
validateUser
protected void validateUser(UserModel user, java.util.Collection<UserGroupModel> groups)
Validates that the given user is part of allgroupsand is at least one ofgetAcceptedUserTypes().- Parameters:
user- The user to validate.groups- The groups that the user belongs to.
-
getUserService
public UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getModelService
public ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getAcceptedUserTypes
public java.util.Collection<java.lang.String> getAcceptedUserTypes()
-
setAcceptedUserTypes
public void setAcceptedUserTypes(java.util.Collection<java.lang.String> acceptedUserTypes)
-
getCustomerAccountService
public CustomerAccountService getCustomerAccountService()
-
setCustomerAccountService
public void setCustomerAccountService(CustomerAccountService customerAccountService)
-
-