This is a helper class for other samples. The sample provides reusable getMilestoneDefinitions() and printMilestoneInfo() milestone-related methods for use by some of the sample classes, particularly the MileStoneHelper sample.
Note The sample code assumes you created a session and supplied a user name and password with appropriate access privileges. The MileStoneHelper constructor initializes local variables to point to its VWSession and Logger arguments as follows:
public MilestoneHelper(VWSession session, Logger logger) {
m_vwSession = vwSession;
m_logger = logger;
}
The following sections describe the public MileStoneHelper class methods.
Milestone definitions are a part of the process information of a work object, and a queue element represents the workflow object in a queue. Although this queue element provides access to a fields in a queue without the expense of retrieving the work object, the API must use the original work object to obtain process information. The program fetches the passed in queue element's work object with VWQueueElement.fetchWorkObject(). The program gets process information from the work object with VWWorkObject.fetchProcess().
VWWorkObject workObj = vwQueueElement.fetchWorkObject(false, false);
VWProcess proc = workObj.fetchProcess();
The VWProcess.getMilestoneDefinitions() method retrieves the milestone definition information as an array of VWMileStoneDefinition objects. This object array is the value the method returns.
msd = proc.getMilestoneDefinitions();
The milestone definitions obtained through the getMilestoneDefinitions method, in this class, contain milestone descriptions as a milestone name (String type), message (String type), and level (integer type). The program displays these values for each mileStone definition with logger.log(String).
// Iterate through all the milestones defined for the
workflow
// and report each name, message, and level.
for (int i=0;i<msd.length;i++)
{
m_logger.log("\t\t" + msd[i].getName() + "\t\t" + msd[i].getMessage()
+ "\t" + String.valueOf(msd[i].getLevel()));
}