Class OrderNoteValidator<P extends OrderNote>
java.lang.Object
com.broadleafcommerce.order.service.validation.OrderNoteValidator<P>
- Type Parameters:
P
- AOrder
or subclass
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
public class OrderNoteValidator<P extends OrderNote>
extends Object
implements com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
Validations for
OrderNote
. Validates that OrderNote.getOrderId()
and
OrderNote.getNote()
are not empty, and that the order specified by
OrderNote.getOrderId()
exists.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected OrderService<com.broadleafcommerce.order.client.domain.Order>
protected String
prefixWithEntityValidationMessageKey
(String errorCode) void
setOrderService
(OrderService<com.broadleafcommerce.order.client.domain.Order> orderService) 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) protected void
validateExistingOrder
(P orderNote, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validates that theOrder
exists for theOrderNote
.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
-
OrderNoteValidator
public OrderNoteValidator()
-
-
Method Details
-
setOrderService
@Autowired @Lazy public void setOrderService(OrderService<com.broadleafcommerce.order.client.domain.Order> orderService) Lazy injection since this validator is itself a service component. This avoids circular dependency exceptions.- Parameters:
orderService
- the order 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(Object businessInstance, 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
-
validateExistingOrder
protected void validateExistingOrder(P orderNote, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validates that theOrder
exists for theOrderNote
.- Parameters:
orderNote
- order note to check if its order existserrors
- holder for validation context informationcontext
- current context this validation is running in
-
prefixWithEntityValidationMessageKey
-
getOrderService
-