1 // license-header java merge-point
2 //
3 // Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
4 //
5 package org.andromda.cartridges.hibernate.metafacades;
6
7 import java.util.Collection;
8 import java.util.List;
9 import org.andromda.core.common.Introspector;
10 import org.andromda.core.metafacade.MetafacadeBase;
11 import org.andromda.core.metafacade.MetafacadeFactory;
12 import org.andromda.core.metafacade.ModelValidationMessage;
13 import org.andromda.metafacades.uml.AssociationEndFacade;
14 import org.andromda.metafacades.uml.AttributeFacade;
15 import org.andromda.metafacades.uml.ClassifierFacade;
16 import org.andromda.metafacades.uml.ConstraintFacade;
17 import org.andromda.metafacades.uml.DependencyFacade;
18 import org.andromda.metafacades.uml.GeneralizableElementFacade;
19 import org.andromda.metafacades.uml.GeneralizationFacade;
20 import org.andromda.metafacades.uml.ModelElementFacade;
21 import org.andromda.metafacades.uml.ModelFacade;
22 import org.andromda.metafacades.uml.OperationFacade;
23 import org.andromda.metafacades.uml.PackageFacade;
24 import org.andromda.metafacades.uml.StateMachineFacade;
25 import org.andromda.metafacades.uml.StereotypeFacade;
26 import org.andromda.metafacades.uml.TaggedValueFacade;
27 import org.andromda.metafacades.uml.TemplateParameterFacade;
28 import org.andromda.metafacades.uml.TypeMappings;
29
30 /**
31 * Represents an embedded object, a part of an entity. It behaves a lot like a HibernateEntity, has
32 * Attributes of type HibernateEntityAttribute, has BusinessOperations, but has no own identity.
33 * Most of the HibernateEntity templates are also used for this metafacade.
34 * MetafacadeLogic for HibernateEmbeddedValue
35 *
36 * @see HibernateEmbeddedValue
37 */
38 public abstract class HibernateEmbeddedValueLogic
39 extends MetafacadeBase
40 implements HibernateEmbeddedValue
41 {
42 /**
43 * The underlying UML object
44 * @see Object
45 */
46 protected Object metaObject;
47
48 /** Create Metafacade implementation instance using the MetafacadeFactory from the context
49 * @param metaObjectIn
50 * @param context
51 */
52 protected HibernateEmbeddedValueLogic(Object metaObjectIn, String context)
53 {
54 super(metaObjectIn, getContext(context));
55 this.superClassifierFacade =
56 (ClassifierFacade)
57 MetafacadeFactory.getInstance().createFacadeImpl(
58 "org.andromda.metafacades.uml.ClassifierFacade",
59 metaObjectIn,
60 getContext(context));
61 this.metaObject = metaObjectIn;
62 }
63
64 /**
65 * Gets the context for this metafacade logic instance.
66 * @param context String. Set to HibernateEmbeddedValue if null
67 * @return context String
68 */
69 private static String getContext(String context)
70 {
71 if (context == null)
72 {
73 context = "org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue";
74 }
75 return context;
76 }
77
78 private ClassifierFacade superClassifierFacade;
79 private boolean superClassifierFacadeInitialized = false;
80
81 /**
82 * Gets the ClassifierFacade parent instance.
83 * @return this.superClassifierFacade ClassifierFacade
84 */
85 private ClassifierFacade getSuperClassifierFacade()
86 {
87 if (!this.superClassifierFacadeInitialized)
88 {
89 ((MetafacadeBase)this.superClassifierFacade).setMetafacadeContext(this.getMetafacadeContext());
90 this.superClassifierFacadeInitialized = true;
91 }
92 return this.superClassifierFacade;
93 }
94
95 /** Reset context only for non-root metafacades
96 * @param context
97 * @see org.andromda.core.metafacade.MetafacadeBase#resetMetafacadeContext(String context)
98 */
99 @Override
100 public void resetMetafacadeContext(String context)
101 {
102 if (!this.contextRoot) // reset context only for non-root metafacades
103 {
104 context = getContext(context); // to have same value as in original constructor call
105 setMetafacadeContext (context);
106 if (this.superClassifierFacadeInitialized)
107 {
108 ((MetafacadeBase)this.superClassifierFacade).resetMetafacadeContext(context);
109 }
110 }
111 }
112
113 /**
114 * @return boolean true always
115 * @see HibernateEmbeddedValue
116 */
117 public boolean isHibernateEmbeddedValueMetaType()
118 {
119 return true;
120 }
121
122 // --------------- attributes ---------------------
123
124 /**
125 * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue#isImmutable()
126 * @return boolean
127 */
128 protected abstract boolean handleIsImmutable();
129
130 private boolean __immutable1a;
131 private boolean __immutable1aSet = false;
132
133 /**
134 * TODO: Model Documentation for
135 * org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue.immutable
136 * @return (boolean)handleIsImmutable()
137 */
138 public final boolean isImmutable()
139 {
140 boolean immutable1a = this.__immutable1a;
141 if (!this.__immutable1aSet)
142 {
143 // immutable has no pre constraints
144 immutable1a = handleIsImmutable();
145 // immutable has no post constraints
146 this.__immutable1a = immutable1a;
147 if (isMetafacadePropertyCachingEnabled())
148 {
149 this.__immutable1aSet = true;
150 }
151 }
152 return immutable1a;
153 }
154
155 /**
156 * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue#getImplementationName()
157 * @return String
158 */
159 protected abstract String handleGetImplementationName();
160
161 private String __implementationName2a;
162 private boolean __implementationName2aSet = false;
163
164 /**
165 * the name of the implementation class.
166 * @return (String)handleGetImplementationName()
167 */
168 public final String getImplementationName()
169 {
170 String implementationName2a = this.__implementationName2a;
171 if (!this.__implementationName2aSet)
172 {
173 // implementationName has no pre constraints
174 implementationName2a = handleGetImplementationName();
175 // implementationName has no post constraints
176 this.__implementationName2a = implementationName2a;
177 if (isMetafacadePropertyCachingEnabled())
178 {
179 this.__implementationName2aSet = true;
180 }
181 }
182 return implementationName2a;
183 }
184
185 /**
186 * @return true
187 * @see ClassifierFacade
188 */
189 public boolean isClassifierFacadeMetaType()
190 {
191 return true;
192 }
193
194 /**
195 * @return true
196 * @see GeneralizableElementFacade
197 */
198 public boolean isGeneralizableElementFacadeMetaType()
199 {
200 return true;
201 }
202
203 /**
204 * @return true
205 * @see ModelElementFacade
206 */
207 public boolean isModelElementFacadeMetaType()
208 {
209 return true;
210 }
211
212 // ----------- delegates to ClassifierFacade ------------
213 /**
214 * Return the attribute which name matches the parameter
215 * @see ClassifierFacade#findAttribute(String name)
216 */
217 public AttributeFacade findAttribute(String name)
218 {
219 return this.getSuperClassifierFacade().findAttribute(name);
220 }
221
222 /**
223 * Those abstraction dependencies for which this classifier is the client.
224 * @see ClassifierFacade#getAbstractions()
225 */
226 public Collection<ClassifierFacade> getAbstractions()
227 {
228 return this.getSuperClassifierFacade().getAbstractions();
229 }
230
231 /**
232 * Lists all classes associated to this one and any ancestor classes (through generalization).
233 * There will be no duplicates. The order of the elements is predictable.
234 * @see ClassifierFacade#getAllAssociatedClasses()
235 */
236 public Collection<ClassifierFacade> getAllAssociatedClasses()
237 {
238 return this.getSuperClassifierFacade().getAllAssociatedClasses();
239 }
240
241 /**
242 * A collection containing all 'properties' of the classifier and its ancestors. Properties are
243 * any attributes and navigable connecting association ends.
244 * @see ClassifierFacade#getAllProperties()
245 */
246 public Collection<ModelElementFacade> getAllProperties()
247 {
248 return this.getSuperClassifierFacade().getAllProperties();
249 }
250
251 /**
252 * A collection containing all required and/or read-only 'properties' of the classifier and its
253 * ancestors. Properties are any attributes and navigable connecting association ends.
254 * @see ClassifierFacade#getAllRequiredConstructorParameters()
255 */
256 public Collection<ModelElementFacade> getAllRequiredConstructorParameters()
257 {
258 return this.getSuperClassifierFacade().getAllRequiredConstructorParameters();
259 }
260
261 /**
262 * Gets the array type for this classifier. If this classifier already represents an array, it
263 * just returns itself.
264 * @see ClassifierFacade#getArray()
265 */
266 public ClassifierFacade getArray()
267 {
268 return this.getSuperClassifierFacade().getArray();
269 }
270
271 /**
272 * The name of the classifier as an array.
273 * @see ClassifierFacade#getArrayName()
274 */
275 public String getArrayName()
276 {
277 return this.getSuperClassifierFacade().getArrayName();
278 }
279
280 /**
281 * Lists the classes associated to this one, there is no repitition of classes. The order of the
282 * elements is predictable.
283 * @see ClassifierFacade#getAssociatedClasses()
284 */
285 public Collection<ClassifierFacade> getAssociatedClasses()
286 {
287 return this.getSuperClassifierFacade().getAssociatedClasses();
288 }
289
290 /**
291 * Gets the association ends belonging to a classifier.
292 * @see ClassifierFacade#getAssociationEnds()
293 */
294 public List<AssociationEndFacade> getAssociationEnds()
295 {
296 return this.getSuperClassifierFacade().getAssociationEnds();
297 }
298
299 /**
300 * Gets the attributes that belong to the classifier.
301 * @see ClassifierFacade#getAttributes()
302 */
303 public List<AttributeFacade> getAttributes()
304 {
305 return this.getSuperClassifierFacade().getAttributes();
306 }
307
308 /**
309 * Gets all attributes for the classifier and if 'follow' is true goes up the inheritance
310 * hierarchy and gets the attributes from the super classes as well.
311 * @see ClassifierFacade#getAttributes(boolean follow)
312 */
313 public List<AttributeFacade> getAttributes(boolean follow)
314 {
315 return this.getSuperClassifierFacade().getAttributes(follow);
316 }
317
318 /**
319 * The fully qualified name of the classifier as an array.
320 * @see ClassifierFacade#getFullyQualifiedArrayName()
321 */
322 public String getFullyQualifiedArrayName()
323 {
324 return this.getSuperClassifierFacade().getFullyQualifiedArrayName();
325 }
326
327 /**
328 * Returns all those operations that could be implemented at this classifier's level. This means
329 * the operations owned by this classifier as well as any realized interface's operations
330 * (recursively) in case this classifier itself is not already an interface, or generalized when
331 * this classifier is an interface.
332 * @see ClassifierFacade#getImplementationOperations()
333 */
334 public Collection<OperationFacade> getImplementationOperations()
335 {
336 return this.getSuperClassifierFacade().getImplementationOperations();
337 }
338
339 /**
340 * A comma separated list of the fully qualified names of all implemented interfaces.
341 * @see ClassifierFacade#getImplementedInterfaceList()
342 */
343 public String getImplementedInterfaceList()
344 {
345 return this.getSuperClassifierFacade().getImplementedInterfaceList();
346 }
347
348 /**
349 * Those attributes that are scoped to an instance of this class.
350 * @see ClassifierFacade#getInstanceAttributes()
351 */
352 public Collection<AttributeFacade> getInstanceAttributes()
353 {
354 return this.getSuperClassifierFacade().getInstanceAttributes();
355 }
356
357 /**
358 * Those operations that are scoped to an instance of this class.
359 * @see ClassifierFacade#getInstanceOperations()
360 */
361 public List<OperationFacade> getInstanceOperations()
362 {
363 return this.getSuperClassifierFacade().getInstanceOperations();
364 }
365
366 /**
367 * Those interfaces that are abstractions of this classifier, this basically means this
368 * classifier realizes them.
369 * @see ClassifierFacade#getInterfaceAbstractions()
370 */
371 public Collection<ClassifierFacade> getInterfaceAbstractions()
372 {
373 return this.getSuperClassifierFacade().getInterfaceAbstractions();
374 }
375
376 /**
377 * A String representing a new Constructor declaration for this classifier type to be used in a
378 * Java environment.
379 * @see ClassifierFacade#getJavaNewString()
380 */
381 public String getJavaNewString()
382 {
383 return this.getSuperClassifierFacade().getJavaNewString();
384 }
385
386 /**
387 * A String representing the null-value for this classifier type to be used in a Java
388 * environment.
389 * @see ClassifierFacade#getJavaNullString()
390 */
391 public String getJavaNullString()
392 {
393 return this.getSuperClassifierFacade().getJavaNullString();
394 }
395
396 /**
397 * The other ends of this classifier's association ends which are navigable.
398 * @see ClassifierFacade#getNavigableConnectingEnds()
399 */
400 public Collection<AssociationEndFacade> getNavigableConnectingEnds()
401 {
402 return this.getSuperClassifierFacade().getNavigableConnectingEnds();
403 }
404
405 /**
406 * Get the other ends of this classifier's association ends which are navigable and if 'follow'
407 * is true goes up the inheritance hierarchy and gets the super association ends as well.
408 * @see ClassifierFacade#getNavigableConnectingEnds(boolean follow)
409 */
410 public List<AssociationEndFacade> getNavigableConnectingEnds(boolean follow)
411 {
412 return this.getSuperClassifierFacade().getNavigableConnectingEnds(follow);
413 }
414
415 /**
416 * Assuming that the classifier is an array, this will return the non array type of the
417 * classifier from
418 * the model. If the classifier is NOT an array, it will just return itself.
419 * @see ClassifierFacade#getNonArray()
420 */
421 public ClassifierFacade getNonArray()
422 {
423 return this.getSuperClassifierFacade().getNonArray();
424 }
425
426 /**
427 * The attributes from this classifier in the form of an operation call (this example would be
428 * in Java): '(String attributeOne, String attributeTwo). If there were no attributes on the
429 * classifier, the result would be an empty '()'.
430 * @see ClassifierFacade#getOperationCallFromAttributes()
431 */
432 public String getOperationCallFromAttributes()
433 {
434 return this.getSuperClassifierFacade().getOperationCallFromAttributes();
435 }
436
437 /**
438 * The operations owned by this classifier.
439 * @see ClassifierFacade#getOperations()
440 */
441 public List<OperationFacade> getOperations()
442 {
443 return this.getSuperClassifierFacade().getOperations();
444 }
445
446 /**
447 * A collection containing all 'properties' of the classifier. Properties are any attributes
448 * and navigable connecting association ends.
449 * @see ClassifierFacade#getProperties()
450 */
451 public List<ModelElementFacade> getProperties()
452 {
453 return this.getSuperClassifierFacade().getProperties();
454 }
455
456 /**
457 * Gets all properties (attributes and navigable association ends) for the classifier and if
458 * 'follow' is true goes up the inheritance hierarchy and gets the properties from the super
459 * classes as well.
460 * @see ClassifierFacade#getProperties(boolean follow)
461 */
462 public List getProperties(boolean follow)
463 {
464 return this.getSuperClassifierFacade().getProperties(follow);
465 }
466
467 /**
468 * A collection containing all required and/or read-only 'properties' of the classifier.
469 * Properties are any attributes and navigable connecting association ends.
470 * @see ClassifierFacade#getRequiredConstructorParameters()
471 */
472 public Collection<ModelElementFacade> getRequiredConstructorParameters()
473 {
474 return this.getSuperClassifierFacade().getRequiredConstructorParameters();
475 }
476
477 /**
478 * Returns the serial version UID of the underlying model element.
479 * @see ClassifierFacade#getSerialVersionUID()
480 */
481 public long getSerialVersionUID()
482 {
483 return this.getSuperClassifierFacade().getSerialVersionUID();
484 }
485
486 /**
487 * Those attributes that are scoped to the definition of this class.
488 * @see ClassifierFacade#getStaticAttributes()
489 */
490 public Collection<AttributeFacade> getStaticAttributes()
491 {
492 return this.getSuperClassifierFacade().getStaticAttributes();
493 }
494
495 /**
496 * Those operations that are scoped to the definition of this class.
497 * @see ClassifierFacade#getStaticOperations()
498 */
499 public List<OperationFacade> getStaticOperations()
500 {
501 return this.getSuperClassifierFacade().getStaticOperations();
502 }
503
504 /**
505 * This class' superclass, returns the generalization if it is a ClassifierFacade, null
506 * otherwise.
507 * @see ClassifierFacade#getSuperClass()
508 */
509 public ClassifierFacade getSuperClass()
510 {
511 return this.getSuperClassifierFacade().getSuperClass();
512 }
513
514 /**
515 * The wrapper name for this classifier if a mapped type has a defined wrapper class (ie. 'long'
516 * maps to 'Long'). If the classifier doesn't have a wrapper defined for it, this method will
517 * return a null. Note that wrapper mappings must be defined for the namespace by defining the
518 * 'wrapperMappingsUri', this property must point to the location of the mappings file which
519 * maps the primitives to wrapper types.
520 * @see ClassifierFacade#getWrapperName()
521 */
522 public String getWrapperName()
523 {
524 return this.getSuperClassifierFacade().getWrapperName();
525 }
526
527 /**
528 * Indicates if this classifier is 'abstract'.
529 * @see ClassifierFacade#isAbstract()
530 */
531 public boolean isAbstract()
532 {
533 return this.getSuperClassifierFacade().isAbstract();
534 }
535
536 /**
537 * True if this classifier represents an array type. False otherwise.
538 * @see ClassifierFacade#isArrayType()
539 */
540 public boolean isArrayType()
541 {
542 return this.getSuperClassifierFacade().isArrayType();
543 }
544
545 /**
546 * True if the ClassifierFacade is an AssociationClass.
547 * @see ClassifierFacade#isAssociationClass()
548 */
549 public boolean isAssociationClass()
550 {
551 return this.getSuperClassifierFacade().isAssociationClass();
552 }
553
554 /**
555 * Returns true if this type represents a Blob type.
556 * @see ClassifierFacade#isBlobType()
557 */
558 public boolean isBlobType()
559 {
560 return this.getSuperClassifierFacade().isBlobType();
561 }
562
563 /**
564 * Indicates if this type represents a boolean type or not.
565 * @see ClassifierFacade#isBooleanType()
566 */
567 public boolean isBooleanType()
568 {
569 return this.getSuperClassifierFacade().isBooleanType();
570 }
571
572 /**
573 * Indicates if this type represents a char, Character, or java.lang.Character type or not.
574 * @see ClassifierFacade#isCharacterType()
575 */
576 public boolean isCharacterType()
577 {
578 return this.getSuperClassifierFacade().isCharacterType();
579 }
580
581 /**
582 * Returns true if this type represents a Clob type.
583 * @see ClassifierFacade#isClobType()
584 */
585 public boolean isClobType()
586 {
587 return this.getSuperClassifierFacade().isClobType();
588 }
589
590 /**
591 * True if this classifier represents a collection type. False otherwise.
592 * @see ClassifierFacade#isCollectionType()
593 */
594 public boolean isCollectionType()
595 {
596 return this.getSuperClassifierFacade().isCollectionType();
597 }
598
599 /**
600 * True/false depending on whether or not this classifier represents a datatype. A data type is
601 * a type whose instances are identified only by their value. A data type may contain attributes
602 * to support the modeling of structured data types.
603 * @see ClassifierFacade#isDataType()
604 */
605 public boolean isDataType()
606 {
607 return this.getSuperClassifierFacade().isDataType();
608 }
609
610 /**
611 * True when this classifier is a date type.
612 * @see ClassifierFacade#isDateType()
613 */
614 public boolean isDateType()
615 {
616 return this.getSuperClassifierFacade().isDateType();
617 }
618
619 /**
620 * Indicates if this type represents a Double type or not.
621 * @see ClassifierFacade#isDoubleType()
622 */
623 public boolean isDoubleType()
624 {
625 return this.getSuperClassifierFacade().isDoubleType();
626 }
627
628 /**
629 * Indicates whether or not this classifier represents an "EmbeddedValue'.
630 * @see ClassifierFacade#isEmbeddedValue()
631 */
632 public boolean isEmbeddedValue()
633 {
634 return this.getSuperClassifierFacade().isEmbeddedValue();
635 }
636
637 /**
638 * True if this classifier is in fact marked as an enumeration.
639 * @see ClassifierFacade#isEnumeration()
640 */
641 public boolean isEnumeration()
642 {
643 return this.getSuperClassifierFacade().isEnumeration();
644 }
645
646 /**
647 * Returns true if this type represents a 'file' type.
648 * @see ClassifierFacade#isFileType()
649 */
650 public boolean isFileType()
651 {
652 return this.getSuperClassifierFacade().isFileType();
653 }
654
655 /**
656 * Indicates if this type represents a Float type or not.
657 * @see ClassifierFacade#isFloatType()
658 */
659 public boolean isFloatType()
660 {
661 return this.getSuperClassifierFacade().isFloatType();
662 }
663
664 /**
665 * Indicates if this type represents an int or Integer or java.lang.Integer type or not.
666 * @see ClassifierFacade#isIntegerType()
667 */
668 public boolean isIntegerType()
669 {
670 return this.getSuperClassifierFacade().isIntegerType();
671 }
672
673 /**
674 * True/false depending on whether or not this Classifier represents an interface.
675 * @see ClassifierFacade#isInterface()
676 */
677 public boolean isInterface()
678 {
679 return this.getSuperClassifierFacade().isInterface();
680 }
681
682 /**
683 * True if this classifier cannot be extended and represent a leaf in the inheritance tree.
684 * @see ClassifierFacade#isLeaf()
685 */
686 public boolean isLeaf()
687 {
688 return this.getSuperClassifierFacade().isLeaf();
689 }
690
691 /**
692 * True if this classifier represents a list type. False otherwise.
693 * @see ClassifierFacade#isListType()
694 */
695 public boolean isListType()
696 {
697 return this.getSuperClassifierFacade().isListType();
698 }
699
700 /**
701 * Indicates if this type represents a Long type or not.
702 * @see ClassifierFacade#isLongType()
703 */
704 public boolean isLongType()
705 {
706 return this.getSuperClassifierFacade().isLongType();
707 }
708
709 /**
710 * Indicates whether or not this classifier represents a Map type.
711 * @see ClassifierFacade#isMapType()
712 */
713 public boolean isMapType()
714 {
715 return this.getSuperClassifierFacade().isMapType();
716 }
717
718 /**
719 * Indicates whether or not this classifier represents a primitive type.
720 * @see ClassifierFacade#isPrimitive()
721 */
722 public boolean isPrimitive()
723 {
724 return this.getSuperClassifierFacade().isPrimitive();
725 }
726
727 /**
728 * True if this classifier represents a set type. False otherwise.
729 * @see ClassifierFacade#isSetType()
730 */
731 public boolean isSetType()
732 {
733 return this.getSuperClassifierFacade().isSetType();
734 }
735
736 /**
737 * Indicates whether or not this classifier represents a string type.
738 * @see ClassifierFacade#isStringType()
739 */
740 public boolean isStringType()
741 {
742 return this.getSuperClassifierFacade().isStringType();
743 }
744
745 /**
746 * Indicates whether or not this classifier represents a time type.
747 * @see ClassifierFacade#isTimeType()
748 */
749 public boolean isTimeType()
750 {
751 return this.getSuperClassifierFacade().isTimeType();
752 }
753
754 /**
755 * Returns true if this type is a wrapped primitive type.
756 * @see ClassifierFacade#isWrappedPrimitive()
757 */
758 public boolean isWrappedPrimitive()
759 {
760 return this.getSuperClassifierFacade().isWrappedPrimitive();
761 }
762
763 /**
764 * Finds the tagged value optional searching the entire inheritance hierarchy if 'follow' is set
765 * to true.
766 * @see GeneralizableElementFacade#findTaggedValue(String tagName, boolean follow)
767 */
768 public Object findTaggedValue(String tagName, boolean follow)
769 {
770 return this.getSuperClassifierFacade().findTaggedValue(tagName, follow);
771 }
772
773 /**
774 * All generalizations for this generalizable element, goes up the inheritance tree.
775 * @see GeneralizableElementFacade#getAllGeneralizations()
776 */
777 public Collection<GeneralizableElementFacade> getAllGeneralizations()
778 {
779 return this.getSuperClassifierFacade().getAllGeneralizations();
780 }
781
782 /**
783 * All specializations (travels down the inheritance hierarchy).
784 * @see GeneralizableElementFacade#getAllSpecializations()
785 */
786 public Collection<GeneralizableElementFacade> getAllSpecializations()
787 {
788 return this.getSuperClassifierFacade().getAllSpecializations();
789 }
790
791 /**
792 * Gets the direct generalization for this generalizable element.
793 * @see GeneralizableElementFacade#getGeneralization()
794 */
795 public GeneralizableElementFacade getGeneralization()
796 {
797 return this.getSuperClassifierFacade().getGeneralization();
798 }
799
800 /**
801 * Gets the actual links that this generalization element is part of (it plays either the
802 * specialization or generalization).
803 * @see GeneralizableElementFacade#getGeneralizationLinks()
804 */
805 public Collection<GeneralizationFacade> getGeneralizationLinks()
806 {
807 return this.getSuperClassifierFacade().getGeneralizationLinks();
808 }
809
810 /**
811 * A comma separated list of the fully qualified names of all generalizations.
812 * @see GeneralizableElementFacade#getGeneralizationList()
813 */
814 public String getGeneralizationList()
815 {
816 return this.getSuperClassifierFacade().getGeneralizationList();
817 }
818
819 /**
820 * The element found when you recursively follow the generalization path up to the root. If an
821 * element has no generalization itself will be considered the root.
822 * @see GeneralizableElementFacade#getGeneralizationRoot()
823 */
824 public GeneralizableElementFacade getGeneralizationRoot()
825 {
826 return this.getSuperClassifierFacade().getGeneralizationRoot();
827 }
828
829 /**
830 * Return all generalizations (ancestors) from this generalizable element.
831 * @see GeneralizableElementFacade#getGeneralizations()
832 */
833 public Collection<GeneralizableElementFacade> getGeneralizations()
834 {
835 return this.getSuperClassifierFacade().getGeneralizations();
836 }
837
838 /**
839 * Gets the direct specializations (i.e. sub elements) for this generalizatble element.
840 * @see GeneralizableElementFacade#getSpecializations()
841 */
842 public Collection<GeneralizableElementFacade> getSpecializations()
843 {
844 return this.getSuperClassifierFacade().getSpecializations();
845 }
846
847 /**
848 * Copies all tagged values from the given ModelElementFacade to this model element facade.
849 * @see ModelElementFacade#copyTaggedValues(ModelElementFacade element)
850 */
851 public void copyTaggedValues(ModelElementFacade element)
852 {
853 this.getSuperClassifierFacade().copyTaggedValues(element);
854 }
855
856 /**
857 * Finds the tagged value with the specified 'tagName'. In case there are more values the first
858 * one found will be returned.
859 * @see ModelElementFacade#findTaggedValue(String tagName)
860 */
861 public Object findTaggedValue(String tagName)
862 {
863 return this.getSuperClassifierFacade().findTaggedValue(tagName);
864 }
865
866 /**
867 * Returns all the values for the tagged value with the specified name. The returned collection
868 * will contains only String instances, or will be empty. Never null.
869 * @see ModelElementFacade#findTaggedValues(String tagName)
870 */
871 public Collection<Object> findTaggedValues(String tagName)
872 {
873 return this.getSuperClassifierFacade().findTaggedValues(tagName);
874 }
875
876 /**
877 * Returns the fully qualified name of the model element. The fully qualified name includes
878 * complete package qualified name of the underlying model element. The templates parameter will
879 * be replaced by the correct one given the binding relation of the parameter to this element.
880 * @see ModelElementFacade#getBindedFullyQualifiedName(ModelElementFacade bindedElement)
881 */
882 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
883 {
884 return this.getSuperClassifierFacade().getBindedFullyQualifiedName(bindedElement);
885 }
886
887 /**
888 * Gets all constraints belonging to the model element.
889 * @see ModelElementFacade#getConstraints()
890 */
891 public Collection<ConstraintFacade> getConstraints()
892 {
893 return this.getSuperClassifierFacade().getConstraints();
894 }
895
896 /**
897 * Returns the constraints of the argument kind that have been placed onto this model. Typical
898 * kinds are "inv", "pre" and "post". Other kinds are possible.
899 * @see ModelElementFacade#getConstraints(String kind)
900 */
901 public Collection<ConstraintFacade> getConstraints(String kind)
902 {
903 return this.getSuperClassifierFacade().getConstraints(kind);
904 }
905
906 /**
907 * Gets the documentation for the model element, The indent argument is prefixed to each line.
908 * By default this method wraps lines after 64 characters.
909 * This method is equivalent to <code>getDocumentation(indent, 64)</code>.
910 * @see ModelElementFacade#getDocumentation(String indent)
911 */
912 public String getDocumentation(String indent)
913 {
914 return this.getSuperClassifierFacade().getDocumentation(indent);
915 }
916
917 /**
918 * This method returns the documentation for this model element, with the lines wrapped after
919 * the specified number of characters, values of less than 1 will indicate no line wrapping is
920 * required. By default paragraphs are returned as HTML.
921 * This method is equivalent to <code>getDocumentation(indent, lineLength, true)</code>.
922 * @see ModelElementFacade#getDocumentation(String indent, int lineLength)
923 */
924 public String getDocumentation(String indent, int lineLength)
925 {
926 return this.getSuperClassifierFacade().getDocumentation(indent, lineLength);
927 }
928
929 /**
930 * This method returns the documentation for this model element, with the lines wrapped after
931 * the specified number of characters, values of less than 1 will indicate no line wrapping is
932 * required. HTML style determines if HTML Escaping is applied.
933 * @see ModelElementFacade#getDocumentation(String indent, int lineLength, boolean htmlStyle)
934 */
935 public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
936 {
937 return this.getSuperClassifierFacade().getDocumentation(indent, lineLength, htmlStyle);
938 }
939
940 /**
941 * The fully qualified name of this model element.
942 * @see ModelElementFacade#getFullyQualifiedName()
943 */
944 public String getFullyQualifiedName()
945 {
946 return this.getSuperClassifierFacade().getFullyQualifiedName();
947 }
948
949 /**
950 * Returns the fully qualified name of the model element. The fully qualified name includes
951 * complete package qualified name of the underlying model element. If modelName is true, then
952 * the original name of the model element (the name contained within the model) will be the name
953 * returned, otherwise a name from a language mapping will be returned.
954 * @see ModelElementFacade#getFullyQualifiedName(boolean modelName)
955 */
956 public String getFullyQualifiedName(boolean modelName)
957 {
958 return this.getSuperClassifierFacade().getFullyQualifiedName(modelName);
959 }
960
961 /**
962 * Returns the fully qualified name as a path, the returned value always starts with out a slash
963 * '/'.
964 * @see ModelElementFacade#getFullyQualifiedNamePath()
965 */
966 public String getFullyQualifiedNamePath()
967 {
968 return this.getSuperClassifierFacade().getFullyQualifiedNamePath();
969 }
970
971 /**
972 * Gets the unique identifier of the underlying model element.
973 * @see ModelElementFacade#getId()
974 */
975 public String getId()
976 {
977 return this.getSuperClassifierFacade().getId();
978 }
979
980 /**
981 * UML2: Retrieves the keywords for this element. Used to modify implementation properties which
982 * are not represented by other properties, i.e. native, transient, volatile, synchronized,
983 * (added annotations) override, deprecated. Can also be used to suppress compiler warnings:
984 * (added annotations) unchecked, fallthrough, path, serial, finally, all. Annotations require
985 * JDK5 compiler level.
986 * @see ModelElementFacade#getKeywords()
987 */
988 public Collection<String> getKeywords()
989 {
990 return this.getSuperClassifierFacade().getKeywords();
991 }
992
993 /**
994 * UML2: Retrieves a localized label for this named element.
995 * @see ModelElementFacade#getLabel()
996 */
997 public String getLabel()
998 {
999 return this.getSuperClassifierFacade().getLabel();
1000 }
1001
1002 /**
1003 * The language mappings that have been set for this model element.
1004 * @see ModelElementFacade#getLanguageMappings()
1005 */
1006 public TypeMappings getLanguageMappings()
1007 {
1008 return this.getSuperClassifierFacade().getLanguageMappings();
1009 }
1010
1011 /**
1012 * Return the model containing this model element (multiple models may be loaded and processed
1013 * at the same time).
1014 * @see ModelElementFacade#getModel()
1015 */
1016 public ModelFacade getModel()
1017 {
1018 return this.getSuperClassifierFacade().getModel();
1019 }
1020
1021 /**
1022 * The name of the model element.
1023 * @see ModelElementFacade#getName()
1024 */
1025 public String getName()
1026 {
1027 return this.getSuperClassifierFacade().getName();
1028 }
1029
1030 /**
1031 * Gets the package to which this model element belongs.
1032 * @see ModelElementFacade#getPackage()
1033 */
1034 public ModelElementFacade getPackage()
1035 {
1036 return this.getSuperClassifierFacade().getPackage();
1037 }
1038
1039 /**
1040 * The name of this model element's package.
1041 * @see ModelElementFacade#getPackageName()
1042 */
1043 public String getPackageName()
1044 {
1045 return this.getSuperClassifierFacade().getPackageName();
1046 }
1047
1048 /**
1049 * Gets the package name (optionally providing the ability to retrieve the model name and not
1050 * the mapped name).
1051 * @see ModelElementFacade#getPackageName(boolean modelName)
1052 */
1053 public String getPackageName(boolean modelName)
1054 {
1055 return this.getSuperClassifierFacade().getPackageName(modelName);
1056 }
1057
1058 /**
1059 * Returns the package as a path, the returned value always starts with out a slash '/'.
1060 * @see ModelElementFacade#getPackagePath()
1061 */
1062 public String getPackagePath()
1063 {
1064 return this.getSuperClassifierFacade().getPackagePath();
1065 }
1066
1067 /**
1068 * UML2: Returns the value of the 'Qualified Name' attribute. A name which allows the
1069 * NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from
1070 * the names of the containing namespaces starting at the root of the hierarchy and ending with
1071 * the name of the NamedElement itself.
1072 * @see ModelElementFacade#getQualifiedName()
1073 */
1074 public String getQualifiedName()
1075 {
1076 return this.getSuperClassifierFacade().getQualifiedName();
1077 }
1078
1079 /**
1080 * Gets the root package for the model element.
1081 * @see ModelElementFacade#getRootPackage()
1082 */
1083 public PackageFacade getRootPackage()
1084 {
1085 return this.getSuperClassifierFacade().getRootPackage();
1086 }
1087
1088 /**
1089 * Gets the dependencies for which this model element is the source.
1090 * @see ModelElementFacade#getSourceDependencies()
1091 */
1092 public Collection<DependencyFacade> getSourceDependencies()
1093 {
1094 return this.getSuperClassifierFacade().getSourceDependencies();
1095 }
1096
1097 /**
1098 * If this model element is the context of an activity graph, this represents that activity
1099 * graph.
1100 * @see ModelElementFacade#getStateMachineContext()
1101 */
1102 public StateMachineFacade getStateMachineContext()
1103 {
1104 return this.getSuperClassifierFacade().getStateMachineContext();
1105 }
1106
1107 /**
1108 * The collection of ALL stereotype names for this model element.
1109 * @see ModelElementFacade#getStereotypeNames()
1110 */
1111 public Collection<String> getStereotypeNames()
1112 {
1113 return this.getSuperClassifierFacade().getStereotypeNames();
1114 }
1115
1116 /**
1117 * Gets all stereotypes for this model element.
1118 * @see ModelElementFacade#getStereotypes()
1119 */
1120 public Collection<StereotypeFacade> getStereotypes()
1121 {
1122 return this.getSuperClassifierFacade().getStereotypes();
1123 }
1124
1125 /**
1126 * Return the TaggedValues associated with this model element, under all stereotypes.
1127 * @see ModelElementFacade#getTaggedValues()
1128 */
1129 public Collection<TaggedValueFacade> getTaggedValues()
1130 {
1131 return this.getSuperClassifierFacade().getTaggedValues();
1132 }
1133
1134 /**
1135 * Gets the dependencies for which this model element is the target.
1136 * @see ModelElementFacade#getTargetDependencies()
1137 */
1138 public Collection<DependencyFacade> getTargetDependencies()
1139 {
1140 return this.getSuperClassifierFacade().getTargetDependencies();
1141 }
1142
1143 /**
1144 * Get the template parameter for this model element having the parameterName
1145 * @see ModelElementFacade#getTemplateParameter(String parameterName)
1146 */
1147 public Object getTemplateParameter(String parameterName)
1148 {
1149 return this.getSuperClassifierFacade().getTemplateParameter(parameterName);
1150 }
1151
1152 /**
1153 * Get the template parameters for this model element
1154 * @see ModelElementFacade#getTemplateParameters()
1155 */
1156 public Collection<TemplateParameterFacade> getTemplateParameters()
1157 {
1158 return this.getSuperClassifierFacade().getTemplateParameters();
1159 }
1160
1161 /**
1162 * The visibility (i.e. public, private, protected or package) of the model element, will
1163 * attempt a lookup for these values in the language mappings (if any).
1164 * @see ModelElementFacade#getVisibility()
1165 */
1166 public String getVisibility()
1167 {
1168 return this.getSuperClassifierFacade().getVisibility();
1169 }
1170
1171 /**
1172 * Returns true if the model element has the exact stereotype (meaning no stereotype inheritance
1173 * is taken into account when searching for the stereotype), false otherwise.
1174 * @see ModelElementFacade#hasExactStereotype(String stereotypeName)
1175 */
1176 public boolean hasExactStereotype(String stereotypeName)
1177 {
1178 return this.getSuperClassifierFacade().hasExactStereotype(stereotypeName);
1179 }
1180
1181 /**
1182 * Does the UML Element contain the named Keyword? Keywords can be separated by space, comma,
1183 * pipe, semicolon, or << >>
1184 * @see ModelElementFacade#hasKeyword(String keywordName)
1185 */
1186 public boolean hasKeyword(String keywordName)
1187 {
1188 return this.getSuperClassifierFacade().hasKeyword(keywordName);
1189 }
1190
1191 /**
1192 * Returns true if the model element has the specified stereotype. If the stereotype itself
1193 * does not match, then a search will be made up the stereotype inheritance hierarchy, and if
1194 * one of the stereotype's ancestors has a matching name this method will return true, false
1195 * otherwise.
1196 * For example, if we have a certain stereotype called <<exception>> and a model element has a
1197 * stereotype called <<applicationException>> which extends <<exception>>, when calling this
1198 * method with 'stereotypeName' defined as 'exception' the method would return true since
1199 * <<applicationException>> inherits from <<exception>>. If you want to check if the model
1200 * element has the exact stereotype, then use the method 'hasExactStereotype' instead.
1201 * @see ModelElementFacade#hasStereotype(String stereotypeName)
1202 */
1203 public boolean hasStereotype(String stereotypeName)
1204 {
1205 return this.getSuperClassifierFacade().hasStereotype(stereotypeName);
1206 }
1207
1208 /**
1209 * True if there are target dependencies from this element that are instances of BindingFacade.
1210 * Deprecated in UML2: Use TemplateBinding parameters instead of dependencies.
1211 * @see ModelElementFacade#isBindingDependenciesPresent()
1212 */
1213 public boolean isBindingDependenciesPresent()
1214 {
1215 return this.getSuperClassifierFacade().isBindingDependenciesPresent();
1216 }
1217
1218 /**
1219 * Indicates if any constraints are present on this model element.
1220 * @see ModelElementFacade#isConstraintsPresent()
1221 */
1222 public boolean isConstraintsPresent()
1223 {
1224 return this.getSuperClassifierFacade().isConstraintsPresent();
1225 }
1226
1227 /**
1228 * Indicates if any documentation is present on this model element.
1229 * @see ModelElementFacade#isDocumentationPresent()
1230 */
1231 public boolean isDocumentationPresent()
1232 {
1233 return this.getSuperClassifierFacade().isDocumentationPresent();
1234 }
1235
1236 /**
1237 * True if this element name is a reserved word in Java, C#, ANSI or ISO C, C++, JavaScript.
1238 * @see ModelElementFacade#isReservedWord()
1239 */
1240 public boolean isReservedWord()
1241 {
1242 return this.getSuperClassifierFacade().isReservedWord();
1243 }
1244
1245 /**
1246 * True is there are template parameters on this model element. For UML2, applies to Class,
1247 * Operation, Property, and Parameter.
1248 * @see ModelElementFacade#isTemplateParametersPresent()
1249 */
1250 public boolean isTemplateParametersPresent()
1251 {
1252 return this.getSuperClassifierFacade().isTemplateParametersPresent();
1253 }
1254
1255 /**
1256 * True if this element name is a valid identifier name in Java, C#, ANSI or ISO C, C++,
1257 * JavaScript. Contains no spaces, special characters etc. Constraint always applied on
1258 * Enumerations and Interfaces, optionally applies on other model elements.
1259 * @see ModelElementFacade#isValidIdentifierName()
1260 */
1261 public boolean isValidIdentifierName()
1262 {
1263 return this.getSuperClassifierFacade().isValidIdentifierName();
1264 }
1265
1266 /**
1267 * Searches for the constraint with the specified 'name' on this model element, and if found
1268 * translates it using the specified 'translation' from a translation library discovered by the
1269 * framework.
1270 * @see ModelElementFacade#translateConstraint(String name, String translation)
1271 */
1272 public String translateConstraint(String name, String translation)
1273 {
1274 return this.getSuperClassifierFacade().translateConstraint(name, translation);
1275 }
1276
1277 /**
1278 * Translates all constraints belonging to this model element with the given 'translation'.
1279 * @see ModelElementFacade#translateConstraints(String translation)
1280 */
1281 public String[] translateConstraints(String translation)
1282 {
1283 return this.getSuperClassifierFacade().translateConstraints(translation);
1284 }
1285
1286 /**
1287 * Translates the constraints of the specified 'kind' belonging to this model element.
1288 * @see ModelElementFacade#translateConstraints(String kind, String translation)
1289 */
1290 public String[] translateConstraints(String kind, String translation)
1291 {
1292 return this.getSuperClassifierFacade().translateConstraints(kind, translation);
1293 }
1294
1295 /**
1296 * @see org.andromda.core.metafacade.MetafacadeBase#initialize()
1297 */
1298 @Override
1299 public void initialize()
1300 {
1301 this.getSuperClassifierFacade().initialize();
1302 }
1303
1304 /**
1305 * @return Object getSuperClassifierFacade().getValidationOwner()
1306 * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner()
1307 */
1308 @Override
1309 public Object getValidationOwner()
1310 {
1311 Object owner = this.getSuperClassifierFacade().getValidationOwner();
1312 return owner;
1313 }
1314
1315 /**
1316 * @return String getSuperClassifierFacade().getValidationName()
1317 * @see org.andromda.core.metafacade.MetafacadeBase#getValidationName()
1318 */
1319 @Override
1320 public String getValidationName()
1321 {
1322 String name = this.getSuperClassifierFacade().getValidationName();
1323 return name;
1324 }
1325
1326 /**
1327 * @param validationMessages Collection<ModelValidationMessage>
1328 * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(Collection validationMessages)
1329 */
1330 @Override
1331 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
1332 {
1333 this.getSuperClassifierFacade().validateInvariants(validationMessages);
1334 }
1335
1336 /**
1337 * The property that stores the name of the metafacade.
1338 */
1339 private static final String NAME_PROPERTY = "name";
1340 private static final String FQNAME_PROPERTY = "fullyQualifiedName";
1341
1342 /**
1343 * @see Object#toString()
1344 */
1345 @Override
1346 public String toString()
1347 {
1348 final StringBuilder toString = new StringBuilder(this.getClass().getName());
1349 toString.append("[");
1350 try
1351 {
1352 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
1353 }
1354 catch (final Throwable tryAgain)
1355 {
1356 try
1357 {
1358 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
1359 }
1360 catch (final Throwable ignore)
1361 {
1362 // - just ignore when the metafacade doesn't have a name or fullyQualifiedName property
1363 }
1364 }
1365 toString.append("]");
1366 return toString.toString();
1367 }
1368 }