SystemStepHelper (helper class)

This is a helper class for other samples. This sample provides system step-related methods to some of the sample classes, particularly the SystemStepSample. The methods in this sample class assist with adding steps to workflows and validating workflows.

Note The sample code assumes you created a session and supplied a user name and password with appropriate access privileges. The SystemStepHelper constructor initializes local variables to point to the VWSession and Logger arguments as follows:

public SystemStepHelper(VWSession session, Logger logger) {

m_vwSession = vwSession;
m_logger = logger;

}

Methods

The following sections describe the public SystemStepHelper class methods.

VWCompoundStepDefinition addCompoundStep(VWMapDefinition mapDef, String stepName)

Create a VWCompoundStepDefinition object as a compound step definition with VWMapDefinition.createCompoundStep() and the passed in stepname. Get the ID of the compound step definition with VWCompoundStepDefinition.getStepId().

newStepDef = mapDef.createCompoundStep(stepName);
nStepId = newStepDef.getStepId();

Set the step description and map location with the step id and VWCompoundStepDefinition storage ("set") methods.

newStepDef.setDescription("This is the description for system step" + nStepId + ".");
newStepDef.setLocation(new java.awt.Point(nStepId * 100, 150));

Additional code in this method performs common message and error handling.

VWStepDefinition addStep(VWMapDefinition mapDef, String stepName, String queueName)

Create a default step with the passed in name and get the new step Id with VWMapDefinition methods.

newStepDef = mapDef.createStep(stepName);
nStepId = newStepDef.getStepId();

Create integer and string parameters for the new step definition with the VWStepDefinition.createParameter() method.

newStepDef.createParameter( "Field1_Integer", VWModeType.MODE_TYPE_IN, "99", VWFieldType.FIELD_TYPE_INT, false );
newStepDef.createParameter( "Field2_String", VWModeType.MODE_TYPE_OUT, "Field2_String", VWFieldType.FIELD_TYPE_STRING, true );

Assign the new step the passed in queue name with VWStepDefinition.newStepDef.setQueueName().

newStepDef.setQueueName(queueName);

Store the step description and map location in the new VWStepDefinition object with its storage ("get") methods. The map location determines where it will graphically display in Designer

newStepDef.setDescription("This is the description for step" + nStepId + ".");
newStepDef.setLocation(new java.awt.Point(nStepId * 100, 150));

Additional code in this method performs common message and error handling.

boolean validate(VWWorkflowDefinition workflowDef, VWSession vwSession)

Initialize an array of VWValidationError objects and a variable to hold the return value for the method.

VWValidationError[] validationErrors = null;
boolean bSuccess = false;

Validate the passed in workflow by setting the VWValidationError array with the first argument's VWWorkflowDefinition.validate() method; then test the array.

validationErrors = workflowDef.validate(vwSession, false);
if (validationErrors != null){

m_logger.log("\nThe following validation errors occurred: ", validationErrors);

} else {

m_logger.log("\nValidation was successful.\n");
bSuccess = true;

}

Additional code in this method performs common message and error handling.