This stand-alone sample demonstrates how to create a workflow, set some properties, add a system step, and start the workflow.
Run the sample by entering a command similar to the following example:
java SystemStepSample username password server_name:port_number/connectionPoint_name
queue_name output_filename
For more information, see the comments in the sample source. The samples are supplied in the Developer samples section of the IBM® FileNet® P8 Platform publication library.
See also Running the API Samples.
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. It also 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 by 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 by 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 (by using VWCompoundStepDefinition.createEndTimerInstruction), and the new step is again linked by using VWMapNode.createRoute. The sample SystemStepHelper.validate then validates the new workflow definition. The workflow definition (SystemStepSample.pep) is then written to file (by using VWWorkflowDefinition.writeToFile), transferred (by using VWSession.transfer), and the returned VWTransferResult object is logged by using VWTransferResult.getVersion and the sample Logger.log. The workflow is then started (by 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).