1 package org.smartcomps.twister.engine.priv.messaging.impl;
2
3 import org.smartcomps.twister.engine.priv.core.definition.Activity;
4 import org.smartcomps.twister.engine.priv.core.dynamic.PickEC;
5 import org.smartcomps.twister.engine.priv.core.dynamic.ReceiveEC;
6 import org.smartcomps.twister.engine.priv.core.dynamic.StructuredEC;
7 import org.smartcomps.twister.engine.priv.core.dynamic.ProcessInstance;
8 import org.dom4j.Document;
9
10 import java.util.Collection;
11
12 /***
13 * Wrapper around a Pick execution context to have it behave like a Receive
14 * execution context.
15 * @see PickAsReceive
16 * @see org.smartcomps.twister.engine.priv.core.dynamic.PickEC
17 * @see org.smartcomps.twister.engine.priv.core.dynamic.ReceiveEC
18 */
19 public class PickECAsReceiveEC implements ReceiveEC {
20
21 private PickEC pickEC;
22 private int eventPos;
23
24 public PickECAsReceiveEC(PickEC pickEC, int eventPos) {
25 this.pickEC = pickEC;
26 this.eventPos = eventPos;
27 }
28
29 public Long getId() {
30 return pickEC.getId();
31 }
32
33 public StructuredEC getContainer() {
34 return pickEC;
35 }
36
37 public ProcessInstance getInstance() {
38 return pickEC.getInstance();
39 }
40
41 public ProcessInstance fetchInstance() {
42 return pickEC.fetchInstance();
43 }
44
45 public int getStatus() {
46 return pickEC.getStatus();
47 }
48
49 public void execute() {
50 pickEC.execute();
51 }
52
53 public void acknowledgeMessage(Document message) {
54 Activity underlyingActivity = (Activity) pickEC.getActivity().getActivities().get(eventPos);
55 pickEC.acknowledgeMessage(underlyingActivity, message);
56 }
57
58 public void setStatus(int status) {
59 // Useless for our purpose
60 throw new UnsupportedOperationException("This method shouldn't be used, this class is just a wrapper");
61 }
62
63 public Collection getEvents() {
64 // Useless for our purpose
65 throw new UnsupportedOperationException("This method shouldn't be used, this class is just a wrapper");
66 }
67
68 public int getEventPos() {
69 return eventPos;
70 }
71
72 public void setEventPos(int eventPos) {
73 this.eventPos = eventPos;
74 }
75
76 }
This page was automatically generated by Maven