Class QuoteExpirationTimeUtils
- java.lang.Object
-
- de.hybris.platform.commerceservices.util.QuoteExpirationTimeUtils
-
public final class QuoteExpirationTimeUtils extends java.lang.ObjectUtility class for determining quote expiration time and checking its validity. It also provides methods for getting the configurable offer validity periods.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_OFFER_VALIDITY_PERIOD_IN_DAYSstatic intMIN_OFFER_VALIDITY_PERIOD_IN_DAYS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.DatedetermineExpirationTime(java.util.Date oldExpiryDate, java.util.Date today)Determines the expiration time for a quote by checking if the expiration time that is currently set for the quote is valid or not usingisExpirationTimeValid(Date, Date)method.static intgetDefaultOfferValidityPeriodDays()Gets the configured value for the quote default offer validity period in days or 30 if the property is not found.static java.util.DategetEndOfDay(java.util.Date day)Sets the time part of the provided input date parameter to end of day (23:59:59).static intgetMinOfferValidityPeriodInDays()Gets the configured value for the quote minimum offer validity period in days or 1 if the property is not found.static booleanisExpirationTimeValid(java.util.Date expiryDate, java.util.Date today)Checks if the expiration date provided as input is valid or not.
-
-
-
Field Detail
-
DEFAULT_OFFER_VALIDITY_PERIOD_IN_DAYS
public static final int DEFAULT_OFFER_VALIDITY_PERIOD_IN_DAYS
- See Also:
- Constant Field Values
-
MIN_OFFER_VALIDITY_PERIOD_IN_DAYS
public static final int MIN_OFFER_VALIDITY_PERIOD_IN_DAYS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefaultOfferValidityPeriodDays
public static int getDefaultOfferValidityPeriodDays()
Gets the configured value for the quote default offer validity period in days or 30 if the property is not found.- Returns:
- the quote default offer validity period in days
-
getMinOfferValidityPeriodInDays
public static int getMinOfferValidityPeriodInDays()
Gets the configured value for the quote minimum offer validity period in days or 1 if the property is not found.- Returns:
- the quote minimum offer validity period in days
-
determineExpirationTime
public static java.util.Date determineExpirationTime(java.util.Date oldExpiryDate, java.util.Date today)Determines the expiration time for a quote by checking if the expiration time that is currently set for the quote is valid or not usingisExpirationTimeValid(Date, Date)method. If it is valid, it returns the expiration time as is, otherwise it returns an expiration time set to current date with normalized time plus the quote default offer validity period in days and with the time part set to end day.- Parameters:
oldExpiryDate- the expiration date that is currently set for the quotetoday- the current date with normalized time- Returns:
- the determined expiration time for the quote
-
getEndOfDay
public static java.util.Date getEndOfDay(java.util.Date day)
Sets the time part of the provided input date parameter to end of day (23:59:59).- Parameters:
day- the date for which the time part to be set to end of day- Returns:
- the updated date object with the time part set to end of day
-
isExpirationTimeValid
public static boolean isExpirationTimeValid(java.util.Date expiryDate, java.util.Date today)Checks if the expiration date provided as input is valid or not. An expiration date is not valid if it is before the current date with normalized time plus the quote minimum offer validity period in days or it is not set. Otherwise, the expiration date is valid.- Parameters:
expiryDate- the expiration date to checktoday- the current date with normalized time- Returns:
- true if the expiration date is valid, otherwise false
-
-