1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.apache.camel.bam.rules; |
18 |
|
|
19 |
|
import org.apache.camel.Exchange; |
20 |
|
import org.apache.camel.bam.model.ActivityState; |
21 |
|
import org.apache.camel.bam.model.ProcessDefinition; |
22 |
|
import org.apache.camel.bam.model.ProcessInstance; |
23 |
|
import org.apache.camel.impl.ServiceSupport; |
24 |
|
import org.apache.camel.util.ServiceHelper; |
25 |
|
|
26 |
|
import java.util.ArrayList; |
27 |
|
import java.util.List; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
1 |
public class ProcessRules extends ServiceSupport { |
33 |
|
private ProcessDefinition processDefinition; |
34 |
1 |
private List<ActivityRules> activities = new ArrayList<ActivityRules>(); |
35 |
|
|
36 |
|
public void processExpired(ActivityState activityState) throws Exception { |
37 |
1 |
for (ActivityRules activityRules : activities) { |
38 |
3 |
activityRules.processExpired(activityState); |
39 |
3 |
} |
40 |
1 |
} |
41 |
|
|
42 |
|
public void processExchange(Exchange exchange, ProcessInstance process) { |
43 |
1 |
for (ActivityRules activityRules : activities) { |
44 |
3 |
activityRules.processExchange(exchange, process); |
45 |
3 |
} |
46 |
1 |
} |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
public List<ActivityRules> getActivities() { |
51 |
3 |
return activities; |
52 |
|
} |
53 |
|
|
54 |
|
public ProcessDefinition getProcessDefinition() { |
55 |
1 |
return processDefinition; |
56 |
|
} |
57 |
|
|
58 |
|
public void setProcessDefinition(ProcessDefinition processDefinition) { |
59 |
3 |
this.processDefinition = processDefinition; |
60 |
3 |
} |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
protected void doStart() throws Exception { |
65 |
1 |
ServiceHelper.startServices(activities); |
66 |
1 |
} |
67 |
|
|
68 |
|
protected void doStop() throws Exception { |
69 |
0 |
ServiceHelper.stopServices(activities); |
70 |
0 |
} |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
|
|