Class NDCProductAvailabilityOrderValidationStrategy
java.lang.Object
de.hybris.platform.ndc182facades.facades.order.strategies.impl.NDCProductAvailabilityOrderValidationStrategy
- All Implemented Interfaces:
NDCChangeOrderValidationStrategy
public class NDCProductAvailabilityOrderValidationStrategy
extends Object
implements NDCChangeOrderValidationStrategy
The Ndc product availability order validation strategy.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LonggetAvailableStock(ProductModel productModel, TransportOfferingModel transportOfferingModel, OrderModel order) Gets available stock.protected BookingServiceGets booking service.protected de.hybris.platform.product.ProductServiceGets product service.protected LonggetQuantityToOffer(ProductModel productModel, List<TransportOfferingModel> transportOfferingModels, Long quantity, OrderModel order) This method calculates the total quantity of a particular product in a request.protected TransportOfferingServiceGets transport offering service.protected TravelCommerceStockServiceGets travel commerce stock service.protected booleanisProductAvailable(String productCode, List<String> transportOfferingCodes, Long quantity, OrderModel order) Checks if products are available.voidsetBookingService(BookingService bookingService) Sets booking service.voidsetProductService(de.hybris.platform.product.ProductService productService) Sets product service.voidsetTransportOfferingService(TransportOfferingService transportOfferingService) Sets transport offering service.voidsetTravelCommerceStockService(TravelCommerceStockService travelCommerceStockService) Sets travel commerce stock service.booleanvalidateAmendOrder(OrderModel order, String productCode, Long qty, String travellerCode, List<String> transportOfferingCodes, String travelRouteCode) Method that validates if an ancillary can be added or removed to the specified order
-
Constructor Details
-
NDCProductAvailabilityOrderValidationStrategy
public NDCProductAvailabilityOrderValidationStrategy()
-
-
Method Details
-
validateAmendOrder
public boolean validateAmendOrder(OrderModel order, String productCode, Long qty, String travellerCode, List<String> transportOfferingCodes, String travelRouteCode) Description copied from interface:NDCChangeOrderValidationStrategyMethod that validates if an ancillary can be added or removed to the specified order- Specified by:
validateAmendOrderin interfaceNDCChangeOrderValidationStrategy- Parameters:
order- the order to which the ancillary needs to be addedproductCode- as the product to be added or removed from the orderqty- as the quantity to add/removetravellerCode- as the code of the traveller to whom the product is added or removedtransportOfferingCodes- as the codes of the transportOfferings the product is added to or removed fromtravelRouteCode- as the travelRouteCode the product is added to or removed from- Returns:
- valid add to order if true, false otherwise.
-
isProductAvailable
protected boolean isProductAvailable(String productCode, List<String> transportOfferingCodes, Long quantity, OrderModel order) Checks if products are available. This method first calculates the total number of unique products in the request and then substracts the quantity already reserved in the original order.- Parameters:
productCode- the product codetransportOfferingCodes- the transport offering codesquantity- the quantityorder- the order- Returns:
- the boolean
-
getAvailableStock
protected Long getAvailableStock(ProductModel productModel, TransportOfferingModel transportOfferingModel, OrderModel order) Gets available stock.- Parameters:
productModel- the product modeltransportOfferingModel- the transport offering modelorder- the order- Returns:
- the available stock
-
getQuantityToOffer
protected Long getQuantityToOffer(ProductModel productModel, List<TransportOfferingModel> transportOfferingModels, Long quantity, OrderModel order) This method calculates the total quantity of a particular product in a request.- Parameters:
productModel- the product modeltransportOfferingModels- the transport offering modelsquantity- the quantityorder- the order- Returns:
- a Long
-
getProductService
protected de.hybris.platform.product.ProductService getProductService()Gets product service.- Returns:
- the product service
-
setProductService
public void setProductService(de.hybris.platform.product.ProductService productService) Sets product service.- Parameters:
productService- the product service
-
getTransportOfferingService
Gets transport offering service.- Returns:
- the transport offering service
-
setTransportOfferingService
Sets transport offering service.- Parameters:
transportOfferingService- the transport offering service
-
getTravelCommerceStockService
Gets travel commerce stock service.- Returns:
- the travel commerce stock service
-
setTravelCommerceStockService
Sets travel commerce stock service.- Parameters:
travelCommerceStockService- the travel commerce stock service
-
getBookingService
Gets booking service.- Returns:
- the booking service
-
setBookingService
Sets booking service.- Parameters:
bookingService- the booking service
-