for(int i=0; i<scopesByTracingTag.length-1; i++){
String scope = scopesByTracingTag[i];
SubProcessActivity spAct = (SubProcessActivity)definition.getActivity(scope);
List spInstanceIds = spAct.getSubprocessIds(instance);
if(spInstanceIds.size() == 0){
throw new UEngineException("Activity in the subprocess ["+ absoluteTracingTag +"] cannot be found.");
}
String spInstanceId = (String)spInstanceIds.get(0);
instance = getProcessInstance(spInstanceId);
definition = instance.getProcessDefinition();
}
}
ActivityInstanceContext firstRunningActivityInstanceCtx = instance.getCurrentRunningActivity();
HumanActivity humanActivity = (HumanActivity)firstRunningActivityInstanceCtx.getActivity();
//HumanActivity humanActivity = (HumanActivity)initiatorHumanActivityReference.getActivity();
if(humanActivity==null)
throw new UEngineException("Inconsistent status. Couldn't find the initiator HumanActivity.");
String message = humanActivity.getMessage();
//add task id into payload
String[] taskIds = humanActivity.getTaskIds(instance);
if(!(instance instanceof DefaultProcessInstance) && (taskIds==null || taskIds.length<1)) throw new UEngineException("The first human work didn't start properly.");
//TODO: kind of wierd code
if(resultPayload!=null && taskIds!=null)
resultPayload.setExtendedValue(
new KeyedParameter(HumanActivity.PAYLOADKEY_TASKID, taskIds[0])