int records_per_file = 1000;
String field_separator = ":", array_element_separator = ";";
int field_index = 2, array_index = 2;
String header_record_identifier = "MSH", key_record_identifier = "PID";
DataElements dataElements = context.getDataElements();
if ( dataElements.contains(HEADER_DE_NAME, DataType.STRING) ) {
header_record_identifier = dataElements.get(HEADER_DE_NAME, DataType.STRING).getValue();
}
if ( dataElements.contains(KEY_DE_NAME, DataType.STRING) ) {
key_record_identifier = dataElements.get(KEY_DE_NAME, DataType.STRING).getValue();
}
if ( dataElements.contains(FIELD_SEPARATOR, DataType.STRING) ) {
field_separator = dataElements.get(FIELD_SEPARATOR, DataType.STRING).getValue();
}
if ( dataElements.contains(ARRAY_ELEMENT_SEPARATOR, DataType.STRING) ) {
array_element_separator = dataElements.get(ARRAY_ELEMENT_SEPARATOR, DataType.STRING).getValue();
}
if ( dataElements.contains(FIELD_INDEX, DataType.INTEGER) ) {
// this is 0-based index
field_index = dataElements.get(FIELD_INDEX, DataType.INTEGER).getValue();
}
if ( dataElements.contains(ARRAY_INDEX, DataType.INTEGER) ) {
// this is 0-base index
array_index = dataElements.get(ARRAY_INDEX, DataType.INTEGER).getValue();
}
if ( dataElements.contains(RECORDS_PER_FILE_DE_NAME, DataType.INTEGER) ) {
records_per_file = dataElements.get(RECORDS_PER_FILE_DE_NAME, DataType.INTEGER).getValue();
}
if ( header_record_identifier.isEmpty() ) {
throw new PipelinePluginException("No segment header was specified. Not enough information to perform splitting.");
}