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