Class OutboundServiceCsvUtils

java.lang.Object
com.hybris.datahub.core.util.OutboundServiceCsvUtils

public class OutboundServiceCsvUtils extends Object
This class provides utility methods for converting data into CSV format that can be sent to a running Data Hub through the DataHubOutboundService
  • Constructor Details

    • OutboundServiceCsvUtils

      public OutboundServiceCsvUtils()
  • Method Details

    • setDatePattern

      public void setDatePattern(String datePattern)
      The date pattern to use when converting Date objects to Strings in UTC timezone This value is read from a property 'datahubadapter.datahuboutbound.date.pattern'
      Parameters:
      datePattern - the date pattern
    • convertObjectToCsv

      public String[] convertObjectToCsv(Object obj)
      Converts a single Object into CSV formatted data.

      The Object's property names are appended to the CSV header. The string value of the object's properties will be appended to the CSV body.

      Parameters:
      obj - the object to convert to CSV format
      Returns:
      an array of CSV data
    • convertMapToCsv

      public String[] convertMapToCsv(Map<String,Object> map)
      Converts a single Map into CSV formatted data.

      The Map keys are used as values in the CSV header. The string value of Map.Entry values will be used in the CSV body.

      Parameters:
      map - the map to convert into CSV formatted data
      Returns:
      an array of CSV data
    • convertListToCsv

      public String[] convertListToCsv(List<Map<String,Object>> objList)
      Converts a List of Maps into CSV formatted data CSV header is populated using the keys from the first Map in the List

      Each Map in the List should contain the same keys

      Parameters:
      objList - the List of Maps to convert into CSV formatted data
      Returns:
      an array of CSV data
    • transmissionSafe

      public Map<String,Object> transmissionSafe(Map<String,Object> original)
      Converts values of a map to be safe for a data transmission meaning the data will be consistently reproduced at both ends of the communication.
      Parameters:
      original - a map to make transmission safe.
      Returns:
      a map safe to transmit.
    • convertObjectToMap

      protected Map<String,Object> convertObjectToMap(Object obj)
    • toCsvValue

      protected String toCsvValue(Object obj)