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.MetafacadeBase;
10 import org.andromda.core.metafacade.ModelValidationMessage;
11 import org.andromda.metafacades.uml.AssociationEndFacade;
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.LinkEnd;
17
18
19
20
21
22
23
24
25
26 public abstract class LinkEndFacadeLogic
27 extends ModelElementFacadeLogicImpl
28 implements LinkEndFacade
29 {
30
31
32
33
34 protected LinkEnd metaObject;
35
36
37
38
39
40 protected LinkEndFacadeLogic(LinkEnd metaObjectIn, String context)
41 {
42 super(metaObjectIn, getContext(context));
43 this.metaObject = metaObjectIn;
44 }
45
46
47
48
49 private static final Logger logger = Logger.getLogger(LinkEndFacadeLogic.class);
50
51
52
53
54
55
56 private static String getContext(String context)
57 {
58 if (context == null)
59 {
60 context = "org.andromda.metafacades.uml.LinkEndFacade";
61 }
62 return context;
63 }
64
65
66
67
68 @Override
69 public void resetMetafacadeContext(String context)
70 {
71 if (!this.contextRoot)
72 {
73 context = getContext(context);
74 setMetafacadeContext (context);
75 }
76 }
77
78
79
80
81
82 public boolean isLinkEndFacadeMetaType()
83 {
84 return true;
85 }
86
87
88
89 private LinkFacade __getLink1r;
90 private boolean __getLink1rSet = false;
91
92
93
94
95
96 public final LinkFacade getLink()
97 {
98 LinkFacade getLink1r = this.__getLink1r;
99 if (!this.__getLink1rSet)
100 {
101
102 Object result = handleGetLink();
103 MetafacadeBase shieldedResult = this.shieldedElement(result);
104 try
105 {
106 getLink1r = (LinkFacade)shieldedResult;
107 }
108 catch (ClassCastException ex)
109 {
110
111 LinkEndFacadeLogic.logger.warn("incorrect metafacade cast for LinkEndFacadeLogic.getLink LinkFacade " + result + ": " + shieldedResult);
112 }
113
114 this.__getLink1r = getLink1r;
115 if (isMetafacadePropertyCachingEnabled())
116 {
117 this.__getLink1rSet = true;
118 }
119 }
120 return getLink1r;
121 }
122
123
124
125
126
127 protected abstract Object handleGetLink();
128
129 private AssociationEndFacade __getAssociationEnd2r;
130 private boolean __getAssociationEnd2rSet = false;
131
132
133
134
135
136
137
138
139
140 public final AssociationEndFacade getAssociationEnd()
141 {
142 AssociationEndFacade getAssociationEnd2r = this.__getAssociationEnd2r;
143 if (!this.__getAssociationEnd2rSet)
144 {
145
146 Object result = handleGetAssociationEnd();
147 MetafacadeBase shieldedResult = this.shieldedElement(result);
148 try
149 {
150 getAssociationEnd2r = (AssociationEndFacade)shieldedResult;
151 }
152 catch (ClassCastException ex)
153 {
154
155 LinkEndFacadeLogic.logger.warn("incorrect metafacade cast for LinkEndFacadeLogic.getAssociationEnd AssociationEndFacade " + result + ": " + shieldedResult);
156 }
157
158 this.__getAssociationEnd2r = getAssociationEnd2r;
159 if (isMetafacadePropertyCachingEnabled())
160 {
161 this.__getAssociationEnd2rSet = true;
162 }
163 }
164 return getAssociationEnd2r;
165 }
166
167
168
169
170
171 protected abstract Object handleGetAssociationEnd();
172
173 private InstanceFacade __getInstance3r;
174 private boolean __getInstance3rSet = false;
175
176
177
178
179
180 public final InstanceFacade getInstance()
181 {
182 InstanceFacade getInstance3r = this.__getInstance3r;
183 if (!this.__getInstance3rSet)
184 {
185
186 Object result = handleGetInstance();
187 MetafacadeBase shieldedResult = this.shieldedElement(result);
188 try
189 {
190 getInstance3r = (InstanceFacade)shieldedResult;
191 }
192 catch (ClassCastException ex)
193 {
194
195 LinkEndFacadeLogic.logger.warn("incorrect metafacade cast for LinkEndFacadeLogic.getInstance InstanceFacade " + result + ": " + shieldedResult);
196 }
197
198 this.__getInstance3r = getInstance3r;
199 if (isMetafacadePropertyCachingEnabled())
200 {
201 this.__getInstance3rSet = true;
202 }
203 }
204 return getInstance3r;
205 }
206
207
208
209
210
211 protected abstract Object handleGetInstance();
212
213 private Collection<InstanceFacade> __getInstances4r;
214 private boolean __getInstances4rSet = false;
215
216
217
218
219
220
221
222
223
224 public final Collection<InstanceFacade> getInstances()
225 {
226 Collection<InstanceFacade> getInstances4r = this.__getInstances4r;
227 if (!this.__getInstances4rSet)
228 {
229
230 Collection result = handleGetInstances();
231 List shieldedResult = this.shieldedElements(result);
232 try
233 {
234 getInstances4r = (Collection<InstanceFacade>)shieldedResult;
235 }
236 catch (ClassCastException ex)
237 {
238
239 LinkEndFacadeLogic.logger.warn("incorrect metafacade cast for LinkEndFacadeLogic.getInstances Collection<InstanceFacade> " + result + ": " + shieldedResult);
240 }
241
242 this.__getInstances4r = getInstances4r;
243 if (isMetafacadePropertyCachingEnabled())
244 {
245 this.__getInstances4rSet = true;
246 }
247 }
248 return getInstances4r;
249 }
250
251
252
253
254
255 protected abstract Collection handleGetInstances();
256
257
258
259
260
261 @Override
262 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
263 {
264 super.validateInvariants(validationMessages);
265 }
266 }