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