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 injectedCartServicesince this service is itself a service component.protected StringprefixWithEntityValidationMessageKey(@NonNull String errorCode) voidsetCartService(CartService<com.broadleafcommerce.cart.client.domain.Cart> cartService) Lazy injectedCartServicesince this service is itself a service component.booleansupports(Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) voidvalidate(@NonNull Object businessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected voidvalidateAuthorId(@NonNull org.springframework.validation.Errors errors) protected voidvalidateAuthorType(@NonNull org.springframework.validation.Errors errors) protected voidvalidateCartAndCartItemExists(@NonNull com.broadleafcommerce.cart.client.domain.CartNote cartNote, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates theCartandCartItemtheCartNoteis associated with exists.protected voidvalidateCartId(@NonNull org.springframework.validation.Errors errors) protected voidvalidateNote(@NonNull org.springframework.validation.Errors errors) protected voidvalidateReplies(@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 voidvalidateReply(@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, waitMethods 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:
supportsin 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:
validatein 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 theCartandCartItemtheCartNoteis associated with exists.- Parameters:
cartNote- theCartNoteto 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- theCartNoteto 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 parentCartNotethat 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 injectedCartServicesince 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 injectedCartServicesince this service is itself a service component.This avoids circular dependency exceptions
-