Bonjour à tous,

Etant stagiaire, on m'a confié la tâche de créer un workflow en utilisant jBPM.
Je me suis donc renseigné et je suis maintenant bloqué au niveau de la création de nœuds de décision.

J'ai créé un petit exemple qui me retourne une erreur :

Error completing task: An exception of type "org.jbpm.graph.def.DelegationException" was thrown.
Le code de mon processus est:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version="1.0" encoding="UTF-8"?>
 
<process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="DecisionVariable">
 
 
	<start-state name="Deb">
		<transition to="SaisiVariable"></transition>
	</start-state>
 
 
	<task-node name="SaisiVariable">
		<task name="Entrervariable">
			<controller>
				<variable access="read,write,required" name="nomVariable"></variable>
			</controller>
		</task>
		<transition to="PriseDecision"></transition>
	</task-node>
 
	<decision name="PriseDecision">
		<handler class="com.sample.action.IsCustomer" config-type="constructor"></handler>
		<transition to="TacheOK" name="OK">
			<action name="ActionOk" class="com.sample.action.MessageActionHandler">
				<message>
					Je suis passé par OK
				</message>
			</action>
		</transition>
		<transition to="TacheKO" name="KO">
			<action name="actionKO" class="com.sample.action.MessageActionHandler">
				<message>
					Je suis passé par KO
				</message>
			</action>
		</transition>
	</decision>
 
	<task-node name="TacheOK">
		<transition to="Fin"></transition>
	</task-node>
 
	<task-node name="TacheKO">
		<transition to="Fin"></transition>
	</task-node>
 
 
	<end-state name="Fin"></end-state>
 
 
	<task></task>
 
 
</process-definition>
les classes java :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.sample.action;
 
import org.jbpm.graph.node.DecisionHandler;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.exe.ExecutionContext;
 
 
public class IsCustomer implements DecisionHandler {
 
	private static final long serialVersionUID = -7974563519858522069L;
 
	public IsCustomer(){
		super();
	}
 
	public String decide(ExecutionContext executionContext) throws Exception {
		String maSortie="Oui";
		ContextInstance contextInstance = executionContext.getContextInstance();
        if (contextInstance.getVariable("nomVariable").equals("TOTO")) {
        	maSortie="Non";
        }
 
		return maSortie;
	}
}
et :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.sample.action;
 
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
 
public class MessageActionHandler implements ActionHandler {
 
	private static final long serialVersionUID = 1L;
 
	/**
         * The message member gets its value from the configuration in the 
         * processdefinition. The value is injected directly by the engine. 
         */
	String message;
 
	/**
         * A message process variable is assigned the value of the message
         * member. The process variable is created if it doesn't exist yet.
         */
	public void execute(ExecutionContext context) throws Exception {
		context.getContextInstance().setVariable("message", message);
	}
 
}
Merci de votre aide.