Class ModelJsonCsvTransformer
java.lang.Object
com.onenetwork.platform.integ.msg.ModelJsonCsvTransformer
- All Implemented Interfaces:
CsvTransformer
,ModelCsvTransformer
,JsonTransformer
,ModelJsonTransformer
,Transformer
public class ModelJsonCsvTransformer extends java.lang.Object implements ModelJsonTransformer, ModelCsvTransformer
Base class for all Model based CsvTransformers, and Model based Json transformer
-
Constructor Summary
Constructors Constructor Description ModelJsonCsvTransformer()
-
Method Summary
Modifier and Type Method Description void
transform(Model model, CsvRow row, CsvTransformContext context)
This method is used to transform a model to a csv row.void
transform(Model model, org.json.JSONObject json, JsonTransformerContext context)
Converts a model to json.void
transform(CsvRow row, CsvTransformContext context)
Transforms values within a mutable CsvRow.void
transform(org.json.JSONObject json, JsonTransformerContext context)
Transforms values within a mutable JSONObject.
-
Constructor Details
-
ModelJsonCsvTransformer
public ModelJsonCsvTransformer()
-
-
Method Details
-
transform
public void transform(Model model, org.json.JSONObject json, JsonTransformerContext context) throws JsonTransformExceptionDescription copied from interface:ModelJsonTransformer
Converts a model to json. This method is invoked inJSONService.jsonToModel(JSONObject, Class, String, String, com.onenetwork.platform.common.usercontext.PlatformUserProfile...)
- Specified by:
transform
in interfaceModelJsonTransformer
- Parameters:
model
- model to be transformedjson
- default JSON representation - can be further modified by the transformcontext
- additional context information relevant to the current transform- Throws:
JsonTransformException
- thrown to abort the transform
-
transform
public void transform(org.json.JSONObject json, JsonTransformerContext context) throws JsonTransformExceptionDescription copied from interface:JsonTransformer
Transforms values within a mutable JSONObject. Typically used in the context of converting a JSONObject into a Model viaJSONService.jsonToModel(JSONObject, Class, String, String, com.onenetwork.platform.common.usercontext.PlatformUserProfile...)
.- Specified by:
transform
in interfaceJsonTransformer
- Parameters:
json
- json to be transformedcontext
- provides contextual information around the current transformation- Throws:
JsonTransformException
-
transform
public void transform(Model model, CsvRow row, CsvTransformContext context) throws CsvTransformExceptionDescription copied from interface:ModelCsvTransformer
This method is used to transform a model to a csv row. This is invoked from the Model result handler, when converting each model to csv- Specified by:
transform
in interfaceModelCsvTransformer
- Parameters:
model
- model being transformedrow
- default CSV representation of the model - can be further modified by the transformcontext
- additional context information relevant to the current transform- Throws:
CsvTransformException
- thrown to abort the transform
-
transform
Description copied from interface:CsvTransformer
Transforms values within a mutable CsvRow. In some situations there might be two columns with the same name in a single CSV, for example "State" in ShipmentHeader and ShipmentLine. In situations like these, fields with a conflict will be prefixed with their level name, "ShipmentHeader.State" and "ShipmentLine.State". Fields without such a conflict will be listed without this prefix, for example "ShipmentNumber".- Specified by:
transform
in interfaceCsvTransformer
- Parameters:
row
- row to be transformed - use theCsvRow.set(String, String)
method to change values on this rowcontext
- provides contextual information around the current CSV Transformation- Throws:
CsvTransformException
-