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.spring.metafacades;
6   
7   import java.util.Collection;
8   import org.andromda.core.common.Introspector;
9   import org.andromda.core.metafacade.MetafacadeBase;
10  import org.andromda.core.metafacade.MetafacadeFactory;
11  import org.andromda.core.metafacade.ModelValidationMessage;
12  import org.andromda.metafacades.uml.ClassifierFacade;
13  import org.andromda.metafacades.uml.ConstraintFacade;
14  import org.andromda.metafacades.uml.DependencyFacade;
15  import org.andromda.metafacades.uml.EntityQueryOperation;
16  import org.andromda.metafacades.uml.ModelElementFacade;
17  import org.andromda.metafacades.uml.ModelFacade;
18  import org.andromda.metafacades.uml.OperationFacade;
19  import org.andromda.metafacades.uml.PackageFacade;
20  import org.andromda.metafacades.uml.ParameterFacade;
21  import org.andromda.metafacades.uml.StateMachineFacade;
22  import org.andromda.metafacades.uml.StereotypeFacade;
23  import org.andromda.metafacades.uml.TaggedValueFacade;
24  import org.andromda.metafacades.uml.TemplateParameterFacade;
25  import org.andromda.metafacades.uml.TypeMappings;
26  import org.andromda.translation.ocl.validation.OCLCollections;
27  import org.andromda.translation.ocl.validation.OCLIntrospector;
28  import org.andromda.translation.ocl.validation.OCLResultEnsurer;
29  import org.apache.commons.collections.Predicate;
30  import org.apache.log4j.Logger;
31  
32  /**
33   * Represents a Spring entity query operation.
34   * MetafacadeLogic for SpringQueryOperation
35   *
36   * @see SpringQueryOperation
37   */
38  public abstract class SpringQueryOperationLogic
39      extends MetafacadeBase
40      implements SpringQueryOperation
41  {
42      /**
43       * The underlying UML object
44       * @see Object
45       */
46      protected Object metaObject;
47  
48      /** Create Metafacade implementation instance using the MetafacadeFactory from the context
49       * @param metaObjectIn
50       * @param context
51       */
52      protected SpringQueryOperationLogic(Object metaObjectIn, String context)
53      {
54          super(metaObjectIn, getContext(context));
55          this.superEntityQueryOperation =
56             (EntityQueryOperation)
57              MetafacadeFactory.getInstance().createFacadeImpl(
58                      "org.andromda.metafacades.uml.EntityQueryOperation",
59                      metaObjectIn,
60                      getContext(context));
61          this.metaObject = metaObjectIn;
62      }
63  
64      /**
65       * The logger instance.
66       */
67      private static final Logger logger = Logger.getLogger(SpringQueryOperationLogic.class);
68  
69      /**
70       * Gets the context for this metafacade logic instance.
71       * @param context String. Set to SpringQueryOperation if null
72       * @return context String
73       */
74      private static String getContext(String context)
75      {
76          if (context == null)
77          {
78              context = "org.andromda.cartridges.spring.metafacades.SpringQueryOperation";
79          }
80          return context;
81      }
82  
83      private EntityQueryOperation superEntityQueryOperation;
84      private boolean superEntityQueryOperationInitialized = false;
85  
86      /**
87       * Gets the EntityQueryOperation parent instance.
88       * @return this.superEntityQueryOperation EntityQueryOperation
89       */
90      private EntityQueryOperation getSuperEntityQueryOperation()
91      {
92          if (!this.superEntityQueryOperationInitialized)
93          {
94              ((MetafacadeBase)this.superEntityQueryOperation).setMetafacadeContext(this.getMetafacadeContext());
95              this.superEntityQueryOperationInitialized = true;
96          }
97          return this.superEntityQueryOperation;
98      }
99  
100     /** Reset context only for non-root metafacades
101      * @param context
102      * @see MetafacadeBase#resetMetafacadeContext(String context)
103      */
104     @Override
105     public void resetMetafacadeContext(String context)
106     {
107         if (!this.contextRoot) // reset context only for non-root metafacades
108         {
109             context = getContext(context);  // to have same value as in original constructor call
110             setMetafacadeContext (context);
111             if (this.superEntityQueryOperationInitialized)
112             {
113                 ((MetafacadeBase)this.superEntityQueryOperation).resetMetafacadeContext(context);
114             }
115         }
116     }
117 
118     /**
119      * @return boolean true always
120      * @see SpringQueryOperation
121      */
122     public boolean isSpringQueryOperationMetaType()
123     {
124         return true;
125     }
126 
127     // --------------- attributes ---------------------
128 
129    /**
130     * @see org.andromda.cartridges.spring.metafacades.SpringQueryOperation#isUseNamedParameters()
131     * @return boolean
132     */
133     protected abstract boolean handleIsUseNamedParameters();
134 
135     private boolean __useNamedParameters1a;
136     private boolean __useNamedParameters1aSet = false;
137 
138     /**
139      * Indicates whether or not the query parameters used for the body of the finder should be named
140      * ':someParam' or unnamed '?'.
141      * @return (boolean)handleIsUseNamedParameters()
142      */
143     public final boolean isUseNamedParameters()
144     {
145         boolean useNamedParameters1a = this.__useNamedParameters1a;
146         if (!this.__useNamedParameters1aSet)
147         {
148             // useNamedParameters has no pre constraints
149             useNamedParameters1a = handleIsUseNamedParameters();
150             // useNamedParameters has no post constraints
151             this.__useNamedParameters1a = useNamedParameters1a;
152             if (isMetafacadePropertyCachingEnabled())
153             {
154                 this.__useNamedParameters1aSet = true;
155             }
156         }
157         return useNamedParameters1a;
158     }
159 
160    /**
161     * @see org.andromda.cartridges.spring.metafacades.SpringQueryOperation#getQuery()
162     * @return String
163     */
164     protected abstract String handleGetQuery();
165 
166     private String __query2a;
167     private boolean __query2aSet = false;
168 
169     /**
170      * The actual query returned for the body of the finder.
171      * @return (String)handleGetQuery()
172      */
173     public final String getQuery()
174     {
175         String query2a = this.__query2a;
176         if (!this.__query2aSet)
177         {
178             // query has no pre constraints
179             query2a = handleGetQuery();
180             // query has no post constraints
181             this.__query2a = query2a;
182             if (isMetafacadePropertyCachingEnabled())
183             {
184                 this.__query2aSet = true;
185             }
186         }
187         return query2a;
188     }
189 
190    /**
191     * @see org.andromda.cartridges.spring.metafacades.SpringQueryOperation#isCriteriaFinder()
192     * @return boolean
193     */
194     protected abstract boolean handleIsCriteriaFinder();
195 
196     private boolean __criteriaFinder3a;
197     private boolean __criteriaFinder3aSet = false;
198 
199     /**
200      * Returns <code>true</code> if the operation is a criteria finder.
201      * @return (boolean)handleIsCriteriaFinder()
202      */
203     public final boolean isCriteriaFinder()
204     {
205         boolean criteriaFinder3a = this.__criteriaFinder3a;
206         if (!this.__criteriaFinder3aSet)
207         {
208             // criteriaFinder has no pre constraints
209             criteriaFinder3a = handleIsCriteriaFinder();
210             // criteriaFinder has no post constraints
211             this.__criteriaFinder3a = criteriaFinder3a;
212             if (isMetafacadePropertyCachingEnabled())
213             {
214                 this.__criteriaFinder3aSet = true;
215             }
216         }
217         return criteriaFinder3a;
218     }
219 
220    /**
221     * @see org.andromda.cartridges.spring.metafacades.SpringQueryOperation#getCriteriaArgument()
222     * @return ParameterFacade
223     */
224     protected abstract ParameterFacade handleGetCriteriaArgument();
225 
226     private ParameterFacade __criteriaArgument4a;
227     private boolean __criteriaArgument4aSet = false;
228 
229     /**
230      * Returns the argument that will contain the criteria search parameters.
231      * @return (ParameterFacade)handleGetCriteriaArgument()
232      */
233     public final ParameterFacade getCriteriaArgument()
234     {
235         ParameterFacade criteriaArgument4a = this.__criteriaArgument4a;
236         if (!this.__criteriaArgument4aSet)
237         {
238             // criteriaArgument has no pre constraints
239             criteriaArgument4a = handleGetCriteriaArgument();
240             // criteriaArgument has no post constraints
241             this.__criteriaArgument4a = criteriaArgument4a;
242             if (isMetafacadePropertyCachingEnabled())
243             {
244                 this.__criteriaArgument4aSet = true;
245             }
246         }
247         return criteriaArgument4a;
248     }
249 
250     // ---------------- business methods ----------------------
251 
252     /**
253      * Method to be implemented in descendants
254      * Gets the query; taking the entity of which should be included in the query (not counting
255      * queries that are explicitly modeled in OCL).
256      * @param entity
257      * @return String
258      */
259     protected abstract String handleGetQuery(SpringEntity entity);
260 
261     /**
262      * Gets the query; taking the entity of which should be included in the query (not counting
263      * queries that are explicitly modeled in OCL).
264      * @param entity SpringEntity
265      * The entity of which to create the query from.
266      * @return handleGetQuery(entity)
267      */
268     public String getQuery(SpringEntity entity)
269     {
270         // getQuery has no pre constraints
271         String returnValue = handleGetQuery(entity);
272         // getQuery has no post constraints
273         return returnValue;
274     }
275 
276     /**
277      * @return true
278      * @see EntityQueryOperation
279      */
280     public boolean isEntityQueryOperationMetaType()
281     {
282         return true;
283     }
284 
285     /**
286      * @return true
287      * @see OperationFacade
288      */
289     public boolean isOperationFacadeMetaType()
290     {
291         return true;
292     }
293 
294     /**
295      * @return true
296      * @see ModelElementFacade
297      */
298     public boolean isModelElementFacadeMetaType()
299     {
300         return true;
301     }
302 
303     // ----------- delegates to EntityQueryOperation ------------
304     /**
305      * The query string for this EntityFinderMethod.  The query returned is based on the
306      * 'translation' passed in.  The translation must be one available to AndroMDA found with a
307      * translation-library.
308      * @see EntityQueryOperation#getQuery(String translation)
309      */
310     public String getQuery(String translation)
311     {
312         return this.getSuperEntityQueryOperation().getQuery(translation);
313     }
314 
315     /**
316      * Copies all tagged values from the given ModelElementFacade to this model element facade.
317      * @see ModelElementFacade#copyTaggedValues(ModelElementFacade element)
318      */
319     public void copyTaggedValues(ModelElementFacade element)
320     {
321         this.getSuperEntityQueryOperation().copyTaggedValues(element);
322     }
323 
324     /**
325      * Finds the tagged value with the specified 'tagName'. In case there are more values the first
326      * one found will be returned.
327      * @see ModelElementFacade#findTaggedValue(String tagName)
328      */
329     public Object findTaggedValue(String tagName)
330     {
331         return this.getSuperEntityQueryOperation().findTaggedValue(tagName);
332     }
333 
334     /**
335      * Returns all the values for the tagged value with the specified name. The returned collection
336      * will contains only String instances, or will be empty. Never null.
337      * @see ModelElementFacade#findTaggedValues(String tagName)
338      */
339     public Collection<Object> findTaggedValues(String tagName)
340     {
341         return this.getSuperEntityQueryOperation().findTaggedValues(tagName);
342     }
343 
344     /**
345      * Returns the fully qualified name of the model element. The fully qualified name includes
346      * complete package qualified name of the underlying model element. The templates parameter will
347      * be replaced by the correct one given the binding relation of the parameter to this element.
348      * @see ModelElementFacade#getBindedFullyQualifiedName(ModelElementFacade bindedElement)
349      */
350     public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
351     {
352         return this.getSuperEntityQueryOperation().getBindedFullyQualifiedName(bindedElement);
353     }
354 
355     /**
356      * Gets all constraints belonging to the model element.
357      * @see ModelElementFacade#getConstraints()
358      */
359     public Collection<ConstraintFacade> getConstraints()
360     {
361         return this.getSuperEntityQueryOperation().getConstraints();
362     }
363 
364     /**
365      * Returns the constraints of the argument kind that have been placed onto this model. Typical
366      * kinds are "inv", "pre" and "post". Other kinds are possible.
367      * @see ModelElementFacade#getConstraints(String kind)
368      */
369     public Collection<ConstraintFacade> getConstraints(String kind)
370     {
371         return this.getSuperEntityQueryOperation().getConstraints(kind);
372     }
373 
374     /**
375      * Gets the documentation for the model element, The indent argument is prefixed to each line.
376      * By default this method wraps lines after 64 characters.
377      * This method is equivalent to <code>getDocumentation(indent, 64)</code>.
378      * @see ModelElementFacade#getDocumentation(String indent)
379      */
380     public String getDocumentation(String indent)
381     {
382         return this.getSuperEntityQueryOperation().getDocumentation(indent);
383     }
384 
385     /**
386      * This method returns the documentation for this model element, with the lines wrapped after
387      * the specified number of characters, values of less than 1 will indicate no line wrapping is
388      * required. By default paragraphs are returned as HTML.
389      * This method is equivalent to <code>getDocumentation(indent, lineLength, true)</code>.
390      * @see ModelElementFacade#getDocumentation(String indent, int lineLength)
391      */
392     public String getDocumentation(String indent, int lineLength)
393     {
394         return this.getSuperEntityQueryOperation().getDocumentation(indent, lineLength);
395     }
396 
397     /**
398      * This method returns the documentation for this model element, with the lines wrapped after
399      * the specified number of characters, values of less than 1 will indicate no line wrapping is
400      * required. HTML style determines if HTML Escaping is applied.
401      * @see ModelElementFacade#getDocumentation(String indent, int lineLength, boolean htmlStyle)
402      */
403     public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
404     {
405         return this.getSuperEntityQueryOperation().getDocumentation(indent, lineLength, htmlStyle);
406     }
407 
408     /**
409      * The fully qualified name of this model element.
410      * @see ModelElementFacade#getFullyQualifiedName()
411      */
412     public String getFullyQualifiedName()
413     {
414         return this.getSuperEntityQueryOperation().getFullyQualifiedName();
415     }
416 
417     /**
418      * Returns the fully qualified name of the model element. The fully qualified name includes
419      * complete package qualified name of the underlying model element.  If modelName is true, then
420      * the original name of the model element (the name contained within the model) will be the name
421      * returned, otherwise a name from a language mapping will be returned.
422      * @see ModelElementFacade#getFullyQualifiedName(boolean modelName)
423      */
424     public String getFullyQualifiedName(boolean modelName)
425     {
426         return this.getSuperEntityQueryOperation().getFullyQualifiedName(modelName);
427     }
428 
429     /**
430      * Returns the fully qualified name as a path, the returned value always starts with out a slash
431      * '/'.
432      * @see ModelElementFacade#getFullyQualifiedNamePath()
433      */
434     public String getFullyQualifiedNamePath()
435     {
436         return this.getSuperEntityQueryOperation().getFullyQualifiedNamePath();
437     }
438 
439     /**
440      * Gets the unique identifier of the underlying model element.
441      * @see ModelElementFacade#getId()
442      */
443     public String getId()
444     {
445         return this.getSuperEntityQueryOperation().getId();
446     }
447 
448     /**
449      * UML2: Retrieves the keywords for this element. Used to modify implementation properties which
450      * are not represented by other properties, i.e. native, transient, volatile, synchronized,
451      * (added annotations) override, deprecated. Can also be used to suppress compiler warnings:
452      * (added annotations) unchecked, fallthrough, path, serial, finally, all. Annotations require
453      * JDK5 compiler level.
454      * @see ModelElementFacade#getKeywords()
455      */
456     public Collection<String> getKeywords()
457     {
458         return this.getSuperEntityQueryOperation().getKeywords();
459     }
460 
461     /**
462      * UML2: Retrieves a localized label for this named element.
463      * @see ModelElementFacade#getLabel()
464      */
465     public String getLabel()
466     {
467         return this.getSuperEntityQueryOperation().getLabel();
468     }
469 
470     /**
471      * The language mappings that have been set for this model element.
472      * @see ModelElementFacade#getLanguageMappings()
473      */
474     public TypeMappings getLanguageMappings()
475     {
476         return this.getSuperEntityQueryOperation().getLanguageMappings();
477     }
478 
479     /**
480      * Return the model containing this model element (multiple models may be loaded and processed
481      * at the same time).
482      * @see ModelElementFacade#getModel()
483      */
484     public ModelFacade getModel()
485     {
486         return this.getSuperEntityQueryOperation().getModel();
487     }
488 
489     /**
490      * The name of the model element.
491      * @see ModelElementFacade#getName()
492      */
493     public String getName()
494     {
495         return this.getSuperEntityQueryOperation().getName();
496     }
497 
498     /**
499      * Gets the package to which this model element belongs.
500      * @see ModelElementFacade#getPackage()
501      */
502     public ModelElementFacade getPackage()
503     {
504         return this.getSuperEntityQueryOperation().getPackage();
505     }
506 
507     /**
508      * The name of this model element's package.
509      * @see ModelElementFacade#getPackageName()
510      */
511     public String getPackageName()
512     {
513         return this.getSuperEntityQueryOperation().getPackageName();
514     }
515 
516     /**
517      * Gets the package name (optionally providing the ability to retrieve the model name and not
518      * the mapped name).
519      * @see ModelElementFacade#getPackageName(boolean modelName)
520      */
521     public String getPackageName(boolean modelName)
522     {
523         return this.getSuperEntityQueryOperation().getPackageName(modelName);
524     }
525 
526     /**
527      * Returns the package as a path, the returned value always starts with out a slash '/'.
528      * @see ModelElementFacade#getPackagePath()
529      */
530     public String getPackagePath()
531     {
532         return this.getSuperEntityQueryOperation().getPackagePath();
533     }
534 
535     /**
536      * UML2: Returns the value of the 'Qualified Name' attribute. A name which allows the
537      * NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from
538      * the names of the containing namespaces starting at the root of the hierarchy and ending with
539      * the name of the NamedElement itself.
540      * @see ModelElementFacade#getQualifiedName()
541      */
542     public String getQualifiedName()
543     {
544         return this.getSuperEntityQueryOperation().getQualifiedName();
545     }
546 
547     /**
548      * Gets the root package for the model element.
549      * @see ModelElementFacade#getRootPackage()
550      */
551     public PackageFacade getRootPackage()
552     {
553         return this.getSuperEntityQueryOperation().getRootPackage();
554     }
555 
556     /**
557      * Gets the dependencies for which this model element is the source.
558      * @see ModelElementFacade#getSourceDependencies()
559      */
560     public Collection<DependencyFacade> getSourceDependencies()
561     {
562         return this.getSuperEntityQueryOperation().getSourceDependencies();
563     }
564 
565     /**
566      * If this model element is the context of an activity graph, this represents that activity
567      * graph.
568      * @see ModelElementFacade#getStateMachineContext()
569      */
570     public StateMachineFacade getStateMachineContext()
571     {
572         return this.getSuperEntityQueryOperation().getStateMachineContext();
573     }
574 
575     /**
576      * The collection of ALL stereotype names for this model element.
577      * @see ModelElementFacade#getStereotypeNames()
578      */
579     public Collection<String> getStereotypeNames()
580     {
581         return this.getSuperEntityQueryOperation().getStereotypeNames();
582     }
583 
584     /**
585      * Gets all stereotypes for this model element.
586      * @see ModelElementFacade#getStereotypes()
587      */
588     public Collection<StereotypeFacade> getStereotypes()
589     {
590         return this.getSuperEntityQueryOperation().getStereotypes();
591     }
592 
593     /**
594      * Return the TaggedValues associated with this model element, under all stereotypes.
595      * @see ModelElementFacade#getTaggedValues()
596      */
597     public Collection<TaggedValueFacade> getTaggedValues()
598     {
599         return this.getSuperEntityQueryOperation().getTaggedValues();
600     }
601 
602     /**
603      * Gets the dependencies for which this model element is the target.
604      * @see ModelElementFacade#getTargetDependencies()
605      */
606     public Collection<DependencyFacade> getTargetDependencies()
607     {
608         return this.getSuperEntityQueryOperation().getTargetDependencies();
609     }
610 
611     /**
612      * Get the template parameter for this model element having the parameterName
613      * @see ModelElementFacade#getTemplateParameter(String parameterName)
614      */
615     public Object getTemplateParameter(String parameterName)
616     {
617         return this.getSuperEntityQueryOperation().getTemplateParameter(parameterName);
618     }
619 
620     /**
621      * Get the template parameters for this model element
622      * @see ModelElementFacade#getTemplateParameters()
623      */
624     public Collection<TemplateParameterFacade> getTemplateParameters()
625     {
626         return this.getSuperEntityQueryOperation().getTemplateParameters();
627     }
628 
629     /**
630      * The visibility (i.e. public, private, protected or package) of the model element, will
631      * attempt a lookup for these values in the language mappings (if any).
632      * @see ModelElementFacade#getVisibility()
633      */
634     public String getVisibility()
635     {
636         return this.getSuperEntityQueryOperation().getVisibility();
637     }
638 
639     /**
640      * Returns true if the model element has the exact stereotype (meaning no stereotype inheritance
641      * is taken into account when searching for the stereotype), false otherwise.
642      * @see ModelElementFacade#hasExactStereotype(String stereotypeName)
643      */
644     public boolean hasExactStereotype(String stereotypeName)
645     {
646         return this.getSuperEntityQueryOperation().hasExactStereotype(stereotypeName);
647     }
648 
649     /**
650      * Does the UML Element contain the named Keyword? Keywords can be separated by space, comma,
651      * pipe, semicolon, or << >>
652      * @see ModelElementFacade#hasKeyword(String keywordName)
653      */
654     public boolean hasKeyword(String keywordName)
655     {
656         return this.getSuperEntityQueryOperation().hasKeyword(keywordName);
657     }
658 
659     /**
660      * Returns true if the model element has the specified stereotype.  If the stereotype itself
661      * does not match, then a search will be made up the stereotype inheritance hierarchy, and if
662      * one of the stereotype's ancestors has a matching name this method will return true, false
663      * otherwise.
664      * For example, if we have a certain stereotype called <<exception>> and a model element has a
665      * stereotype called <<applicationException>> which extends <<exception>>, when calling this
666      * method with 'stereotypeName' defined as 'exception' the method would return true since
667      * <<applicationException>> inherits from <<exception>>.  If you want to check if the model
668      * element has the exact stereotype, then use the method 'hasExactStereotype' instead.
669      * @see ModelElementFacade#hasStereotype(String stereotypeName)
670      */
671     public boolean hasStereotype(String stereotypeName)
672     {
673         return this.getSuperEntityQueryOperation().hasStereotype(stereotypeName);
674     }
675 
676     /**
677      * True if there are target dependencies from this element that are instances of BindingFacade.
678      * Deprecated in UML2: Use TemplateBinding parameters instead of dependencies.
679      * @see ModelElementFacade#isBindingDependenciesPresent()
680      */
681     public boolean isBindingDependenciesPresent()
682     {
683         return this.getSuperEntityQueryOperation().isBindingDependenciesPresent();
684     }
685 
686     /**
687      * Indicates if any constraints are present on this model element.
688      * @see ModelElementFacade#isConstraintsPresent()
689      */
690     public boolean isConstraintsPresent()
691     {
692         return this.getSuperEntityQueryOperation().isConstraintsPresent();
693     }
694 
695     /**
696      * Indicates if any documentation is present on this model element.
697      * @see ModelElementFacade#isDocumentationPresent()
698      */
699     public boolean isDocumentationPresent()
700     {
701         return this.getSuperEntityQueryOperation().isDocumentationPresent();
702     }
703 
704     /**
705      * True if this element name is a reserved word in Java, C#, ANSI or ISO C, C++, JavaScript.
706      * @see ModelElementFacade#isReservedWord()
707      */
708     public boolean isReservedWord()
709     {
710         return this.getSuperEntityQueryOperation().isReservedWord();
711     }
712 
713     /**
714      * True is there are template parameters on this model element. For UML2, applies to Class,
715      * Operation, Property, and Parameter.
716      * @see ModelElementFacade#isTemplateParametersPresent()
717      */
718     public boolean isTemplateParametersPresent()
719     {
720         return this.getSuperEntityQueryOperation().isTemplateParametersPresent();
721     }
722 
723     /**
724      * True if this element name is a valid identifier name in Java, C#, ANSI or ISO C, C++,
725      * JavaScript. Contains no spaces, special characters etc. Constraint always applied on
726      * Enumerations and Interfaces, optionally applies on other model elements.
727      * @see ModelElementFacade#isValidIdentifierName()
728      */
729     public boolean isValidIdentifierName()
730     {
731         return this.getSuperEntityQueryOperation().isValidIdentifierName();
732     }
733 
734     /**
735      * Searches for the constraint with the specified 'name' on this model element, and if found
736      * translates it using the specified 'translation' from a translation library discovered by the
737      * framework.
738      * @see ModelElementFacade#translateConstraint(String name, String translation)
739      */
740     public String translateConstraint(String name, String translation)
741     {
742         return this.getSuperEntityQueryOperation().translateConstraint(name, translation);
743     }
744 
745     /**
746      * Translates all constraints belonging to this model element with the given 'translation'.
747      * @see ModelElementFacade#translateConstraints(String translation)
748      */
749     public String[] translateConstraints(String translation)
750     {
751         return this.getSuperEntityQueryOperation().translateConstraints(translation);
752     }
753 
754     /**
755      * Translates the constraints of the specified 'kind' belonging to this model element.
756      * @see ModelElementFacade#translateConstraints(String kind, String translation)
757      */
758     public String[] translateConstraints(String kind, String translation)
759     {
760         return this.getSuperEntityQueryOperation().translateConstraints(kind, translation);
761     }
762 
763     /**
764      * Finds the parameter on this operation having the given name, if no parameter is found, null
765      * is returned instead.
766      * @see OperationFacade#findParameter(String name)
767      */
768     public ParameterFacade findParameter(String name)
769     {
770         return this.getSuperEntityQueryOperation().findParameter(name);
771     }
772 
773     /**
774      * Searches the given feature for the specified tag.
775      * If the follow boolean is set to true then the search will continue from the class operation
776      * to the class itself and then up the class hierarchy.
777      * @see OperationFacade#findTaggedValue(String name, boolean follow)
778      */
779     public Object findTaggedValue(String name, boolean follow)
780     {
781         return this.getSuperEntityQueryOperation().findTaggedValue(name, follow);
782     }
783 
784     /**
785      * A comma separated list of all argument names.
786      * @see OperationFacade#getArgumentNames()
787      */
788     public String getArgumentNames()
789     {
790         return this.getSuperEntityQueryOperation().getArgumentNames();
791     }
792 
793     /**
794      * A comma separated list of all types of each argument, in order.
795      * @see OperationFacade#getArgumentTypeNames()
796      */
797     public String getArgumentTypeNames()
798     {
799         return this.getSuperEntityQueryOperation().getArgumentTypeNames();
800     }
801 
802     /**
803      * Specification of an argument used to pass information into or out of an invocation of a
804      * behavioral
805      * feature. Parameters are allowed to be treated as connectable elements. Parameters have
806      * support for
807      * streaming, exceptions, and parameter sets.
808      * @see OperationFacade#getArguments()
809      */
810     public Collection<ParameterFacade> getArguments()
811     {
812         return this.getSuperEntityQueryOperation().getArguments();
813     }
814 
815     /**
816      * Constructs the operation call with the operation name
817      * @see OperationFacade#getCall()
818      */
819     public String getCall()
820     {
821         return this.getSuperEntityQueryOperation().getCall();
822     }
823 
824     /**
825      * Returns the concurrency modifier for this operation (i.e. concurrent, guarded or sequential)
826      * of the model element, will attempt a lookup for these values in the language mappings (if
827      * any).
828      * @see OperationFacade#getConcurrency()
829      */
830     public String getConcurrency()
831     {
832         return this.getSuperEntityQueryOperation().getConcurrency();
833     }
834 
835     /**
836      * A comma separated list containing all exceptions that this operation throws.  Exceptions are
837      * determined through dependencies that have the target element stereotyped as <<Exception>>.
838      * @see OperationFacade#getExceptionList()
839      */
840     public String getExceptionList()
841     {
842         return this.getSuperEntityQueryOperation().getExceptionList();
843     }
844 
845     /**
846      * Returns a comma separated list of exceptions appended to the comma separated list of fully
847      * qualified 'initialException' classes passed in to this method.
848      * @see OperationFacade#getExceptionList(String initialExceptions)
849      */
850     public String getExceptionList(String initialExceptions)
851     {
852         return this.getSuperEntityQueryOperation().getExceptionList(initialExceptions);
853     }
854 
855     /**
856      * A collection of all exceptions thrown by this operation.
857      * @see OperationFacade#getExceptions()
858      */
859     public Collection<ModelElementFacade> getExceptions()
860     {
861         return this.getSuperEntityQueryOperation().getExceptions();
862     }
863 
864     /**
865      * Return Type with multiplicity taken into account. UML14 does not allow multiplicity *.
866      * @see OperationFacade#getGetterSetterReturnTypeName()
867      */
868     public String getGetterSetterReturnTypeName()
869     {
870         return this.getSuperEntityQueryOperation().getGetterSetterReturnTypeName();
871     }
872 
873     /**
874      * the lower value for the multiplicity
875      * -only applicable for UML2
876      * @see OperationFacade#getLower()
877      */
878     public int getLower()
879     {
880         return this.getSuperEntityQueryOperation().getLower();
881     }
882 
883     /**
884      * Returns the operation method body determined from UML sequence diagrams or other UML sources.
885      * @see OperationFacade#getMethodBody()
886      */
887     public String getMethodBody()
888     {
889         return this.getSuperEntityQueryOperation().getMethodBody();
890     }
891 
892     /**
893      * The operation this operation overrides, null if this operation is not overriding.
894      * @see OperationFacade#getOverriddenOperation()
895      */
896     public OperationFacade getOverriddenOperation()
897     {
898         return this.getSuperEntityQueryOperation().getOverriddenOperation();
899     }
900 
901     /**
902      * Gets the owner of this operation
903      * @see OperationFacade#getOwner()
904      */
905     public ClassifierFacade getOwner()
906     {
907         return this.getSuperEntityQueryOperation().getOwner();
908     }
909 
910     /**
911      * Return all parameters for the operation, including the return parameter.
912      * @see OperationFacade#getParameters()
913      */
914     public Collection<ParameterFacade> getParameters()
915     {
916         return this.getSuperEntityQueryOperation().getParameters();
917     }
918 
919     /**
920      * The name of the operation that handles postcondition constraints.
921      * @see OperationFacade#getPostconditionName()
922      */
923     public String getPostconditionName()
924     {
925         return this.getSuperEntityQueryOperation().getPostconditionName();
926     }
927 
928     /**
929      * The postcondition constraints belonging to this operation.
930      * @see OperationFacade#getPostconditions()
931      */
932     public Collection<ConstraintFacade> getPostconditions()
933     {
934         return this.getSuperEntityQueryOperation().getPostconditions();
935     }
936 
937     /**
938      * The call to the precondition operation.
939      * @see OperationFacade#getPreconditionCall()
940      */
941     public String getPreconditionCall()
942     {
943         return this.getSuperEntityQueryOperation().getPreconditionCall();
944     }
945 
946     /**
947      * The name of the operation that handles precondition constraints.
948      * @see OperationFacade#getPreconditionName()
949      */
950     public String getPreconditionName()
951     {
952         return this.getSuperEntityQueryOperation().getPreconditionName();
953     }
954 
955     /**
956      * The signature of the precondition operation.
957      * @see OperationFacade#getPreconditionSignature()
958      */
959     public String getPreconditionSignature()
960     {
961         return this.getSuperEntityQueryOperation().getPreconditionSignature();
962     }
963 
964     /**
965      * The precondition constraints belonging to this operation.
966      * @see OperationFacade#getPreconditions()
967      */
968     public Collection<ConstraintFacade> getPreconditions()
969     {
970         return this.getSuperEntityQueryOperation().getPreconditions();
971     }
972 
973     /**
974      * (UML2 Only). Get the actual return parameter (which may have stereotypes etc).
975      * @see OperationFacade#getReturnParameter()
976      */
977     public ParameterFacade getReturnParameter()
978     {
979         return this.getSuperEntityQueryOperation().getReturnParameter();
980     }
981 
982     /**
983      * The operation return type parameter.
984      * @see OperationFacade#getReturnType()
985      */
986     public ClassifierFacade getReturnType()
987     {
988         return this.getSuperEntityQueryOperation().getReturnType();
989     }
990 
991     /**
992      * Return the operation signature, including public/protested abstract returnType name plus
993      * argument type and name
994      * @see OperationFacade#getSignature()
995      */
996     public String getSignature()
997     {
998         return this.getSuperEntityQueryOperation().getSignature();
999     }
1000 
1001     /**
1002      * Returns the signature of the operation and optionally appends the argument names (if
1003      * withArgumentNames is true), otherwise returns the signature with just the types alone in the
1004      * signature.
1005      * @see OperationFacade#getSignature(boolean withArgumentNames)
1006      */
1007     public String getSignature(boolean withArgumentNames)
1008     {
1009         return this.getSuperEntityQueryOperation().getSignature(withArgumentNames);
1010     }
1011 
1012     /**
1013      * Returns the signature of the operation and optionally appends the given 'argumentModifier' to
1014      * each argument.
1015      * @see OperationFacade#getSignature(String argumentModifier)
1016      */
1017     public String getSignature(String argumentModifier)
1018     {
1019         return this.getSuperEntityQueryOperation().getSignature(argumentModifier);
1020     }
1021 
1022     /**
1023      * A comma-separated parameter list  (type and name of each parameter) of an operation.
1024      * @see OperationFacade#getTypedArgumentList()
1025      */
1026     public String getTypedArgumentList()
1027     {
1028         return this.getSuperEntityQueryOperation().getTypedArgumentList();
1029     }
1030 
1031     /**
1032      * A comma-separated parameter list  (type and name of each parameter) of an operation with an
1033      * optional modifier (i.e final) before each parameter.
1034      * @see OperationFacade#getTypedArgumentList(String modifier)
1035      */
1036     public String getTypedArgumentList(String modifier)
1037     {
1038         return this.getSuperEntityQueryOperation().getTypedArgumentList(modifier);
1039     }
1040 
1041     /**
1042      * the upper value for the multiplicity (will be -1 for *)
1043      * - only applicable for UML2
1044      * @see OperationFacade#getUpper()
1045      */
1046     public int getUpper()
1047     {
1048         return this.getSuperEntityQueryOperation().getUpper();
1049     }
1050 
1051     /**
1052      * True is the operation is abstract.
1053      * @see OperationFacade#isAbstract()
1054      */
1055     public boolean isAbstract()
1056     {
1057         return this.getSuperEntityQueryOperation().isAbstract();
1058     }
1059 
1060     /**
1061      * True if the operation has (i.e. throws any exceptions) false otherwise.
1062      * @see OperationFacade#isExceptionsPresent()
1063      */
1064     public boolean isExceptionsPresent()
1065     {
1066         return this.getSuperEntityQueryOperation().isExceptionsPresent();
1067     }
1068 
1069     /**
1070      * IsLeaf property in the operation. If true, operation is final, cannot be extended or
1071      * implemented by a descendant. Default=false.
1072      * @see OperationFacade#isLeaf()
1073      */
1074     public boolean isLeaf()
1075     {
1076         return this.getSuperEntityQueryOperation().isLeaf();
1077     }
1078 
1079     /**
1080      * UML2 only. If the return type parameter multiplicity>1 OR the operation multiplicity>1.
1081      * Default=false.
1082      * @see OperationFacade#isMany()
1083      */
1084     public boolean isMany()
1085     {
1086         return this.getSuperEntityQueryOperation().isMany();
1087     }
1088 
1089     /**
1090      * UML2 only: If isMany (Collection type returned), is the type unique within the collection. 
1091      * Unique+Ordered determines CollectionType implementation of return result. Default=false.
1092      * @see OperationFacade#isOrdered()
1093      */
1094     public boolean isOrdered()
1095     {
1096         return this.getSuperEntityQueryOperation().isOrdered();
1097     }
1098 
1099     /**
1100      * True if this operation overrides an operation defined in an ancestor class. An operation
1101      * overrides when the names of the operations as well as the types of the arguments are equal.
1102      * The return type may be different and is, as well as any exceptions, ignored.
1103      * @see OperationFacade#isOverriding()
1104      */
1105     public boolean isOverriding()
1106     {
1107         return this.getSuperEntityQueryOperation().isOverriding();
1108     }
1109 
1110     /**
1111      * Whether any postcondition constraints are present on this operation.
1112      * @see OperationFacade#isPostconditionsPresent()
1113      */
1114     public boolean isPostconditionsPresent()
1115     {
1116         return this.getSuperEntityQueryOperation().isPostconditionsPresent();
1117     }
1118 
1119     /**
1120      * Whether any precondition constraints are present on this operation.
1121      * @see OperationFacade#isPreconditionsPresent()
1122      */
1123     public boolean isPreconditionsPresent()
1124     {
1125         return this.getSuperEntityQueryOperation().isPreconditionsPresent();
1126     }
1127 
1128     /**
1129      * Indicates whether or not this operation is a query operation.
1130      * @see OperationFacade#isQuery()
1131      */
1132     public boolean isQuery()
1133     {
1134         return this.getSuperEntityQueryOperation().isQuery();
1135     }
1136 
1137     /**
1138      * True/false depending on whether or not the operation has a return type or not (i.e. a return
1139      * type of something other than void).
1140      * @see OperationFacade#isReturnTypePresent()
1141      */
1142     public boolean isReturnTypePresent()
1143     {
1144         return this.getSuperEntityQueryOperation().isReturnTypePresent();
1145     }
1146 
1147     /**
1148      * True is the operation is static (only a single instance can be instantiated).
1149      * @see OperationFacade#isStatic()
1150      */
1151     public boolean isStatic()
1152     {
1153         return this.getSuperEntityQueryOperation().isStatic();
1154     }
1155 
1156     /**
1157      * UML2 only: for Collection return type, is the type unique within the collection.
1158      * Unique+Ordered determines the returned CollectionType. Default=false.
1159      * @see OperationFacade#isUnique()
1160      */
1161     public boolean isUnique()
1162     {
1163         return this.getSuperEntityQueryOperation().isUnique();
1164     }
1165 
1166     /**
1167      * @see MetafacadeBase#initialize()
1168      */
1169     @Override
1170     public void initialize()
1171     {
1172         this.getSuperEntityQueryOperation().initialize();
1173     }
1174 
1175     /**
1176      * @return Object getSuperEntityQueryOperation().getValidationOwner()
1177      * @see MetafacadeBase#getValidationOwner()
1178      */
1179     @Override
1180     public Object getValidationOwner()
1181     {
1182         Object owner = this.getSuperEntityQueryOperation().getValidationOwner();
1183         return owner;
1184     }
1185 
1186     /**
1187      * @return String getSuperEntityQueryOperation().getValidationName()
1188      * @see MetafacadeBase#getValidationName()
1189      */
1190     @Override
1191     public String getValidationName()
1192     {
1193         String name = this.getSuperEntityQueryOperation().getValidationName();
1194         return name;
1195     }
1196 
1197     /**
1198      * <p><b>Constraint:</b> org::andromda::cartridges::spring::metafacades::SpringQueryOperation::collection parameters must use named parameters</p>
1199      * <p><b>Error:</b> A collection type argument can only be specified when using named parameters, please set the 'hibernateQueryUseNamedParameters' namespace property to 'true' when attempting to use a collection as a query argument.</p>
1200      * <p><b>OCL:</b> context SpringQueryOperation
1201 inv: not useNamedParameters 
1202 implies arguments -> forAll(not type.collectionType)</p>
1203      * @param validationMessages Collection<ModelValidationMessage>
1204      * @see MetafacadeBase#validateInvariants(Collection validationMessages)
1205      */
1206     @Override
1207     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
1208     {
1209         this.getSuperEntityQueryOperation().validateInvariants(validationMessages);
1210         try
1211         {
1212             final Object contextElement = this.THIS();
1213             boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(!Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"useNamedParameters"))).booleanValue())).booleanValue()?OCLCollections.forAll(OCLIntrospector.invoke(contextElement,"arguments"),new Predicate(){public boolean evaluate(Object object){return Boolean.valueOf(String.valueOf(!Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(object,"type.collectionType"))).booleanValue())).booleanValue();}}):true));
1214             if (!constraintValid)
1215             {
1216                 validationMessages.add(
1217                     new ModelValidationMessage(
1218                         (MetafacadeBase)contextElement ,
1219                         "org::andromda::cartridges::spring::metafacades::SpringQueryOperation::collection parameters must use named parameters",
1220                         "A collection type argument can only be specified when using named parameters, please set the 'hibernateQueryUseNamedParameters' namespace property to 'true' when attempting to use a collection as a query argument."));
1221             }
1222         }
1223         catch (Throwable th)
1224         {
1225             Throwable cause = th.getCause();
1226             int depth = 0; // Some throwables have infinite recursion
1227             while (cause != null && depth < 7)
1228             {
1229                 th = cause;
1230                 depth++;
1231             }
1232             logger.error("Error validating constraint 'org::andromda::cartridges::spring::metafacades::SpringQueryOperation::collection parameters must use named parameters' ON "
1233                 + this.THIS().toString() + ": " + th.getMessage(), th);
1234         }
1235     }
1236 
1237     /**
1238      * The property that stores the name of the metafacade.
1239      */
1240     private static final String NAME_PROPERTY = "name";
1241     private static final String FQNAME_PROPERTY = "fullyQualifiedName";
1242 
1243     /**
1244      * @see Object#toString()
1245      */
1246     @Override
1247     public String toString()
1248     {
1249         final StringBuilder toString = new StringBuilder(this.getClass().getName());
1250         toString.append("[");
1251         try
1252         {
1253             toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
1254         }
1255         catch (final Throwable tryAgain)
1256         {
1257             try
1258             {
1259                 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
1260             }
1261             catch (final Throwable ignore)
1262             {
1263                 // - just ignore when the metafacade doesn't have a name or fullyQualifiedName property
1264             }
1265         }
1266         toString.append("]");
1267         return toString.toString();
1268     }
1269 }