SystemStepSample

This stand-alone sample demonstrates how to create a workflow, set some properties, add a system step, and launch the workflow. Run the sample by entering a command similar to the following:

    java SystemStepSample username password server_name:port_number/connectionPoint_name 
        queue_name output_filename

Refer to the comments in the sample source for further information. The samples are located on the P8 Documentation CD or ESD image in:

   ecm_help\developer_help\process_java_api\Developer Files\samples\api

See also Running the API Samples.

Methods

General descriptions of the SystemStepSample methods follow:

main()

The main method uses common techniques for validating and defaulting argument values. The default values for the log output file are SystemStepSample.out, and the first queue name in the system list of queue names. Main() constructs and passes VWSession and sample Logger class objects to the constructor. Main() handles the login and logoff for the session with the login() and logoff() methods of the sample SessionHelper class, and provides workflow logging with an instance of the sample Logger class.

SystemStepSample()

The SystemStepSample constructor creates a new VWWorkflowDefinition object and uses VWWorkflowDefinition.setSubject, VWWorkflowDefinition.setDescription, and VWWorkflowDefinition.setName to assign the new properties. Workflow definition fields are added using VWWorkflowDefinition.createFieldUsingString. VWWorkflowDefinition.getMainMap gets a VWMapDefinition object and VWMapDefinition.getStartStep returns the VWMapNode object for the new launch step. A new compound step is then added using the sample SystemStepHelper.addCompoundStep. The VWCompoundStepDefinition returned by SystemStepHelper.addCompoundStep is used to add an assignment instruction (VWCompoundStepDefinition.createAssignInstruction) and a timer instruction (VWCompoundStepDefinition.createBeginTimerInstruction). VWMapNode.createRoute (with VWMapNode.getStepId as an argument) is used to create a route from the preceding launch step to the new step. The sample SystemStepHelper.addStep is then used to add more new steps (VWMapNode.createRoute creates new routes from step to step). SystemStepHelper.addCompoundStep then adds another compound step to terminate the timer (using VWCompoundStepDefinition.createEndTimerInstruction), the new step again linked using VWMapNode.createRoute. The sample SystemStepHelper.validate then validates the new workflow definition. The workflow definition (SystemStepSample.pep) is then written to file (using VWWorkflowDefinition.writeToFile), transferred (using VWSession.transfer), and the returned VWTransferResult object logged using VWTransferResult.getVersion and the sample Logger.log. The workflow is then launched (using VWSession.createWorkflow), and the VWStepElement returned is used to set a comment for the launch step (VWStepElement.setComment) and complete the step (VWStepElement.doDispatch).