Send a message. The caller must be a potential owner
of the activity that receives the message, or an administrator of the process
instance.
if ( result.size() > 0 )
{
result.first();
VTID vtid = (VTID)result.getOID(1);
ATID atid = (ATID)result.getOID(2);
ActivityServiceTemplateData activity =
process.getActivityServiceTemplate(vtid,atid);
// create a message for the service to be called
ClientObjectWrapper message =
process.createMessage(vtid,atid,activity.getInputMessageTypeName());
DataObject myMessage = null;
if ( message.getObject()!= null && message.getObject() instanceof DataObject )
{
myMessage = (DataObject)message.getObject();
//set the strings in the message, for example, chocolate is to be ordered
myMessage.setString("Order", "chocolate");
}
// send the message to the waiting activity
process.sendMessage(vtid, atid, message);
}
This action sends the specified message
to the waiting activity service and passes some order data.
You can
also specify the process instance ID to ensure that the message is sent to
the specified process instance. If the process instance ID is not specified,
the message is sent to the activity service, and the process instance that
is identified by the correlation values in the message. If the process instance
ID is specified, the process instance that is found using the correlation
values is checked to ensure that it has the specified process instance ID.