Class DefaultRatePlanService
java.lang.Object
de.hybris.platform.travelservices.services.impl.DefaultRatePlanService
- All Implemented Interfaces:
RatePlanService
The type Default rate plan service.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAppliedGuaranteeAmount(GuaranteeModel guaranteeToApply, BigDecimal roomRatePrice) Return amount to be paid as guarantee, applying the guarantee model on the price.protected DoublegetGuaranteeAmount(Double amountPercent, Double totalPrice) Gets guarantee amount.protected Comparator<GuaranteeModel>Gets guarantee comparator.getGuaranteeToApply(AccommodationOrderEntryGroupModel group, Date date) Return the correct guarantee to apply given the order entry group and the date when we want to apply itgetGuaranteeToApply(AccommodationOrderEntryGroupModel group, Date startingDate, Date currentDate) Return the correct guarantee to apply given the order entry group and the date when we want to apply itprotected GuaranteeModelgetGuranteeToApply(List<GuaranteeModel> guarantees, Date startingDate, Date currentDate) Gets gurantee to apply.protected RatePlanDaoGets rate plan dao.getRatePlanForCode(String ratePlanCode) Returns the RatePlanModel for a given codeprotected voidnormalizeGuaranteesDeadlines(List<GuaranteeModel> guarantees, Date startingDate, Date currentDate) This method normalizes deadlines, setting the relative deadline to the given date if it is before this date.voidsetGuaranteeComparator(Comparator<GuaranteeModel> guaranteeComparator) Sets guarantee comparator.voidsetRatePlanDao(RatePlanDao ratePlanDao) Sets rate plan dao.
-
Constructor Details
-
DefaultRatePlanService
public DefaultRatePlanService()
-
-
Method Details
-
getGuaranteeToApply
Description copied from interface:RatePlanServiceReturn the correct guarantee to apply given the order entry group and the date when we want to apply it- Specified by:
getGuaranteeToApplyin interfaceRatePlanService- Parameters:
group- the groupdate- the date- Returns:
- guarantee to apply
-
getGuaranteeToApply
public GuaranteeModel getGuaranteeToApply(AccommodationOrderEntryGroupModel group, Date startingDate, Date currentDate) Description copied from interface:RatePlanServiceReturn the correct guarantee to apply given the order entry group and the date when we want to apply it- Specified by:
getGuaranteeToApplyin interfaceRatePlanService- Parameters:
group- the groupstartingDate- the starting datecurrentDate- the current date- Returns:
- guarantee to apply
-
getGuranteeToApply
protected GuaranteeModel getGuranteeToApply(List<GuaranteeModel> guarantees, Date startingDate, Date currentDate) Gets gurantee to apply.- Parameters:
guarantees- the guaranteesstartingDate- the starting datecurrentDate- the current date- Returns:
- the gurantee to apply
-
getAppliedGuaranteeAmount
Description copied from interface:RatePlanServiceReturn amount to be paid as guarantee, applying the guarantee model on the price.- Specified by:
getAppliedGuaranteeAmountin interfaceRatePlanService- Parameters:
guaranteeToApply- object of GuaranteeModelroomRatePrice- the price on which guarantee is to be applied- Returns:
- guarantee amount
-
getGuaranteeAmount
Gets guarantee amount.- Parameters:
amountPercent- the amount percenttotalPrice- the total price- Returns:
- the guarantee amount
-
normalizeGuaranteesDeadlines
protected void normalizeGuaranteesDeadlines(List<GuaranteeModel> guarantees, Date startingDate, Date currentDate) This method normalizes deadlines, setting the relative deadline to the given date if it is before this date. This allows the application of a priority policy, triggered when two or more guarantees clash of the same date. Calculation has been made based on the offset in milliseconds between the date (resolved as per above explanation) and the check in date. To make the algorithm consistent if an absolute deadline is present it is converted into the relative deadline (in milliseconds) then eventually normalized.- Parameters:
guarantees- the guaranteesstartingDate- the starting datecurrentDate- the current date
-
getRatePlanForCode
Description copied from interface:RatePlanServiceReturns the RatePlanModel for a given code- Specified by:
getRatePlanForCodein interfaceRatePlanService- Parameters:
ratePlanCode- the code of the ratePlan to get- Returns:
- the RatePlanModel corresponding to the given code
-
getGuaranteeComparator
Gets guarantee comparator.- Returns:
- guaranteeComparator guarantee comparator
-
setGuaranteeComparator
Sets guarantee comparator.- Parameters:
guaranteeComparator- the guaranteeComparator to set
-
getRatePlanDao
Gets rate plan dao.- Returns:
- ratePlanDao rate plan dao
-
setRatePlanDao
Sets rate plan dao.- Parameters:
ratePlanDao- the ratePlanDao to set
-