Assignment in jBPM is so troublesome - urgent help needed!
gwittwer Nov 21, 2005 3:29 PMHello
Slowly I'm getting sick about the assignment stuff in jBPM. I'm testing and (re-)searching and changing since hours (may be days).
Please help me with the following. It must work end of this week for the thesis:
I have an Identity Module:
User & Group (and Roles, not used for Assignment).
Further I have an AssignmentHandler adapted from the ExpressionAssignmentHandler of jBPM.
Does someone of you have an implementation which is working with User, Group Assignment (ActorId and PooledActor?)?
I'm doing the following:
1. Starting new ProcessInstance
2. On start I create all SwimlaneInstance (forum topic of brittm, see code below)
3. Editing the taskinstance
4. Save & close the taskinstance
5. First Assignment works
6. edit new task and save & close it
7. Assignment is NULL.
I don't know what to do next?
What's the problem and how could I fix it?
How can I get the open TaskInstances for the Logged-In User "Mario XYZ" when his swimlane name is "Mario"?
I tested 10 different versions and tried to log/debug the stuff. I'm out of order now :-)
Need your help!
Greetings
Gerhard
On Start new Process I'm doing the following (like brittm wrote in the forum):
//create swimlane instances log.debug("create swimlane instances"); Map swimlanes = processDefinition.getTaskMgmtDefinition().getSwimlanes(); log.debug("swimlanes map: "+ swimlanes.size()); Iterator itr = swimlanes.keySet().iterator(); while(itr.hasNext()) { Swimlane swimlane = (Swimlane)swimlanes.get(itr.next()); log.debug("swimlane id="+swimlane.getId()+ " name="+swimlane.getName()); SwimlaneInstance swi = processInstance.getTaskMgmtInstance().getInitializedSwimlaneInstance(new ExecutionContext(processInstance.getRootToken()), swimlane); log.debug("swimlane instance name: "+swi.getName()); /* if(swi != null) swi.setActorId(swimlane.getName()); else log.warn("swimlane instance is null!"); */ Delegation del = swimlane.getAssignmentDelegation(); if(del == null) { log.error("swimlane delegation is null, sw name: "+ swimlane.getName()); continue; } String conf = del.getConfiguration(); log.debug("assignment configuration: " + conf); Class cl = ExpressionAssignmentHandler.getExpressionType(conf); String name = ExpressionAssignmentHandler.getContentOfAssignment(conf); log.debug("name of expression: "+ name); if(cl == User.class) { log.debug("expression is type of user, set actorId"); swi.setActorId(name); } else if (cl == Group.class) { log.debug("expression is type of group, set pooledActors"); IdentitySession is = new IdentitySession(); log.debug("get group for name: "+name); Group g = is.getGroupByName(name); if(g == null) { log.error("group is null, name: "+name); continue; } Set users = g.getUsers(); ArrayList userNames = new ArrayList(); for(Iterator i = users.iterator();i.hasNext();) { User u = (User)i.next(); // create new pooled actor and add it to list log.debug("create pooled actor: "+u.getName()); userNames.add(new PooledActor(u.getName())); } log.debug("setPooledActors"); swi.setPooledActors(userNames); } }
The log of the assignment handler is the following:
21:09:49,805 DEBUG [ProcessBean] processInstance: id=14 21:09:49,806 DEBUG [ProcessBean] create swimlane instances 21:09:49,806 DEBUG [ProcessBean] swimlanes map: 4 21:09:49,806 DEBUG [ProcessBean] swimlane id=9 name=Mario 21:09:49,816 DEBUG [ExpressionAssignmentHandler] assign called 21:09:49,817 DEBUG [ExpressionAssignmentHandler] assinable:org.jbpm.taskmgmt.exe.SwimlaneInstance@4ddc27 21:09:49,817 DEBUG [ExpressionAssignmentHandler] expression: user(Mario Andenmatten) 21:09:49,818 DEBUG [ExpressionAssignmentHandler] resolving first term 'user(Mario Andenmatten)' 21:09:49,818 DEBUG [ExpressionAssignmentHandler] assignment userName: Mario Andenmatten 21:09:49,819 DEBUG [ExpressionAssignmentHandler] get username by name: Mario Andenmatten 21:09:49,855 DEBUG [ExpressionAssignmentHandler] assignment entityname: Mario Andenmatten 21:09:49,856 DEBUG [ExpressionAssignmentHandler] entity is user : Mario Andenmatten 21:09:49,857 DEBUG [ProcessBean] swimlane instance name: Mario 21:09:49,858 DEBUG [ProcessBean] swimlane instance actor id: Mario Andenmatten 21:09:49,858 DEBUG [ProcessBean] swimlane id=10 name=Diplom 21:09:49,865 DEBUG [ExpressionAssignmentHandler] assign called 21:09:49,866 DEBUG [ExpressionAssignmentHandler] assinable:org.jbpm.taskmgmt.exe.SwimlaneInstance@35e7d8 21:09:49,866 DEBUG [ExpressionAssignmentHandler] expression: group(Diplomanden) 21:09:49,866 DEBUG [ExpressionAssignmentHandler] resolving first term 'group(Diplomanden)' 21:09:49,867 DEBUG [ExpressionAssignmentHandler] assignment groupName: Diplomanden 21:09:49,867 DEBUG [ExpressionAssignmentHandler] get group by name: Diplomanden 21:09:49,876 DEBUG [ExpressionAssignmentHandler] assignment entityname: Diplomanden 21:09:49,878 DEBUG [ExpressionAssignmentHandler] create pooled actor: Mario Andenmatten 21:09:49,879 DEBUG [ExpressionAssignmentHandler] create pooled actor: Gerhard Wittwer 21:09:49,879 DEBUG [ExpressionAssignmentHandler] entity is group : Diplomanden 21:09:49,880 DEBUG [ProcessBean] swimlane instance name: Diplom 21:09:49,880 DEBUG [ProcessBean] swimlane instance actor id: null 21:09:49,880 DEBUG [ProcessBean] swimlane id=11 name=Project 21:09:49,883 DEBUG [ExpressionAssignmentHandler] assign called 21:09:49,884 DEBUG [ExpressionAssignmentHandler] assinable:org.jbpm.taskmgmt.exe.SwimlaneInstance@27ab64 21:09:49,884 DEBUG [ExpressionAssignmentHandler] expression: group(Projektbeteiligten) 21:09:49,884 DEBUG [ExpressionAssignmentHandler] resolving first term 'group(Projektbeteiligten)' 21:09:49,885 DEBUG [ExpressionAssignmentHandler] assignment groupName: Projektbeteiligten 21:09:49,885 DEBUG [ExpressionAssignmentHandler] get group by name: Projektbeteiligten 21:09:49,890 DEBUG [ExpressionAssignmentHandler] assignment entityname: Projektbeteiligten 21:09:49,892 DEBUG [ExpressionAssignmentHandler] create pooled actor: Mario Andenmatten 21:09:49,892 DEBUG [ExpressionAssignmentHandler] create pooled actor: Walter Eich 21:09:49,893 DEBUG [ExpressionAssignmentHandler] create pooled actor: Joachim Fulde 21:09:49,893 DEBUG [ExpressionAssignmentHandler] create pooled actor: Rolf Jufer 21:09:49,893 DEBUG [ExpressionAssignmentHandler] create pooled actor: Gerhard Wittwer 21:09:49,894 DEBUG [ExpressionAssignmentHandler] entity is group : Projektbeteiligten 21:09:49,894 DEBUG [ProcessBean] swimlane instance name: Project 21:09:49,894 DEBUG [ProcessBean] swimlane instance actor id: null 21:09:49,894 DEBUG [ProcessBean] swimlane id=12 name=Gerhard 21:09:49,897 DEBUG [ExpressionAssignmentHandler] assign called 21:09:49,898 DEBUG [ExpressionAssignmentHandler] assinable:org.jbpm.taskmgmt.exe.SwimlaneInstance@d1c3c 21:09:49,898 DEBUG [ExpressionAssignmentHandler] expression: user(Gerhard Wittwer) 21:09:49,898 DEBUG [ExpressionAssignmentHandler] resolving first term 'user(Gerhard Wittwer)' 21:09:49,899 DEBUG [ExpressionAssignmentHandler] assignment userName: Gerhard Wittwer 21:09:49,899 DEBUG [ExpressionAssignmentHandler] get username by name: Gerhard Wittwer 21:09:49,931 DEBUG [ExpressionAssignmentHandler] assignment entityname: Gerhard Wittwer 21:09:49,931 DEBUG [ExpressionAssignmentHandler] entity is user : Gerhard Wittwer 21:09:49,931 DEBUG [ProcessBean] swimlane instance name: Gerhard 21:09:49,931 DEBUG [ProcessBean] swimlane instance actor id: Gerhard Wittwer
ProcessDefinition:
<process-definition name="daworkflow"> <!-- SWIMLANES (= process roles) --> <swimlane name="Project"> <assignment expression="group(Projektbeteiligten)" /> </swimlane> <swimlane name="Diplom"> <assignment expression="group(Diplomanden)" /> </swimlane> <swimlane name="Mario"> <assignment expression="user(Mario XYZ)" /> </swimlane> <swimlane name="Gerhard"> <assignment expression="user(Gerhard XYZ)" /> </swimlane> <!-- NODES --> <start-state name="Kick Off Meeting durchfuehren"> <task swimlane="Mario"> <controller> <variable name="comment" /> </controller> </task> <transition to="Pflichtenheft erstellen" /> </start-state> <task-node name="Pflichtenheft erstellen"> <task swimlane="Mario"> <event type="task-start"> <action class="hti.aibp.webapp.action.MessageAction"> <msg>dsddafsdf</msg> <msg1>blbllbalab</msg1> <msg2>blasdfdnldska</msg2> <msg3>sdafjsadfsdaf</msg3> <msg4>accountancy application is now informed of the payment</msg4> </action> </event> <controller> <variable name="comment" /> </controller> </task> <transition name="ok" to="Pflichtenheft Abnahme" /> <transition name="not ok" to="Voranalyse und Konzept durchfuehren" /> </task-node> <task-node name="Pflichtenheft Abnahme"> <task swimlane="Project"> <controller> <variable name="Variable1" /> </controller> </task> <transition to="Voranalyse und Konzept durchfuehren" /> </task-node> <task-node name="Voranalyse und Konzept durchfuehren"> <task swimlane="Project"> <controller> <variable name="comment" /> <variable name="Variable1" /> </controller> </task> <transition to="Realisierung beginnen" /> </task-node> <task-node name="Realisierung beginnen"> <task swimlane="Project"> <controller> <variable name="comment" access="read" /> <variable name="Variable1" /> </controller> </task> <transition name="anda" to="anda" /> </task-node> <task-node name="AIBP Client erstellen"> <task swimlane="Gerhard"> <controller> <variable name="comment" access="read" /> <variable name="Variable1" /> </controller> </task> <transition to="andb" /> </task-node> <task-node name="AIBP Webservice erstellen"> <task swimlane="Mario"> <controller> <variable name="comment" access="read" /> <variable name="Variable1" /> </controller> </task> <transition to="andb" /> </task-node> <task-node name="AIBP Webapp erstellen"> <task swimlane="Mario"> <controller> <variable name="comment" access="read" /> <variable name="Variable1" /> </controller> </task> <transition to="andb" /> </task-node> <task-node name="Abschluss Phase Realisierung"> <task swimlane="Mario"> <controller> <variable name="comment" /> </controller> </task> <transition to="Ende Diplomarbeit" /> </task-node> <fork name="anda"> <transition name="a" to="AIBP Client erstellen" /> <transition name="b" to="AIBP Webservice erstellen" /> <transition name="c" to="AIBP Webapp erstellen" /> </fork> <join name="andb"> <transition to="Abschluss Phase Realisierung" /> </join> <end-state name="Ende Diplomarbeit" /> </process-definition>