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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected CartService<com.broadleafcommerce.cart.client.domain.Cart>
    Lazy injected CartService since this service is itself a service component.
    protected String
     
    void
    setCartService(CartService<com.broadleafcommerce.cart.client.domain.Cart> cartService)
    Lazy injected CartService 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 the Cart and CartItem the CartNote 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 the CartNote.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 interface com.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 interface com.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 the Cart and CartItem the CartNote is associated with exists.
      Parameters:
      cartNote - the CartNote to validate
      errors - the errors bound to the parent object being validated
      contextInfo - 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 the CartNote.getReplies().
      Parameters:
      cartNote - the CartNote to validate
      errors - the errors bound to the parent object being validated
      contextInfo - 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 parent CartNote that this reply belongs to
      reply - the reply to validate
      replyIndex - the index of the reply
      errors - the errors bound to the parent object being validated
      contextInfo - context information related to multitenancy
    • prefixWithEntityValidationMessageKey

      protected String prefixWithEntityValidationMessageKey(@NonNull @NonNull String errorCode)
    • getCartService

      protected CartService<com.broadleafcommerce.cart.client.domain.Cart> getCartService()
      Lazy injected CartService 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 injected CartService since this service is itself a service component.

      This avoids circular dependency exceptions