Class UserRoleValidator
- java.lang.Object
-
- com.broadleafcommerce.auth.resource.service.validation.UserRoleValidator
-
-
Constructor Summary
Constructors Constructor Description UserRoleValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected UserRoleService<UserRole>
getUserRoleService()
protected String
prefixWithEntityValidationMessageKey(String errorCode)
void
setUserRoleService(UserRoleService<UserRole> userRoleService)
Lazy injection since this validator is itself a service component.boolean
supports(Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
void
validate(Object businessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
void
validateForReplace(Object businessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
protected void
validateName(org.springframework.validation.Errors errors)
protected void
validateParentRoleId(UserRole role, org.springframework.validation.Errors errors)
Traverses the full ancestry of the role to confirm each ancestor still exists and there are no cycles, either in the case that the ancestors already had cycles, or in the case that this role itself causes a cycle.
-
-
-
Method Detail
-
setUserRoleService
@Autowired @Lazy public void setUserRoleService(UserRoleService<UserRole> userRoleService)
Lazy injection since this validator is itself a service component. This avoids circular dependency exceptions- Parameters:
userRoleService
- the role service
-
supports
public boolean supports(Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
- Specified by:
supports
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validate
public void validate(@NonNull Object businessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
- Specified by:
validate
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validateForReplace
public void validateForReplace(Object businessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
- Specified by:
validateForReplace
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validateName
protected void validateName(org.springframework.validation.Errors errors)
-
validateParentRoleId
protected void validateParentRoleId(UserRole role, org.springframework.validation.Errors errors)
Traverses the full ancestry of the role to confirm each ancestor still exists and there are no cycles, either in the case that the ancestors already had cycles, or in the case that this role itself causes a cycle. SeevalidateRoleAncestry(UserRole, Errors)
for more information.- Parameters:
role
- the role to validateerrors
- the errors object bound to therole
on which errors can be registered
-
prefixWithEntityValidationMessageKey
protected String prefixWithEntityValidationMessageKey(String errorCode)
-
getUserRoleService
protected UserRoleService<UserRole> getUserRoleService()
-
-