Workflow API
The WorkflowManager is the component which is mostly used in a workflow application. The WorkflowManger allows you to process, find and remove workitems (ItemCollections) using a Workflow Manager implementation.
To process a workitem you can simply call the process() method of the WorkflowManager interface.
ItemCollection workitem=new ItemCollection();
// set some data
//....
// set model data
workitem.replaceItemValue("$processid", 100);
workitem.replaceItemValue("$activityid", 10);
WorkflowManager wfm;
// process workitem
workitem=wfm.processWorkItem(workitem);You can process any ItemCollection with any kind of data. To define which process state the workitem has and which activity should be processed by the WorkflowManager you need to specify the Items "$processid" and "$activityid". These Items select a process entiy and a Activity Entity in the current workflow Model. If the Model Entry selected by the workitem did not exist in the Workflow Model the WorkflowManager throws an InvalidWorkitemException.
After the workitem was processed by the WorkflowManager you will get a new instance of your workitem containing all additional workflow Informations controlled by the WorkflowManager
//....
workitem=wfm.processWorkItem(workitem);
String unqiueID=workitem.getItemValueString("$unqiueid");
String status=worktiem.getItemValueString("txtworkflowstatus");The items returned in the itemCollection from the WorkflowManager depending on the implementation class.
One of the mostly used items is the "$uniqueid" which identifies the workitem inside a database system. The uniqueid is managed by the WorkflowManager implementation and can be used to search a workitem by the WorkflowManager:
workitem=wfm.getWorkItem(uniqueid);
If you want to receive a list of workitems you can call the Method getWorkList().
workitem=wfm.getWorkList(null);
This method returns a list of workitems for the current user if not specified (null) or for a specific user if provided.
A workitem is typically managed by a WorkflowManger for the complete life cycle. To remove a workitem from the WorkflowManager underlying database you can call the removeWorkitem method:
wfm.removeWorkItem(workitem);
This method removes an instance of an workitem form the WorkflowMangaement System.