How to Get Input at Run Time

BusinessWorks framework passes the input to the processContext parameter in the public N execute(N input, ProcessContext<N> processContext) method, which can be used to retrieve the actual value of a field.

You can find this method in the ActivityName_ActivityTypeActivity.java file from the runtime bundle.

In addition to this method, BusinessWorks Plug-in Development Kit provides the following code snippet to get the runtime input:

public String getInputParameterStringValueByName(final N inputData, final ProcessingContext<N> processingContext, final String parameterName) {
     Model<N> model = processingContext.getMutableContext().getModel();
     N parameter = model.getFirstChildElementByName(inputData, null, parameterName);
     if (parameter == null) {
         return "";
     }
     return model.getStringValue(parameter);
}

where

  • input is the activity input data.
  • processingContext is the XML processing context.
  • parameter value is the parameter name that you want to get the value for.

The following example shows how to get the input:

final String ACTIVITY_INPUT_FILE_NAME = "FileName";
String fileName = getInputParameterStringValueByName(input,  processContext.getXMLProcessingContext(), ACTIVITY_INPUT_FILE_NAME);