This example code shows the method within the WorkItemExample that takes a starting point activity object as a parameter and will create a work item for this process flow starting point. The code checks to determine if the work item name is editable for the starting point and constructs a date-time stamped name for the work item.
public void createAndSendWorkItem(ActivityVO startingActivity)
throws WorkItemException
{
Date now = new Date();
String useWorkItemName = null;
// starting point activities can be defined such
// that the default work item name
// cannot be overridden so check for that here
if (activity.getWorkitemNameEditableInd().intValue() == 1)
{
if ( workItemName_ == null )
useWorkItemName = activity.getName()
+ " - " + now.toLocaleString();
}
else
useWorkItemName = workItemName_;
}
else
{
// otherwise use the default work item name
useWorkItemName =
startingActivity.getWorkitemNameDefault();
}
String vargs[] = { useWorkItemName };
System.out.println ( getMessage("workitem.create",vargs) );
// System.out.println ( "create:" + useWorkItemName );
// create the work item
WorkItemVersionExtendedVO version =
workItemFacade_.create WorkItem(
this.getSessionProfile(),activity,useWorkItemName, null);
...
}