Class DefaultReturnRequestValidator
- java.lang.Object
-
- com.broadleafcommerce.orderoperation.service.validator.DefaultReturnRequestValidator
-
- All Implemented Interfaces:
ReturnRequestValidator
public class DefaultReturnRequestValidator extends Object implements ReturnRequestValidator
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DUPLICATE_ITEM_ID_CODE
protected static String
DUPLICATE_ITEM_ID_MESSAGE
protected static String
INSUFFICIENT_QUANTITY_CODE
protected static String
INSUFFICIENT_QUANTITY_MESSAGE
protected static String
INVALID_QUANTITY_CODE
protected static String
INVALID_QUANTITY_MESSAGE
protected static String
ITEM_QUANTITY_FIELD
protected static String
ITEMS_FIELD
protected static String
MISSING_ITEM_CODE
protected static String
MISSING_ITEM_MESSAGE
protected static String
NOT_FULFILLED_ITEM_CODE
protected static String
NOT_FULFILLED_ITEM_MESSAGE
protected static String
ORDER_FULFILLMENT_ITEM_ID_FIELD
protected static String
ZERO_QUANTITY_CODE
protected static String
ZERO_QUANTITY_MESSAGE
-
Constructor Summary
Constructors Constructor Description DefaultReturnRequestValidator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
checkAndValidateItemExistsInFulfillment(ReturnItemRequest returnItemRequest, int itemIndex, Map<String,Integer> fulfillmentItemQuantities, org.springframework.validation.Errors errors)
protected boolean
checkAndValidateQuantityValueValid(ReturnItemRequest returnItemRequest, int itemIndex, org.springframework.validation.Errors errors)
protected String
itemQuantityFieldForIndex(int index)
protected String
orderFulfillmentItemIdFieldForIndex(int index)
protected static String
prefixWithEntityValidationMessageKey(String errorCode)
protected void
subtractExistingReturnItemQuantity(Map<String,Integer> fulfillmentItemQuantities, com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem)
protected void
subtractExistingReturnsQuantities(Map<String,Integer> fulfillmentItemQuantities, List<com.broadleafcommerce.order.client.domain.ReturnAuthorization> returns)
void
validate(ReturnRequest returnRequest, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<com.broadleafcommerce.order.client.domain.ReturnAuthorization> returns)
Determines that the item quantities to return are valid for theOrderFulfillments
which can be returned from.protected void
validateFulfilled(ReturnRequest returnRequest, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, org.springframework.validation.Errors errors)
protected void
validateNotAllZeroQuantities(ReturnRequest returnRequest, org.springframework.validation.Errors errors)
protected void
validateOneRequestPerItem(ReturnRequest returnRequest, org.springframework.validation.Errors errors)
protected void
validateQuantities(ReturnRequest returnRequest, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<com.broadleafcommerce.order.client.domain.ReturnAuthorization> returns, org.springframework.validation.Errors errors)
protected void
validateSufficientQuantityInFulfillment(ReturnItemRequest returnItemRequest, int itemIndex, Map<String,Integer> fulfillmentItemQuantities, org.springframework.validation.Errors errors)
-
-
-
Field Detail
-
ITEMS_FIELD
protected static final String ITEMS_FIELD
- See Also:
- Constant Field Values
-
ORDER_FULFILLMENT_ITEM_ID_FIELD
protected static final String ORDER_FULFILLMENT_ITEM_ID_FIELD
- See Also:
- Constant Field Values
-
ITEM_QUANTITY_FIELD
protected static final String ITEM_QUANTITY_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
-
DUPLICATE_ITEM_ID_CODE
protected static final String DUPLICATE_ITEM_ID_CODE
-
DUPLICATE_ITEM_ID_MESSAGE
protected static final String DUPLICATE_ITEM_ID_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
-
NOT_FULFILLED_ITEM_CODE
protected static final String NOT_FULFILLED_ITEM_CODE
-
NOT_FULFILLED_ITEM_MESSAGE
protected static final String NOT_FULFILLED_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(ReturnRequest returnRequest, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<com.broadleafcommerce.order.client.domain.ReturnAuthorization> returns)
Description copied from interface:ReturnRequestValidator
Determines that the item quantities to return are valid for theOrderFulfillments
which can be returned from.- Specified by:
validate
in interfaceReturnRequestValidator
- Parameters:
returnRequest
- the request to create a returnfulfillments
- the fulfillments for the orderreturns
- the existing returns for the order
-
validateQuantities
protected void validateQuantities(ReturnRequest returnRequest, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<com.broadleafcommerce.order.client.domain.ReturnAuthorization> returns, org.springframework.validation.Errors errors)
-
validateNotAllZeroQuantities
protected void validateNotAllZeroQuantities(ReturnRequest returnRequest, org.springframework.validation.Errors errors)
-
validateOneRequestPerItem
protected void validateOneRequestPerItem(ReturnRequest returnRequest, org.springframework.validation.Errors errors)
-
subtractExistingReturnsQuantities
protected void subtractExistingReturnsQuantities(Map<String,Integer> fulfillmentItemQuantities, List<com.broadleafcommerce.order.client.domain.ReturnAuthorization> returns)
-
checkAndValidateQuantityValueValid
protected boolean checkAndValidateQuantityValueValid(ReturnItemRequest returnItemRequest, int itemIndex, org.springframework.validation.Errors errors)
-
checkAndValidateItemExistsInFulfillment
protected boolean checkAndValidateItemExistsInFulfillment(ReturnItemRequest returnItemRequest, int itemIndex, Map<String,Integer> fulfillmentItemQuantities, org.springframework.validation.Errors errors)
-
validateSufficientQuantityInFulfillment
protected void validateSufficientQuantityInFulfillment(ReturnItemRequest returnItemRequest, int itemIndex, Map<String,Integer> fulfillmentItemQuantities, org.springframework.validation.Errors errors)
-
subtractExistingReturnItemQuantity
protected void subtractExistingReturnItemQuantity(Map<String,Integer> fulfillmentItemQuantities, com.broadleafcommerce.order.client.domain.ReturnAuthorizationItem returnItem)
-
validateFulfilled
protected void validateFulfilled(ReturnRequest returnRequest, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, org.springframework.validation.Errors errors)
-
orderFulfillmentItemIdFieldForIndex
protected String orderFulfillmentItemIdFieldForIndex(int index)
-
itemQuantityFieldForIndex
protected String itemQuantityFieldForIndex(int index)
-
-