
Analyzing the results of a process
A process can expose web services operations that are modeled as Web Services Description Language (WSDL) one-way or request-response operations. The results of long-running processes with one-way interfaces cannot be retrieved using the getOutputMessage method, because the process has no output. However, you can query the contents of variables, instead.
About this task
Procedure
Analyze the results of the process, for example, check
the order number.
FilterOptions fo = new FilterOptions();
fo.setSelectedAttributes("PIID");
fo.setQueryCondition("NAME='CustomerOrder' AND STATE=STATE_FINISHED");
EntityResultSet ers = process.queryEntities("PROCESS_INSTANCE", fo, null, null);
if (ers.getEntities().size() > 0)
{
Entity processEntity = (Entity) ers.getEntities().get(0);
PIID piid = (PIID) processEntity.getAttributeValue("PIID");
ClientObjectWrapper output = process.getOutputMessage(piid);
DataObject myOutput = null;
if ( output.getObject() != null && output.getObject() instanceof DataObject )
{
myOutput = (DataObject)output.getObject();
int order = myOutput.getInt("OrderNo");
}
}