Package com.hybris.datahub.core.util
Class OutboundServiceCsvUtils
- java.lang.Object
-
- com.hybris.datahub.core.util.OutboundServiceCsvUtils
-
public class OutboundServiceCsvUtils extends java.lang.ObjectThis class provides utility methods for converting data into CSV format that can be sent to a running Data Hub through the DataHubOutboundService
-
-
Constructor Summary
Constructors Constructor Description OutboundServiceCsvUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]convertListToCsv(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> objList)Converts aListof Maps into CSV formatted data CSV header is populated using the keys from the first Map in the Listjava.lang.String[]convertMapToCsv(java.util.Map<java.lang.String,java.lang.Object> map)Converts a singleMapinto CSV formatted data.java.lang.String[]convertObjectToCsv(java.lang.Object obj)Converts a singleObjectinto CSV formatted data.protected java.util.Map<java.lang.String,java.lang.Object>convertObjectToMap(java.lang.Object obj)voidsetDatePattern(java.lang.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'protected java.lang.StringtoCsvValue(java.lang.Object obj)java.util.Map<java.lang.String,java.lang.Object>transmissionSafe(java.util.Map<java.lang.String,java.lang.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.
-
-
-
Method Detail
-
setDatePattern
public void setDatePattern(java.lang.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 java.lang.String[] convertObjectToCsv(java.lang.Object obj)
Converts a singleObjectinto 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 java.lang.String[] convertMapToCsv(java.util.Map<java.lang.String,java.lang.Object> map)
Converts a singleMapinto CSV formatted data.The
Mapkeys are used as values in the CSV header. The string value ofMap.Entryvalues 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 java.lang.String[] convertListToCsv(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> objList)
Converts aListof Maps into CSV formatted data CSV header is populated using the keys from the first Map in the ListEach 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 java.util.Map<java.lang.String,java.lang.Object> transmissionSafe(java.util.Map<java.lang.String,java.lang.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 java.util.Map<java.lang.String,java.lang.Object> convertObjectToMap(java.lang.Object obj)
-
toCsvValue
protected java.lang.String toCsvValue(java.lang.Object obj)
-
-