1
2
3
4
5 package org.andromda.metafacades.emf.uml22;
6
7 import java.util.Collection;
8 import java.util.List;
9 import org.andromda.core.metafacade.MetafacadeBase;
10 import org.andromda.core.metafacade.ModelValidationMessage;
11 import org.andromda.metafacades.uml.Destination;
12 import org.andromda.metafacades.uml.Role;
13 import org.andromda.metafacades.uml.Service;
14 import org.andromda.metafacades.uml.ServiceOperation;
15 import org.apache.log4j.Logger;
16 import org.eclipse.uml2.uml.Operation;
17
18
19
20
21
22
23
24 public abstract class ServiceOperationLogic
25 extends OperationFacadeLogicImpl
26 implements ServiceOperation
27 {
28
29
30
31
32 protected Object metaObject;
33
34
35
36
37
38 protected ServiceOperationLogic(Object metaObjectIn, String context)
39 {
40 super((Operation)metaObjectIn, getContext(context));
41 this.metaObject = metaObjectIn;
42 }
43
44
45
46
47 private static final Logger logger = Logger.getLogger(ServiceOperationLogic.class);
48
49
50
51
52
53
54 private static String getContext(String context)
55 {
56 if (context == null)
57 {
58 context = "org.andromda.metafacades.uml.ServiceOperation";
59 }
60 return context;
61 }
62
63
64
65
66 @Override
67 public void resetMetafacadeContext(String context)
68 {
69 if (!this.contextRoot)
70 {
71 context = getContext(context);
72 setMetafacadeContext (context);
73 }
74 }
75
76
77
78
79
80 public boolean isServiceOperationMetaType()
81 {
82 return true;
83 }
84
85
86
87
88
89
90
91 protected abstract boolean handleIsIncomingMessageOperation();
92
93 private boolean __incomingMessageOperation1a;
94 private boolean __incomingMessageOperation1aSet = false;
95
96
97
98
99
100
101 public final boolean isIncomingMessageOperation()
102 {
103 boolean incomingMessageOperation1a = this.__incomingMessageOperation1a;
104 if (!this.__incomingMessageOperation1aSet)
105 {
106
107 incomingMessageOperation1a = handleIsIncomingMessageOperation();
108
109 this.__incomingMessageOperation1a = incomingMessageOperation1a;
110 if (isMetafacadePropertyCachingEnabled())
111 {
112 this.__incomingMessageOperation1aSet = true;
113 }
114 }
115 return incomingMessageOperation1a;
116 }
117
118
119
120
121
122 protected abstract boolean handleIsOutgoingMessageOperation();
123
124 private boolean __outgoingMessageOperation2a;
125 private boolean __outgoingMessageOperation2aSet = false;
126
127
128
129
130
131
132 public final boolean isOutgoingMessageOperation()
133 {
134 boolean outgoingMessageOperation2a = this.__outgoingMessageOperation2a;
135 if (!this.__outgoingMessageOperation2aSet)
136 {
137
138 outgoingMessageOperation2a = handleIsOutgoingMessageOperation();
139
140 this.__outgoingMessageOperation2a = outgoingMessageOperation2a;
141 if (isMetafacadePropertyCachingEnabled())
142 {
143 this.__outgoingMessageOperation2aSet = true;
144 }
145 }
146 return outgoingMessageOperation2a;
147 }
148
149
150
151
152
153 protected abstract boolean handleIsMessageOperation();
154
155 private boolean __messageOperation3a;
156 private boolean __messageOperation3aSet = false;
157
158
159
160
161
162 public final boolean isMessageOperation()
163 {
164 boolean messageOperation3a = this.__messageOperation3a;
165 if (!this.__messageOperation3aSet)
166 {
167
168 messageOperation3a = handleIsMessageOperation();
169
170 this.__messageOperation3a = messageOperation3a;
171 if (isMetafacadePropertyCachingEnabled())
172 {
173 this.__messageOperation3aSet = true;
174 }
175 }
176 return messageOperation3a;
177 }
178
179
180
181
182
183
184
185 public final Collection<Role> getRoles()
186 {
187 Collection<Role> getRoles1r = null;
188
189 Collection result = handleGetRoles();
190 List shieldedResult = this.shieldedElements(result);
191 try
192 {
193 getRoles1r = (Collection<Role>)shieldedResult;
194 }
195 catch (ClassCastException ex)
196 {
197
198 ServiceOperationLogic.logger.warn("incorrect metafacade cast for ServiceOperationLogic.getRoles Collection<Role> " + result + ": " + shieldedResult);
199 }
200
201 return getRoles1r;
202 }
203
204
205
206
207
208 protected abstract Collection handleGetRoles();
209
210
211
212
213
214 public final Service getService()
215 {
216 Service getService2r = null;
217
218 Object result = handleGetService();
219 MetafacadeBase shieldedResult = this.shieldedElement(result);
220 try
221 {
222 getService2r = (Service)shieldedResult;
223 }
224 catch (ClassCastException ex)
225 {
226
227 ServiceOperationLogic.logger.warn("incorrect metafacade cast for ServiceOperationLogic.getService Service " + result + ": " + shieldedResult);
228 }
229
230 return getService2r;
231 }
232
233
234
235
236
237 protected abstract Object handleGetService();
238
239
240
241
242
243 public final Destination getOutgoingDestination()
244 {
245 Destination getOutgoingDestination3r = null;
246
247 Object result = handleGetOutgoingDestination();
248 MetafacadeBase shieldedResult = this.shieldedElement(result);
249 try
250 {
251 getOutgoingDestination3r = (Destination)shieldedResult;
252 }
253 catch (ClassCastException ex)
254 {
255
256 ServiceOperationLogic.logger.warn("incorrect metafacade cast for ServiceOperationLogic.getOutgoingDestination Destination " + result + ": " + shieldedResult);
257 }
258
259 return getOutgoingDestination3r;
260 }
261
262
263
264
265
266 protected abstract Object handleGetOutgoingDestination();
267
268
269
270
271
272 public final Destination getIncomingDestination()
273 {
274 Destination getIncomingDestination4r = null;
275
276 Object result = handleGetIncomingDestination();
277 MetafacadeBase shieldedResult = this.shieldedElement(result);
278 try
279 {
280 getIncomingDestination4r = (Destination)shieldedResult;
281 }
282 catch (ClassCastException ex)
283 {
284
285 ServiceOperationLogic.logger.warn("incorrect metafacade cast for ServiceOperationLogic.getIncomingDestination Destination " + result + ": " + shieldedResult);
286 }
287
288 return getIncomingDestination4r;
289 }
290
291
292
293
294
295 protected abstract Object handleGetIncomingDestination();
296
297
298
299
300
301 @Override
302 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
303 {
304 super.validateInvariants(validationMessages);
305 }
306 }