Class DefaultFulfillmentStatusChangeValidator
- java.lang.Object
-
- com.broadleafcommerce.orderoperation.service.validator.DefaultFulfillmentStatusChangeValidator
-
- All Implemented Interfaces:
FulfillmentStatusChangeValidator
public class DefaultFulfillmentStatusChangeValidator extends Object implements FulfillmentStatusChangeValidator
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringINSUFFICIENT_QUANTITY_CODEprotected static StringINSUFFICIENT_QUANTITY_MESSAGEprotected static StringINVALID_QUANTITY_CODEprotected static StringINVALID_QUANTITY_MESSAGEprotected static StringITEM_QUANTITIES_FIELDprotected static StringMISSING_ITEM_CODEprotected static StringMISSING_ITEM_MESSAGEprotected static StringZERO_QUANTITY_CODEprotected static StringZERO_QUANTITY_MESSAGE
-
Constructor Summary
Constructors Constructor Description DefaultFulfillmentStatusChangeValidator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckAndValidateItemExistsInFulfillment(String itemId, Map<String,Integer> fulfillmentItemQuantities, org.springframework.validation.Errors errors)protected booleancheckAndValidateQuantityValueValid(Integer quantity, String itemId, org.springframework.validation.Errors errors)protected static StringprefixWithEntityValidationMessageKey(String errorCode)voidvalidate(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment)Determines that the status change request is valid for the given fulfillment.protected voidvalidateNotAllZeroQuantities(Map<String,Integer> itemQuantities, org.springframework.validation.Errors errors)protected voidvalidateQuantities(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, org.springframework.validation.Errors errors)Checks that the fulfillment has the necessary item quantities for the status change request.protected voidvalidateSufficientQuantityInFulfillment(String itemId, Integer quantity, Map<String,Integer> fulfillmentItemQuantities, org.springframework.validation.Errors errors)
-
-
-
Field Detail
-
ITEM_QUANTITIES_FIELD
protected static final String ITEM_QUANTITIES_FIELD
- See Also:
- Constant Field Values
-
ZERO_QUANTITY_CODE
protected static final String ZERO_QUANTITY_CODE
-
ZERO_QUANTITY_MESSAGE
protected static final String ZERO_QUANTITY_MESSAGE
- See Also:
- Constant Field Values
-
INVALID_QUANTITY_CODE
protected static final String INVALID_QUANTITY_CODE
-
INVALID_QUANTITY_MESSAGE
protected static final String INVALID_QUANTITY_MESSAGE
- See Also:
- Constant Field Values
-
MISSING_ITEM_CODE
protected static final String MISSING_ITEM_CODE
-
MISSING_ITEM_MESSAGE
protected static final String MISSING_ITEM_MESSAGE
- See Also:
- Constant Field Values
-
INSUFFICIENT_QUANTITY_CODE
protected static final String INSUFFICIENT_QUANTITY_CODE
-
INSUFFICIENT_QUANTITY_MESSAGE
protected static final String INSUFFICIENT_QUANTITY_MESSAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
validate
public void validate(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment)
Description copied from interface:FulfillmentStatusChangeValidatorDetermines that the status change request is valid for the given fulfillment.- Specified by:
validatein interfaceFulfillmentStatusChangeValidator- Parameters:
request- the request to change the status of the fulfillmentfulfillment- the fulfillment to have its status changed
-
validateQuantities
protected void validateQuantities(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, org.springframework.validation.Errors errors)
Checks that the fulfillment has the necessary item quantities for the status change request.- Parameters:
request- the request to change the status of the fulfillmentfulfillment- the fulfillment to have its status changederrors- the errors bound to the request object being validated
-
validateNotAllZeroQuantities
protected void validateNotAllZeroQuantities(Map<String,Integer> itemQuantities, org.springframework.validation.Errors errors)
-
checkAndValidateQuantityValueValid
protected boolean checkAndValidateQuantityValueValid(Integer quantity, String itemId, org.springframework.validation.Errors errors)
-
checkAndValidateItemExistsInFulfillment
protected boolean checkAndValidateItemExistsInFulfillment(String itemId, Map<String,Integer> fulfillmentItemQuantities, org.springframework.validation.Errors errors)
-
validateSufficientQuantityInFulfillment
protected void validateSufficientQuantityInFulfillment(String itemId, Integer quantity, Map<String,Integer> fulfillmentItemQuantities, org.springframework.validation.Errors errors)
-
-