1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.module.jbpm; |
12 | |
|
13 | |
import org.jbpm.jpdl.internal.activity.JpdlBinding; |
14 | |
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition; |
15 | |
import org.jbpm.jpdl.internal.xml.JpdlParser; |
16 | |
import org.jbpm.pvm.internal.model.ActivityImpl; |
17 | |
import org.jbpm.pvm.internal.util.XmlUtil; |
18 | |
import org.jbpm.pvm.internal.xml.Parse; |
19 | |
import org.w3c.dom.Element; |
20 | |
|
21 | |
public class MuleReceiveBinding extends JpdlBinding |
22 | |
{ |
23 | |
public MuleReceiveBinding() |
24 | |
{ |
25 | 0 | super("mule-receive"); |
26 | 0 | } |
27 | |
|
28 | |
public Object parseJpdl(Element element, Parse parse, JpdlParser parser) |
29 | |
{ |
30 | |
MuleReceiveActivity activity; |
31 | |
|
32 | 0 | JpdlProcessDefinition processDefinition = parse.contextStackFind(JpdlProcessDefinition.class); |
33 | 0 | if (processDefinition.getInitial() == null) |
34 | |
{ |
35 | 0 | processDefinition.setInitial(parse.contextStackFind(ActivityImpl.class)); |
36 | 0 | activity = new MuleReceiveActivity(true); |
37 | |
} |
38 | |
else |
39 | |
{ |
40 | 0 | activity = new MuleReceiveActivity(false); |
41 | |
} |
42 | |
|
43 | 0 | if (element.hasAttribute("var")) |
44 | 0 | activity.setVariableName(XmlUtil.attribute(element, "var", parse)); |
45 | |
|
46 | 0 | if (element.hasAttribute("endpoint")) |
47 | 0 | activity.setEndpoint(XmlUtil.attribute(element, "endpoint", parse)); |
48 | |
|
49 | 0 | if (element.hasAttribute("type")) |
50 | 0 | activity.setPayloadClass(XmlUtil.attribute(element, "type", parse)); |
51 | |
|
52 | 0 | return activity; |
53 | |
} |
54 | |
} |