1
2
3
4 package org.andromda.metafacades.uml14;
5
6 /***
7 * MetafacadeLogic for org.andromda.metafacades.uml.EntityAssociationEnd
8 *
9 * @see org.andromda.metafacades.uml.EntityAssociationEnd
10 */
11 public abstract class EntityAssociationEndLogic
12 extends org.andromda.metafacades.uml14.AssociationEndFacadeLogicImpl
13 implements org.andromda.metafacades.uml.EntityAssociationEnd
14 {
15
16 protected Object metaObject;
17
18 public EntityAssociationEndLogic(Object metaObject, String context)
19 {
20 super((org.omg.uml.foundation.core.AssociationEnd)metaObject, getContext(context));
21 this.metaObject = metaObject;
22 }
23
24 /***
25 * Gets the context for this metafacade logic instance.
26 */
27 private static String getContext(String context)
28 {
29 if (context == null)
30 {
31 context = "org.andromda.metafacades.uml.EntityAssociationEnd";
32 }
33 return context;
34 }
35
36 /***
37 * @see org.andromda.core.metafacade.MetafacadeBase
38 */
39 public void resetMetafacadeContext(String context)
40 {
41 if (!this.contextRoot)
42 {
43 context = getContext(context);
44 setMetafacadeContext (context);
45 }
46 }
47
48 /***
49 * @see org.andromda.metafacades.uml.EntityAssociationEnd
50 */
51 public boolean isEntityAssociationEndMetaType()
52 {
53 return true;
54 }
55
56
57
58 /***
59 * @see org.andromda.metafacades.uml.EntityAssociationEnd#getColumnName()
60 */
61 protected abstract java.lang.String handleGetColumnName();
62
63 private void handleGetColumnName1aPreCondition()
64 {
65 }
66
67 private void handleGetColumnName1aPostCondition()
68 {
69 }
70
71 private java.lang.String __columnName1a;
72 private boolean __columnName1aSet = false;
73
74 public final java.lang.String getColumnName()
75 {
76 java.lang.String columnName1a = this.__columnName1a;
77 if (!this.__columnName1aSet)
78 {
79 handleGetColumnName1aPreCondition();
80 columnName1a = handleGetColumnName();
81 handleGetColumnName1aPostCondition();
82 this.__columnName1a = columnName1a;
83 if (isMetafacadePropertyCachingEnabled())
84 {
85 this.__columnName1aSet = true;
86 }
87 }
88 return columnName1a;
89 }
90
91 /***
92 * @see org.andromda.metafacades.uml.EntityAssociationEnd#getForeignKeySuffix()
93 */
94 protected abstract java.lang.String handleGetForeignKeySuffix();
95
96 private void handleGetForeignKeySuffix2aPreCondition()
97 {
98 }
99
100 private void handleGetForeignKeySuffix2aPostCondition()
101 {
102 }
103
104 private java.lang.String __foreignKeySuffix2a;
105 private boolean __foreignKeySuffix2aSet = false;
106
107 public final java.lang.String getForeignKeySuffix()
108 {
109 java.lang.String foreignKeySuffix2a = this.__foreignKeySuffix2a;
110 if (!this.__foreignKeySuffix2aSet)
111 {
112 handleGetForeignKeySuffix2aPreCondition();
113 foreignKeySuffix2a = handleGetForeignKeySuffix();
114 handleGetForeignKeySuffix2aPostCondition();
115 this.__foreignKeySuffix2a = foreignKeySuffix2a;
116 if (isMetafacadePropertyCachingEnabled())
117 {
118 this.__foreignKeySuffix2aSet = true;
119 }
120 }
121 return foreignKeySuffix2a;
122 }
123
124 /***
125 * @see org.andromda.metafacades.uml.EntityAssociationEnd#isForeignIdentifier()
126 */
127 protected abstract boolean handleIsForeignIdentifier();
128
129 private void handleIsForeignIdentifier3aPreCondition()
130 {
131 }
132
133 private void handleIsForeignIdentifier3aPostCondition()
134 {
135 }
136
137 private boolean __foreignIdentifier3a;
138 private boolean __foreignIdentifier3aSet = false;
139
140 public final boolean isForeignIdentifier()
141 {
142 boolean foreignIdentifier3a = this.__foreignIdentifier3a;
143 if (!this.__foreignIdentifier3aSet)
144 {
145 handleIsForeignIdentifier3aPreCondition();
146 foreignIdentifier3a = handleIsForeignIdentifier();
147 handleIsForeignIdentifier3aPostCondition();
148 this.__foreignIdentifier3a = foreignIdentifier3a;
149 if (isMetafacadePropertyCachingEnabled())
150 {
151 this.__foreignIdentifier3aSet = true;
152 }
153 }
154 return foreignIdentifier3a;
155 }
156
157 /***
158 * @see org.andromda.metafacades.uml.EntityAssociationEnd#getForeignKeyConstraintName()
159 */
160 protected abstract java.lang.String handleGetForeignKeyConstraintName();
161
162 private void handleGetForeignKeyConstraintName4aPreCondition()
163 {
164 }
165
166 private void handleGetForeignKeyConstraintName4aPostCondition()
167 {
168 }
169
170 private java.lang.String __foreignKeyConstraintName4a;
171 private boolean __foreignKeyConstraintName4aSet = false;
172
173 public final java.lang.String getForeignKeyConstraintName()
174 {
175 java.lang.String foreignKeyConstraintName4a = this.__foreignKeyConstraintName4a;
176 if (!this.__foreignKeyConstraintName4aSet)
177 {
178 handleGetForeignKeyConstraintName4aPreCondition();
179 foreignKeyConstraintName4a = handleGetForeignKeyConstraintName();
180 handleGetForeignKeyConstraintName4aPostCondition();
181 this.__foreignKeyConstraintName4a = foreignKeyConstraintName4a;
182 if (isMetafacadePropertyCachingEnabled())
183 {
184 this.__foreignKeyConstraintName4aSet = true;
185 }
186 }
187 return foreignKeyConstraintName4a;
188 }
189
190 /***
191 * @see org.andromda.metafacades.uml.EntityAssociationEnd#getColumnIndex()
192 */
193 protected abstract java.lang.String handleGetColumnIndex();
194
195 private void handleGetColumnIndex5aPreCondition()
196 {
197 }
198
199 private void handleGetColumnIndex5aPostCondition()
200 {
201 }
202
203 private java.lang.String __columnIndex5a;
204 private boolean __columnIndex5aSet = false;
205
206 public final java.lang.String getColumnIndex()
207 {
208 java.lang.String columnIndex5a = this.__columnIndex5a;
209 if (!this.__columnIndex5aSet)
210 {
211 handleGetColumnIndex5aPreCondition();
212 columnIndex5a = handleGetColumnIndex();
213 handleGetColumnIndex5aPostCondition();
214 this.__columnIndex5a = columnIndex5a;
215 if (isMetafacadePropertyCachingEnabled())
216 {
217 this.__columnIndex5aSet = true;
218 }
219 }
220 return columnIndex5a;
221 }
222
223 /***
224 * @see org.andromda.metafacades.uml.EntityAssociationEnd#getSqlType()
225 */
226 protected abstract java.lang.String handleGetSqlType();
227
228 private void handleGetSqlType6aPreCondition()
229 {
230 }
231
232 private void handleGetSqlType6aPostCondition()
233 {
234 }
235
236 private java.lang.String __sqlType6a;
237 private boolean __sqlType6aSet = false;
238
239 public final java.lang.String getSqlType()
240 {
241 java.lang.String sqlType6a = this.__sqlType6a;
242 if (!this.__sqlType6aSet)
243 {
244 handleGetSqlType6aPreCondition();
245 sqlType6a = handleGetSqlType();
246 handleGetSqlType6aPostCondition();
247 this.__sqlType6a = sqlType6a;
248 if (isMetafacadePropertyCachingEnabled())
249 {
250 this.__sqlType6aSet = true;
251 }
252 }
253 return sqlType6a;
254 }
255
256 /***
257 * @see org.andromda.metafacades.uml.EntityAssociationEnd#isTransient()
258 */
259 protected abstract boolean handleIsTransient();
260
261 private void handleIsTransient7aPreCondition()
262 {
263 }
264
265 private void handleIsTransient7aPostCondition()
266 {
267 }
268
269 private boolean __transient7a;
270 private boolean __transient7aSet = false;
271
272 public final boolean isTransient()
273 {
274 boolean transient7a = this.__transient7a;
275 if (!this.__transient7aSet)
276 {
277 handleIsTransient7aPreCondition();
278 transient7a = handleIsTransient();
279 handleIsTransient7aPostCondition();
280 this.__transient7a = transient7a;
281 if (isMetafacadePropertyCachingEnabled())
282 {
283 this.__transient7aSet = true;
284 }
285 }
286 return transient7a;
287 }
288
289 /***
290 * @see org.andromda.metafacades.uml.EntityAssociationEnd#isIdentifiersPresent()
291 */
292 protected abstract boolean handleIsIdentifiersPresent();
293
294 private void handleIsIdentifiersPresent8aPreCondition()
295 {
296 }
297
298 private void handleIsIdentifiersPresent8aPostCondition()
299 {
300 }
301
302 private boolean __identifiersPresent8a;
303 private boolean __identifiersPresent8aSet = false;
304
305 public final boolean isIdentifiersPresent()
306 {
307 boolean identifiersPresent8a = this.__identifiersPresent8a;
308 if (!this.__identifiersPresent8aSet)
309 {
310 handleIsIdentifiersPresent8aPreCondition();
311 identifiersPresent8a = handleIsIdentifiersPresent();
312 handleIsIdentifiersPresent8aPostCondition();
313 this.__identifiersPresent8a = identifiersPresent8a;
314 if (isMetafacadePropertyCachingEnabled())
315 {
316 this.__identifiersPresent8aSet = true;
317 }
318 }
319 return identifiersPresent8a;
320 }
321
322
323
324 /***
325 * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(java.util.Collection)
326 */
327 public void validateInvariants(java.util.Collection validationMessages)
328 {
329 super.validateInvariants(validationMessages);
330 {
331 final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"foreignIdentifier"))).booleanValue()?(Boolean.valueOf(String.valueOf(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"one2One"))).booleanValue()&&Boolean.valueOf(String.valueOf(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"child"))).booleanValue()&&org.andromda.translation.ocl.validation.OCLCollections.one(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"type.associationEnds"),new org.apache.commons.collections.Predicate(){public boolean evaluate(java.lang.Object object){return Boolean.valueOf(String.valueOf(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(object,"foreignIdentifier"))).booleanValue();}})):true));
332 if (!constraintValid)
333 validationMessages.add(
334 new org.andromda.core.metafacade.ModelValidationMessage(
335 (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
336 "org::andromda::metafacades::uml::EntityAssociationEnd::valid foreign identifiers.",
337 "Only ONE association end on an entity can be flagged as having a foreign identifier at any given time. It also MUST be the child end (the other side is flagged as having composite aggregation) of a one-to-one association."));
338 }
339 }
340
341 /***
342 * The property that stores the name of the metafacade.
343 */
344 private static final String NAME_PROPERTY = "name";
345
346 /***
347 * @see java.lang.Object#toString()
348 */
349 public String toString()
350 {
351 final StringBuffer toString = new StringBuffer(this.getClass().getName());
352 toString.append("[");
353 try
354 {
355 toString.append(org.andromda.core.common.Introspector.instance().getProperty(this, NAME_PROPERTY));
356 }
357 catch (final Throwable throwable)
358 {
359
360 }
361 toString.append("]");
362 return toString.toString();
363 }
364 }