1
2
3
4
5
6 package net.kwfgrid.gworkflowdl.protocol.structure;
7
8 import net.kwfgrid.gworkflowdl.protocol.xml.GWDLNamespace;
9 import net.kwfgrid.gworkflowdl.protocol.calls.TokenSetID;
10 import net.kwfgrid.gworkflowdl.structure.Data;
11 import net.kwfgrid.gworkflowdl.structure.GenericProperties;
12 import net.kwfgrid.gworkflowdl.structure.Token;
13 import net.kwfgrid.gworkflowdl.structure.Transition;
14
15 /***
16 * Protocol implementation of Token.
17 * <b>Note:</b> The methods <code>set(Object)</code> and <code>fromXML(String)</code>
18 * can only be used when the Token is not attached to a workflow structure with protocol method call strategy.
19 */
20 public class ProtocolToken extends AbstractChildObject implements Token, GWDLNamespace {
21 /***
22 * The namespace of this object. Used for event notification.
23 */
24 public static final String NAMESPACE = GWDL_NS;
25 /*** The namespace of the properties of this object. Used for event notification. */
26 public static final String NAMESPACE_PROPERTIES = GWDL_ATTRIBUTE_NS;
27
28 /***
29 * The name of this object. Used for event notification.
30 */
31 public static final String NAME = "token";
32 public static final String NAME_DATA = "data";
33 /*** The name of the ID property of this object. Used for event notification. */
34 public static final String NAME_ID = "ID";
35
36 protected Token _delegate;
37
38 protected ProtocolToken(Token delegate) {
39 super();
40 _delegate = delegate;
41 }
42
43
44
45
46
47 public void setID(String id) {
48 getMethodCallStrategy().execute(new TokenSetID(this, id));
49 }
50
51
52
53
54
55 /***
56 This method is only to be used by the protocol.
57 */
58 public void __setID(String id) {
59 _delegate.setID(id);
60 firePropertyChanged(NAMESPACE_PROPERTIES, NAME_ID, id);
61 }
62
63 /***
64 * This method is only to be used by the protocol.
65 */
66
67
68
69
70
71 public String getID() {
72 return _delegate.getID();
73 }
74
75 public GenericProperties getProperties() {
76 return _delegate.getProperties();
77 }
78
79 public Data getData() {
80 return _delegate.getData();
81 }
82
83 public Boolean getControl() {
84 return _delegate.getControl();
85 }
86
87 public Object clone() {
88 return new ProtocolToken((Token) _delegate.clone());
89 }
90
91 public void lock(Transition transition) {
92 _delegate.lock(transition);
93 }
94
95 public void unlock() {
96 _delegate.unlock();
97 }
98
99 public boolean isLocked() {
100 return _delegate.isLocked();
101 }
102
103 public boolean isLockedBy(Transition transition) {
104 return _delegate.isLockedBy(transition);
105 }
106
107 }