Transition Join node
provajbpm Oct 23, 2008 9:25 AMHi,
i've a little problem with join node during the step from my join node to the next node.
In particular if i have 3 transitions (ex. tr1, tr2, tr3) but only the last one leave the join node, the others 2 are stopped on join node, so when i finished my flow i can see the "end state" on the end node and on the join node.
Are these two transitions stored in the database or create a problem of memory and performance ?
This is an image that shows my flow:
http://www.flickr.com/photos/31362199@N03/2966198345/
This is the code that forwards the flow:
public Step[] forwardWF(User user, Step step, Long idWF) {
JbpmContext jbpmContext = null;
JbpmConfiguration jbpmConfiguration = null;
ProcessInstance processInstance = null;
Step[] steps = null;
try {
jbpmConfiguration = JbpmConfiguration.getInstance("WEB-INF/jbpm.cfg.xml");
jbpmContext = jbpmConfiguration.createJbpmContext();
processInstance = jbpmContext.getProcessInstance(idWF.longValue());
if (!processInstance.hasEnded()){
Token token = processInstance.getRootToken();
TaskMgmtSession taskSession = jbpmContext.getTaskMgmtSession();
List listaTask = taskSession.findTaskInstancesByProcessInstance(processInstance);
Field[] fields = step.getFields();
boolean trovato = false;
for (int i = 0; i < listaTask.size()&&!trovato; i++) {
TaskInstance ti = (TaskInstance)listaTask.get(i);
if(ti.getId()==Long.parseLong(step.getStepID())){
for (int j = 0; j < fields.length ; j++) {
ti.setVariable(fields[j].getId(), fields[j].getValue());
}
ti.start("utentegenerico");
ti.end();
trovato=true;
}
}
jbpmContext.save(processInstance);
token = processInstance.getRootToken();
listaTask = taskSession.findTaskInstancesByProcessInstance(processInstance);
if(listaTask!=null&& listaTask.size()>0){
steps = new Step[listaTask.size()];
for(int i=0; i<steps.length;i++){
TaskInstance ti = (TaskInstance)listaTask.get(i);
Step st = new Step();
st.setStepID(""+ti.getId());
st.setLocked(false);
st.setDescrizioneStep(ti.getName());
st.setFields(getVariables(ti));
steps=st;
}
}else{
log.info("non ci sono più task");
steps=new Step[0];
}
}
} catch (Exception e) {
log.error("errore nel avanzamento del flusso");
log.error(e,e);
} finally {
jbpmContext.close();
}
return steps;
}





