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();
}
tracingTag = scopesByTracingTag[scopesByTracingTag.length-1];
}
HumanActivity humanActivity = ((HumanActivity)definition.getActivity(tracingTag));
if(!instance.isRunning(humanActivity.getTracingTag()) && !humanActivity.isNotificationWorkitem()){
throw new UEngineException("Illegal completion for workitem [" + humanActivity + ":"+ humanActivity.getStatus(instance) +"]: Already closed or illegal status.");
}
if(saveOnly){
humanActivity.saveWorkItem(instance, payload);
}else{
try{
humanActivity.fireReceived(instance, payload);
}catch(Exception e){
humanActivity.fireFault(instance, e);
throw new UEngineException(e.getMessage(), null, new UEngineException(e.getMessage(), e), instance, humanActivity);
}
}
/*String message = humanActivity.getMessage();