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.ExtendFacade;
12 import org.andromda.metafacades.uml.ExtensionPointFacade;
13 import org.andromda.metafacades.uml.UseCaseFacade;
14 import org.apache.log4j.Logger;
15 import org.omg.uml.behavioralelements.usecases.Extend;
16
17
18
19
20
21
22
23
24
25 public abstract class ExtendFacadeLogic
26 extends ModelElementFacadeLogicImpl
27 implements ExtendFacade
28 {
29
30
31
32
33 protected Extend metaObject;
34
35
36
37
38
39 protected ExtendFacadeLogic(Extend metaObjectIn, String context)
40 {
41 super(metaObjectIn, getContext(context));
42 this.metaObject = metaObjectIn;
43 }
44
45
46
47
48 private static final Logger logger = Logger.getLogger(ExtendFacadeLogic.class);
49
50
51
52
53
54
55 private static String getContext(String context)
56 {
57 if (context == null)
58 {
59 context = "org.andromda.metafacades.uml.ExtendFacade";
60 }
61 return context;
62 }
63
64
65
66
67 @Override
68 public void resetMetafacadeContext(String context)
69 {
70 if (!this.contextRoot)
71 {
72 context = getContext(context);
73 setMetafacadeContext (context);
74 }
75 }
76
77
78
79
80
81 public boolean isExtendFacadeMetaType()
82 {
83 return true;
84 }
85
86
87
88 private List<ExtensionPointFacade> __getExtensionPoints1r;
89 private boolean __getExtensionPoints1rSet = false;
90
91
92
93
94
95
96
97
98
99 public final List<ExtensionPointFacade> getExtensionPoints()
100 {
101 List<ExtensionPointFacade> getExtensionPoints1r = this.__getExtensionPoints1r;
102 if (!this.__getExtensionPoints1rSet)
103 {
104
105 List result = handleGetExtensionPoints();
106 List shieldedResult = this.shieldedElements(result);
107 try
108 {
109 getExtensionPoints1r = (List<ExtensionPointFacade>)shieldedResult;
110 }
111 catch (ClassCastException ex)
112 {
113
114 ExtendFacadeLogic.logger.warn("incorrect metafacade cast for ExtendFacadeLogic.getExtensionPoints List<ExtensionPointFacade> " + result + ": " + shieldedResult);
115 }
116
117 this.__getExtensionPoints1r = getExtensionPoints1r;
118 if (isMetafacadePropertyCachingEnabled())
119 {
120 this.__getExtensionPoints1rSet = true;
121 }
122 }
123 return getExtensionPoints1r;
124 }
125
126
127
128
129
130 protected abstract List handleGetExtensionPoints();
131
132 private UseCaseFacade __getBase2r;
133 private boolean __getBase2rSet = false;
134
135
136
137
138
139 public final UseCaseFacade getBase()
140 {
141 UseCaseFacade getBase2r = this.__getBase2r;
142 if (!this.__getBase2rSet)
143 {
144
145 Object result = handleGetBase();
146 MetafacadeBase shieldedResult = this.shieldedElement(result);
147 try
148 {
149 getBase2r = (UseCaseFacade)shieldedResult;
150 }
151 catch (ClassCastException ex)
152 {
153
154 ExtendFacadeLogic.logger.warn("incorrect metafacade cast for ExtendFacadeLogic.getBase UseCaseFacade " + result + ": " + shieldedResult);
155 }
156
157 this.__getBase2r = getBase2r;
158 if (isMetafacadePropertyCachingEnabled())
159 {
160 this.__getBase2rSet = true;
161 }
162 }
163 return getBase2r;
164 }
165
166
167
168
169
170 protected abstract Object handleGetBase();
171
172 private UseCaseFacade __getExtension3r;
173 private boolean __getExtension3rSet = false;
174
175
176
177
178
179
180
181
182
183 public final UseCaseFacade getExtension()
184 {
185 UseCaseFacade getExtension3r = this.__getExtension3r;
186 if (!this.__getExtension3rSet)
187 {
188
189 Object result = handleGetExtension();
190 MetafacadeBase shieldedResult = this.shieldedElement(result);
191 try
192 {
193 getExtension3r = (UseCaseFacade)shieldedResult;
194 }
195 catch (ClassCastException ex)
196 {
197
198 ExtendFacadeLogic.logger.warn("incorrect metafacade cast for ExtendFacadeLogic.getExtension UseCaseFacade " + result + ": " + shieldedResult);
199 }
200
201 this.__getExtension3r = getExtension3r;
202 if (isMetafacadePropertyCachingEnabled())
203 {
204 this.__getExtension3rSet = true;
205 }
206 }
207 return getExtension3r;
208 }
209
210
211
212
213
214 protected abstract Object handleGetExtension();
215
216
217
218
219
220 @Override
221 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
222 {
223 super.validateInvariants(validationMessages);
224 }
225 }