Class TransportOfferingUtils
java.lang.Object
de.hybris.platform.travelfacades.util.TransportOfferingUtils
This class contains some reusable methods required for Transport Offering population
-
Method Summary
Modifier and TypeMethodDescriptioncalculateJourneyDuration(List<TransportOfferingData> transportOfferings) Method calculates duration of the whole journey by summing durations of all flights and breaks between arrivals and departures of connected flightsstatic booleancompareTransportOfferings(List<TransportOfferingData> transportOfferings1, List<TransportOfferingData> transportOfferings2) Compares 2 lists of Transport Offerings to see if they have the same elementsstatic StringgetDestinationFromTransportOfferings(List<TransportOfferingModel> transportOfferingModelList) Gets the final destination from a list of transport offerings.static LonggetDuration(Map<String, Integer> durationMap) Calculates duration from duration mapgetDurationMap(Long duration) Converts the duration of transport offering from Long to a format required by viewstatic DategetInitialDepartureDateFromTransportOfferings(List<TransportOfferingModel> transportOfferingModelList) Gets the origin from a list of transport offerings.static StringgetOriginFromTransportOfferings(List<TransportOfferingModel> transportOfferingModelList) Gets the origin from a list of transport offerings.
-
Method Details
-
getDurationMap
Converts the duration of transport offering from Long to a format required by view- Parameters:
duration- - duration of the transport offering in Long- Returns:
- duration in a view-friendly format
-
calculateJourneyDuration
public static Map<String,Integer> calculateJourneyDuration(List<TransportOfferingData> transportOfferings) Method calculates duration of the whole journey by summing durations of all flights and breaks between arrivals and departures of connected flights- Parameters:
transportOfferings- - list of transport offerings creating the whole leg of the journey- Returns:
- duration of the journey
-
getDuration
Calculates duration from duration map- Parameters:
durationMap- the duration map- Returns:
- Long value of duration map
-
compareTransportOfferings
public static boolean compareTransportOfferings(List<TransportOfferingData> transportOfferings1, List<TransportOfferingData> transportOfferings2) Compares 2 lists of Transport Offerings to see if they have the same elements- Parameters:
transportOfferings1- the transport offerings 1transportOfferings2- the transport offerings 2- Returns:
- true if lists have the same elements
-
getOriginFromTransportOfferings
public static String getOriginFromTransportOfferings(List<TransportOfferingModel> transportOfferingModelList) Gets the origin from a list of transport offerings.- Parameters:
transportOfferingModelList- the transport offering model list- Returns:
- the origin from a list of transport offerings
-
getDestinationFromTransportOfferings
public static String getDestinationFromTransportOfferings(List<TransportOfferingModel> transportOfferingModelList) Gets the final destination from a list of transport offerings.- Parameters:
transportOfferingModelList- the transport offering model list- Returns:
- the destination from transport offerings
-
getInitialDepartureDateFromTransportOfferings
public static Date getInitialDepartureDateFromTransportOfferings(List<TransportOfferingModel> transportOfferingModelList) Gets the origin from a list of transport offerings.- Parameters:
transportOfferingModelList- the transport offering model list- Returns:
- the origin from a list of transport offerings
-