public void actionPerformed(ActionEvent e) {
//get/validate inputs:
Map inputs = this.pnlTask.getValues();
TaskDef taskDef = task.getTaskDef();
ParameterDef [] inputDefs = taskDef.getInputsArray();
for (int i=0; i<inputDefs.length; i++) {
String paramName = inputDefs[i].getName();
if (inputDefs[i].isRequired() && inputs.get(paramName) == null) {
error("Required parameter not entered: " + paramName);
return;
}
}
Map outputs = null;
//execute:
try {
outputs = task.execute(inputs);
}
catch(Exception ex) {
ex.printStackTrace();
return;
}
//display outputs:
ParameterDef [] outputDefs = taskDef.getOutputsArray();
for (int i=0; i<outputDefs.length; i++) {
String name = outputDefs[i].getName();
Object value = outputs.get(name);
System.out.println(name + " = " + value);
}