Get Value To Station Json Converter
Description
The GetValueToStationJsonConverter utility converts a list of Get Table and Get Value output JSON strings into an DocEdgeStationJson object and writes the result to a specified file. This utility is designed to work seamlessly within Process Studio for efficient data transformation.
Example:
Here is a sample code to use the GetValueToStationJsonConverter method in a user-defined Java class in Process Studio
import com.automationedge.ps.docedge.utils.*;
try {
// Define the input JSON strings
String getValuejson = get(Fields.In, "GetValueOutputJSON").getString(r);
String getTableJson = get(Fields.In, "GetTableOutputValue").getString(r);
// Define the output file path
String updateFileOutput = get(Fields.In, "ouputDEJson").getString(r);
// Add the input JSON strings to a list
List<String> inputJson = new ArrayList<>();
inputJson.add(getValuejson);
inputJson.add(getTableJson);
ObjectMapper objectMapper = new JsonMapper();
// Call the GetValueToStationJsonConverter method
OutputJson outputJson = StationUtils.GetValueToStationJsonConverter(
inputJson,
get(Fields.In, "processId").getString(r),
get(Fields.In, "requestId").getString(r),
get(Fields.In, "tenantId").getString(r),
get(Fields.In, "fileName").getString(r),
get(Fields.In, "reqFileRef").getString(r),
get(Fields.In, "fileCode").getString(r),
get(Fields.In, "tableName").getString(r)
);
// Write the output JSON to the specified file
objectMapper.writeValue(new File(updateFileOutput), outputJson);
} catch (Exception e) {
throw new RuntimeException("Error writing output JSON to file: " + e.getMessage(), e);
}
Method Input / Output Parameters
| No. | Field Name | Data Type | Description |
|---|---|---|---|
| 1 | getValuejson | String | JSON string from GetValueOutputJSON |
| 2 | getTableJson | String | JSON string from GetTableOutputValue |
| 3 | updateFileOutput | String | Output file path |
| 4 | processId | String | Process ID |
| 5 | requestId | String | Request ID |
| 6 | tenantId | String | Tenant ID |
| 7 | fileName | String | File name |
| 8 | reqFileRef | String | Request file reference |
| 9 | fileCode | String | File code |
| 10 | tableName | String | Table name |