Class CartNoteValidator
java.lang.Object
com.broadleafcommerce.cart.service.validation.CartNoteValidator
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
public class CartNoteValidator
extends Object
implements com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
Validator used to validate
CartNote
.- Author:
- Sunny Yu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CartService<com.broadleafcommerce.cart.client.domain.Cart>
Lazy injectedCartService
since this service is itself a service component.protected String
prefixWithEntityValidationMessageKey
(@NonNull String errorCode) void
setCartService
(CartService<com.broadleafcommerce.cart.client.domain.Cart> cartService) Lazy injectedCartService
since this service is itself a service component.boolean
supports
(Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) void
validate
(@NonNull Object businessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected void
validateAuthorId
(@NonNull org.springframework.validation.Errors errors) protected void
validateAuthorType
(@NonNull org.springframework.validation.Errors errors) protected void
validateCartAndCartItemExists
(@NonNull com.broadleafcommerce.cart.client.domain.CartNote cartNote, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates theCart
andCartItem
theCartNote
is associated with exists.protected void
validateCartId
(@NonNull org.springframework.validation.Errors errors) protected void
validateNote
(@NonNull org.springframework.validation.Errors errors) protected void
validateReplies
(@NonNull com.broadleafcommerce.cart.client.domain.CartNote cartNote, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates theCartNote.getReplies()
.protected void
validateReply
(@NonNull com.broadleafcommerce.cart.client.domain.CartNote parentCartNote, @NonNull com.broadleafcommerce.cart.client.domain.CartNote reply, int replyIndex, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate an individual reply.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
validateForCreate, validateForReplace, validateForUpdate
-
Constructor Details
-
CartNoteValidator
public CartNoteValidator()
-
-
Method Details
-
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 @NonNull Object businessInstance, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
validate
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validateCartId
protected void validateCartId(@NonNull @NonNull org.springframework.validation.Errors errors) -
validateNote
protected void validateNote(@NonNull @NonNull org.springframework.validation.Errors errors) -
validateAuthorType
protected void validateAuthorType(@NonNull @NonNull org.springframework.validation.Errors errors) -
validateAuthorId
protected void validateAuthorId(@NonNull @NonNull org.springframework.validation.Errors errors) -
validateCartAndCartItemExists
protected void validateCartAndCartItemExists(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartNote cartNote, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates theCart
andCartItem
theCartNote
is associated with exists.- Parameters:
cartNote
- theCartNote
to validateerrors
- the errors bound to the parent object being validatedcontextInfo
- context information related to multitenancy
-
validateReplies
protected void validateReplies(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartNote cartNote, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates theCartNote.getReplies()
.- Parameters:
cartNote
- theCartNote
to validateerrors
- the errors bound to the parent object being validatedcontextInfo
- context information related to multitenancy
-
validateReply
protected void validateReply(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartNote parentCartNote, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartNote reply, int replyIndex, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate an individual reply.- Parameters:
parentCartNote
- the parentCartNote
that this reply belongs toreply
- the reply to validatereplyIndex
- the index of the replyerrors
- the errors bound to the parent object being validatedcontextInfo
- context information related to multitenancy
-
prefixWithEntityValidationMessageKey
-
getCartService
Lazy injectedCartService
since this service is itself a service component.This avoids circular dependency exceptions
-
setCartService
@Autowired @Lazy public void setCartService(CartService<com.broadleafcommerce.cart.client.domain.Cart> cartService) Lazy injectedCartService
since this service is itself a service component.This avoids circular dependency exceptions
-