1
2
3
4
5 package org.andromda.metafacades.uml14;
6
7 import java.util.Collection;
8 import java.util.List;
9 import org.andromda.core.metafacade.ModelValidationMessage;
10 import org.andromda.metafacades.uml.AttributeLinkFacade;
11 import org.andromda.metafacades.uml.ClassifierFacade;
12 import org.andromda.metafacades.uml.InstanceFacade;
13 import org.andromda.metafacades.uml.LinkEndFacade;
14 import org.andromda.metafacades.uml.LinkFacade;
15 import org.apache.log4j.Logger;
16 import org.omg.uml.behavioralelements.commonbehavior.Instance;
17
18
19
20
21
22
23
24
25
26
27 public abstract class InstanceFacadeLogic
28 extends ModelElementFacadeLogicImpl
29 implements InstanceFacade
30 {
31
32
33
34
35 protected Instance metaObject;
36
37
38
39
40
41 protected InstanceFacadeLogic(Instance metaObjectIn, String context)
42 {
43 super(metaObjectIn, getContext(context));
44 this.metaObject = metaObjectIn;
45 }
46
47
48
49
50 private static final Logger logger = Logger.getLogger(InstanceFacadeLogic.class);
51
52
53
54
55
56
57 private static String getContext(String context)
58 {
59 if (context == null)
60 {
61 context = "org.andromda.metafacades.uml.InstanceFacade";
62 }
63 return context;
64 }
65
66
67
68
69 @Override
70 public void resetMetafacadeContext(String context)
71 {
72 if (!this.contextRoot)
73 {
74 context = getContext(context);
75 setMetafacadeContext (context);
76 }
77 }
78
79
80
81
82
83 public boolean isInstanceFacadeMetaType()
84 {
85 return true;
86 }
87
88
89
90 private Collection<LinkFacade> __getOwnedLinks1r;
91 private boolean __getOwnedLinks1rSet = false;
92
93
94
95
96
97
98
99
100
101
102
103 public final Collection<LinkFacade> getOwnedLinks()
104 {
105 Collection<LinkFacade> getOwnedLinks1r = this.__getOwnedLinks1r;
106 if (!this.__getOwnedLinks1rSet)
107 {
108
109 Collection result = handleGetOwnedLinks();
110 List shieldedResult = this.shieldedElements(result);
111 try
112 {
113 getOwnedLinks1r = (Collection<LinkFacade>)shieldedResult;
114 }
115 catch (ClassCastException ex)
116 {
117
118 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getOwnedLinks Collection<LinkFacade> " + result + ": " + shieldedResult);
119 }
120
121 this.__getOwnedLinks1r = getOwnedLinks1r;
122 if (isMetafacadePropertyCachingEnabled())
123 {
124 this.__getOwnedLinks1rSet = true;
125 }
126 }
127 return getOwnedLinks1r;
128 }
129
130
131
132
133
134 protected abstract Collection handleGetOwnedLinks();
135
136 private Collection<InstanceFacade> __getOwnedInstances2r;
137 private boolean __getOwnedInstances2rSet = false;
138
139
140
141
142
143
144
145
146
147
148
149 public final Collection<InstanceFacade> getOwnedInstances()
150 {
151 Collection<InstanceFacade> getOwnedInstances2r = this.__getOwnedInstances2r;
152 if (!this.__getOwnedInstances2rSet)
153 {
154
155 Collection result = handleGetOwnedInstances();
156 List shieldedResult = this.shieldedElements(result);
157 try
158 {
159 getOwnedInstances2r = (Collection<InstanceFacade>)shieldedResult;
160 }
161 catch (ClassCastException ex)
162 {
163
164 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getOwnedInstances Collection<InstanceFacade> " + result + ": " + shieldedResult);
165 }
166
167 this.__getOwnedInstances2r = getOwnedInstances2r;
168 if (isMetafacadePropertyCachingEnabled())
169 {
170 this.__getOwnedInstances2rSet = true;
171 }
172 }
173 return getOwnedInstances2r;
174 }
175
176
177
178
179
180 protected abstract Collection handleGetOwnedInstances();
181
182
183
184
185
186
187 public final Collection<AttributeLinkFacade> getSlots()
188 {
189 Collection<AttributeLinkFacade> getSlots3r = null;
190
191 Collection result = handleGetSlots();
192 List shieldedResult = this.shieldedElements(result);
193 try
194 {
195 getSlots3r = (Collection<AttributeLinkFacade>)shieldedResult;
196 }
197 catch (ClassCastException ex)
198 {
199
200 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getSlots Collection<AttributeLinkFacade> " + result + ": " + shieldedResult);
201 }
202
203 return getSlots3r;
204 }
205
206
207
208
209
210 protected abstract Collection handleGetSlots();
211
212 private Collection<LinkEndFacade> __getLinkEnds4r;
213 private boolean __getLinkEnds4rSet = false;
214
215
216
217
218
219 public final Collection<LinkEndFacade> getLinkEnds()
220 {
221 Collection<LinkEndFacade> getLinkEnds4r = this.__getLinkEnds4r;
222 if (!this.__getLinkEnds4rSet)
223 {
224
225 Collection result = handleGetLinkEnds();
226 List shieldedResult = this.shieldedElements(result);
227 try
228 {
229 getLinkEnds4r = (Collection<LinkEndFacade>)shieldedResult;
230 }
231 catch (ClassCastException ex)
232 {
233
234 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getLinkEnds Collection<LinkEndFacade> " + result + ": " + shieldedResult);
235 }
236
237 this.__getLinkEnds4r = getLinkEnds4r;
238 if (isMetafacadePropertyCachingEnabled())
239 {
240 this.__getLinkEnds4rSet = true;
241 }
242 }
243 return getLinkEnds4r;
244 }
245
246
247
248
249
250 protected abstract Collection handleGetLinkEnds();
251
252 private Collection<ClassifierFacade> __getClassifiers5r;
253 private boolean __getClassifiers5rSet = false;
254
255
256
257
258
259
260
261
262
263
264
265 public final Collection<ClassifierFacade> getClassifiers()
266 {
267 Collection<ClassifierFacade> getClassifiers5r = this.__getClassifiers5r;
268 if (!this.__getClassifiers5rSet)
269 {
270
271 Collection result = handleGetClassifiers();
272 List shieldedResult = this.shieldedElements(result);
273 try
274 {
275 getClassifiers5r = (Collection<ClassifierFacade>)shieldedResult;
276 }
277 catch (ClassCastException ex)
278 {
279
280 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getClassifiers Collection<ClassifierFacade> " + result + ": " + shieldedResult);
281 }
282
283 this.__getClassifiers5r = getClassifiers5r;
284 if (isMetafacadePropertyCachingEnabled())
285 {
286 this.__getClassifiers5rSet = true;
287 }
288 }
289 return getClassifiers5r;
290 }
291
292
293
294
295
296 protected abstract Collection handleGetClassifiers();
297
298 private Collection<AttributeLinkFacade> __getAttributeLinks6r;
299 private boolean __getAttributeLinks6rSet = false;
300
301
302
303
304
305 public final Collection<AttributeLinkFacade> getAttributeLinks()
306 {
307 Collection<AttributeLinkFacade> getAttributeLinks6r = this.__getAttributeLinks6r;
308 if (!this.__getAttributeLinks6rSet)
309 {
310
311 Collection result = handleGetAttributeLinks();
312 List shieldedResult = this.shieldedElements(result);
313 try
314 {
315 getAttributeLinks6r = (Collection<AttributeLinkFacade>)shieldedResult;
316 }
317 catch (ClassCastException ex)
318 {
319
320 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getAttributeLinks Collection<AttributeLinkFacade> " + result + ": " + shieldedResult);
321 }
322
323 this.__getAttributeLinks6r = getAttributeLinks6r;
324 if (isMetafacadePropertyCachingEnabled())
325 {
326 this.__getAttributeLinks6rSet = true;
327 }
328 }
329 return getAttributeLinks6r;
330 }
331
332
333
334
335
336 protected abstract Collection handleGetAttributeLinks();
337
338
339
340
341
342 @Override
343 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
344 {
345 super.validateInvariants(validationMessages);
346 }
347 }