i have done a dummy job in which iam reading data from a dataset and pass it to a java transformer. In the java transformer iam calling a java class file which will change the varchar fields from lowercase to uppercase and then send the data to output link.the output link of the java transformer is again connected to a dataset. The code is working fine for the sample job.
but my requirement is to do some calculation on the input data and create a new column which i have to pass to the output link.
present the code that i have is
Code: Select all
import com.ascentialsoftware.jds.Row;
import com.ascentialsoftware.jds.Stage;
public class HashCheck extends Stage {
public int process() {
Row inputRow = readRow();
if (inputRow == null)
{
return OUTPUT_STATUS_END_OF_DATA;
}
boolean reject = false;
int columnCount = inputRow.getColumnCount();
Row outputRow = createOutputRow();
for (int columnNumber = 0; columnNumber < columnCount; columnNumber++)
{
String value = inputRow.getValueAsString(columnNumber);
if (!(value == null))
{
outputRow.setValueAsString(columnNumber, value.toUpperCase());
}
else{
outputRow.setValueAsString(columnNumber, value);
}
if (reject)
{
rejectRow(outputRow);
}
else
{
writeRow(outputRow);
}
return OUTPUT_STATUS_READY;
}
}
}
thanks