/*
* For demonstration purposes print out the record ID values of the
* target list for the task step.
*/
for (int i = 0; i < records.length; i++) {
Record record = records[i];
System.out.println(record.toString());
}
Set parametersEntries = parameters.entrySet();
for (Iterator itr = parametersEntries.iterator(); itr.hasNext(); ) {
Map.Entry entry = (Map.Entry)itr.next();
WFVariable variable = (WFVariable)entry.getValue();
String name = variable.getName();
if (WFVariable.Type.WFSTEPINSTANCEVARIABLE.equals(variable.getType())) {
WFStepInfo stepInfo = (WFStepInfo)variable.getValue();
System.out.println("Parameter: '" + name + "' Value:" + stepInfo);
}
else {
System.out.println("Parameter: '" + name + "' was not a WFStepInfo. Variable: " + variable);
}
}
/*
* Using the set of target records create a WFVariable that contains
* every other record. This is to illustrate the process of creating
* a return parameter that can then be assigned to a workflow variable
* within the workflow (configured as part of the Custom Task step
* definition).
*
* We will only return a single return parameter but it is possible
* to return multiple parameters.
*/
// We need a Collection that we can put the selected record IDs into.
Collection resultRecordIds = new ArrayList();
// Add every other record to the collection.
for (int i = 0; i < records.length; i++) {
if (i % 2 == 0) {
Record record = records[i];
resultRecordIds.add(record.getId());
}
}
/*
* A return parameter is a WFVariable.