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