if(!instance.isRunning("")
&& !((HumanActivity)instance.getProcessDefinition().getActivity(tracingTag)).isNotificationWorkitem()
)
instance.execute();
ProcessDefinition definition = instance.getProcessDefinition();
boolean isInitiationInSubprocess = false;
String absoluteTracingTag = tracingTag;
if(tracingTag.indexOf("@")>0){
isInitiationInSubprocess = true;
String[] scopesByTracingTag = tracingTag.split("@");
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.");
}