This is a helper class for other samples. The sample provides system step-related methods for use by some of the sample classes, particularly the OperationsSample. The methods in this sample class modify and validate workflows.
Note The sample code assumes you created a session and supplied a user name and password with appropriate access privileges. The OperationsHelper constructor initializes local variables to point to its SessionHelper and Logger arguments as follows:
public OperationsHelper(VWSession session, Logger logger) {
m_vwSession = vwSession;
m_logger = logger;
}
The following sections describe the public OperationsHelper class methods.
Retrieve the definition of an operation as follows:
Create default VWQueueDefinition and VWOperationDefinition objects. The VWQueueDefinition object holds the definition of the passed queue, and the VWOperationDefinition object stores the return value.
VWQueueDefinition vwQueueDef = null;
VWOperationDefinition vwOpDef = null;
Retrieve the operation definition from the queue definition with VWQueueDefinition.getOperation() and the passed in operation name, after setting the VWQueueDefinition object with VWQueue.fetchQueueDefinition(). Return the operation definition.
vwQueueDef = theQueue.fetchQueueDefinition();
vwOpDef = vwQueueDef.getOperation(operationName);
// . . . ( code for common messge and error handling ) . . .
return vwOpDef;
Logs VWOperationDefinition object information as follows:
Log the name and description of the passed in operation definition object with the sample Logger.log method.
m_logger.log("\tName: " + vwOpDef.getName());
m_logger.log("\t\tDescription: " + vwOpDef.getDescription());
Print the parameter information of the passed in operation definition with the sample OperationsHelper.printOperationParameters() method.
printOperationParameters(vwOpDef);
Additional code in this method performs common error and message handling.
Log the parameter information of the passed in operation definition as follows:
Initialize an array of VWParameterDefinition objects.
VWParameterDefinition[] vwPD = null;
vwPD = vwOpDef.getParameterDefinitions();
Log the name, datatype, and value of each operation with VWParameterDefinition retrieval ("get") methods.
m_logger.log("\t\tName\t\tData Type\tValue");
for (int i=0;i<vwPD.length;i++){
m_logger.log("\t\t" + vwPD[i].getName() + "\t\t" + VWFieldType.getLocalizedString(vwPD[i].getDataType()) + "\t" + vwPD[i].getValue());
}
Additional code in this method performs common error and message handling.