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.ActivityGraphFacade;
12 import org.andromda.metafacades.uml.ExtendFacade;
13 import org.andromda.metafacades.uml.ExtensionPointFacade;
14 import org.andromda.metafacades.uml.IncludeFacade;
15 import org.andromda.metafacades.uml.UseCaseFacade;
16 import org.apache.log4j.Logger;
17 import org.omg.uml.behavioralelements.usecases.UseCase;
18
19
20
21
22
23
24
25
26 public abstract class UseCaseFacadeLogic
27 extends NamespaceFacadeLogicImpl
28 implements UseCaseFacade
29 {
30
31
32
33
34 protected UseCase metaObject;
35
36
37
38
39
40 protected UseCaseFacadeLogic(UseCase 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(UseCaseFacadeLogic.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.UseCaseFacade";
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 isUseCaseFacadeMetaType()
83 {
84 return true;
85 }
86
87
88
89 private Collection<ExtendFacade> __getExtends1r;
90 private boolean __getExtends1rSet = false;
91
92
93
94
95
96 public final Collection<ExtendFacade> getExtends()
97 {
98 Collection<ExtendFacade> getExtends1r = this.__getExtends1r;
99 if (!this.__getExtends1rSet)
100 {
101
102 Collection result = handleGetExtends();
103 List shieldedResult = this.shieldedElements(result);
104 try
105 {
106 getExtends1r = (Collection<ExtendFacade>)shieldedResult;
107 }
108 catch (ClassCastException ex)
109 {
110
111 UseCaseFacadeLogic.logger.warn("incorrect metafacade cast for UseCaseFacadeLogic.getExtends Collection<ExtendFacade> " + result + ": " + shieldedResult);
112 }
113
114 this.__getExtends1r = getExtends1r;
115 if (isMetafacadePropertyCachingEnabled())
116 {
117 this.__getExtends1rSet = true;
118 }
119 }
120 return getExtends1r;
121 }
122
123
124
125
126
127 protected abstract Collection handleGetExtends();
128
129
130
131
132
133
134
135 public final Collection<IncludeFacade> getIncludes()
136 {
137 Collection<IncludeFacade> getIncludes2r = null;
138
139 Collection result = handleGetIncludes();
140 List shieldedResult = this.shieldedElements(result);
141 try
142 {
143 getIncludes2r = (Collection<IncludeFacade>)shieldedResult;
144 }
145 catch (ClassCastException ex)
146 {
147
148 UseCaseFacadeLogic.logger.warn("incorrect metafacade cast for UseCaseFacadeLogic.getIncludes Collection<IncludeFacade> " + result + ": " + shieldedResult);
149 }
150
151 return getIncludes2r;
152 }
153
154
155
156
157
158 protected abstract Collection handleGetIncludes();
159
160 private Collection<ExtensionPointFacade> __getExtensionPoints3r;
161 private boolean __getExtensionPoints3rSet = false;
162
163
164
165
166
167
168
169 public final Collection<ExtensionPointFacade> getExtensionPoints()
170 {
171 Collection<ExtensionPointFacade> getExtensionPoints3r = this.__getExtensionPoints3r;
172 if (!this.__getExtensionPoints3rSet)
173 {
174
175 Collection result = handleGetExtensionPoints();
176 List shieldedResult = this.shieldedElements(result);
177 try
178 {
179 getExtensionPoints3r = (Collection<ExtensionPointFacade>)shieldedResult;
180 }
181 catch (ClassCastException ex)
182 {
183
184 UseCaseFacadeLogic.logger.warn("incorrect metafacade cast for UseCaseFacadeLogic.getExtensionPoints Collection<ExtensionPointFacade> " + result + ": " + shieldedResult);
185 }
186
187 this.__getExtensionPoints3r = getExtensionPoints3r;
188 if (isMetafacadePropertyCachingEnabled())
189 {
190 this.__getExtensionPoints3rSet = true;
191 }
192 }
193 return getExtensionPoints3r;
194 }
195
196
197
198
199
200 protected abstract Collection handleGetExtensionPoints();
201
202
203
204
205
206 public final ActivityGraphFacade getFirstActivityGraph()
207 {
208 ActivityGraphFacade getFirstActivityGraph4r = null;
209
210 Object result = handleGetFirstActivityGraph();
211 MetafacadeBase shieldedResult = this.shieldedElement(result);
212 try
213 {
214 getFirstActivityGraph4r = (ActivityGraphFacade)shieldedResult;
215 }
216 catch (ClassCastException ex)
217 {
218
219 UseCaseFacadeLogic.logger.warn("incorrect metafacade cast for UseCaseFacadeLogic.getFirstActivityGraph ActivityGraphFacade " + result + ": " + shieldedResult);
220 }
221
222 return getFirstActivityGraph4r;
223 }
224
225
226
227
228
229 protected abstract Object handleGetFirstActivityGraph();
230
231
232
233
234
235 @Override
236 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
237 {
238 super.validateInvariants(validationMessages);
239 }
240 }