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