Class TransportOfferingUtils

java.lang.Object
de.hybris.platform.travelfacades.util.TransportOfferingUtils

public class TransportOfferingUtils extends Object
This class contains some reusable methods required for Transport Offering population
  • Method Details

    • getDurationMap

      public static Map<String,Integer> getDurationMap(Long duration)
      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

      public static Long getDuration(Map<String,Integer> durationMap)
      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 1
      transportOfferings2 - 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