1
2
3
4 package org.andromda.cartridges.spring.metafacades;
5
6 /***
7 * MetafacadeLogic for org.andromda.cartridges.spring.metafacades.SpringQueryOperation
8 *
9 * @see org.andromda.cartridges.spring.metafacades.SpringQueryOperation
10 */
11 public abstract class SpringQueryOperationLogic
12 extends org.andromda.core.metafacade.MetafacadeBase
13 implements org.andromda.cartridges.spring.metafacades.SpringQueryOperation
14 {
15
16 protected Object metaObject;
17
18 public SpringQueryOperationLogic(Object metaObject, String context)
19 {
20 super(metaObject, getContext(context));
21 this.superEntityQueryOperation =
22 (org.andromda.metafacades.uml.EntityQueryOperation)
23 org.andromda.core.metafacade.MetafacadeFactory.getInstance().createFacadeImpl(
24 "org.andromda.metafacades.uml.EntityQueryOperation",
25 metaObject,
26 getContext(context));
27 this.metaObject = metaObject;
28 }
29
30 /***
31 * Gets the context for this metafacade logic instance.
32 */
33 private static String getContext(String context)
34 {
35 if (context == null)
36 {
37 context = "org.andromda.cartridges.spring.metafacades.SpringQueryOperation";
38 }
39 return context;
40 }
41
42 private org.andromda.metafacades.uml.EntityQueryOperation superEntityQueryOperation;
43 private boolean superEntityQueryOperationInitialized = false;
44
45 /***
46 * Gets the org.andromda.metafacades.uml.EntityQueryOperation parent instance.
47 */
48 private org.andromda.metafacades.uml.EntityQueryOperation getSuperEntityQueryOperation()
49 {
50 if (!this.superEntityQueryOperationInitialized)
51 {
52 ((org.andromda.core.metafacade.MetafacadeBase)superEntityQueryOperation).setMetafacadeContext(this.getMetafacadeContext());
53 this.superEntityQueryOperationInitialized = true;
54 }
55 return superEntityQueryOperation;
56 }
57
58 /***
59 * @see org.andromda.core.metafacade.MetafacadeBase
60 */
61 public void resetMetafacadeContext(String context)
62 {
63 if (!this.contextRoot)
64 {
65 context = getContext(context);
66 setMetafacadeContext (context);
67 if (this.superEntityQueryOperationInitialized)
68 {
69 ((org.andromda.core.metafacade.MetafacadeBase)superEntityQueryOperation).resetMetafacadeContext(context);
70 }
71 }
72 }
73
74 /***
75 * @see org.andromda.cartridges.spring.metafacades.SpringQueryOperation
76 */
77 public boolean isSpringQueryOperationMetaType()
78 {
79 return true;
80 }
81
82
83
84 /***
85 * @see org.andromda.cartridges.spring.metafacades.SpringQueryOperation#isUseNamedParameters()
86 */
87 protected abstract boolean handleIsUseNamedParameters();
88
89 private void handleIsUseNamedParameters1aPreCondition()
90 {
91 }
92
93 private void handleIsUseNamedParameters1aPostCondition()
94 {
95 }
96
97 private boolean __useNamedParameters1a;
98 private boolean __useNamedParameters1aSet = false;
99
100 public final boolean isUseNamedParameters()
101 {
102 boolean useNamedParameters1a = this.__useNamedParameters1a;
103 if (!this.__useNamedParameters1aSet)
104 {
105 handleIsUseNamedParameters1aPreCondition();
106 useNamedParameters1a = handleIsUseNamedParameters();
107 handleIsUseNamedParameters1aPostCondition();
108 this.__useNamedParameters1a = useNamedParameters1a;
109 if (isMetafacadePropertyCachingEnabled())
110 {
111 this.__useNamedParameters1aSet = true;
112 }
113 }
114 return useNamedParameters1a;
115 }
116
117 /***
118 * @see org.andromda.cartridges.spring.metafacades.SpringQueryOperation#getQuery()
119 */
120 protected abstract java.lang.String handleGetQuery();
121
122 private void handleGetQuery2aPreCondition()
123 {
124 }
125
126 private void handleGetQuery2aPostCondition()
127 {
128 }
129
130 private java.lang.String __query2a;
131 private boolean __query2aSet = false;
132
133 public final java.lang.String getQuery()
134 {
135 java.lang.String query2a = this.__query2a;
136 if (!this.__query2aSet)
137 {
138 handleGetQuery2aPreCondition();
139 query2a = handleGetQuery();
140 handleGetQuery2aPostCondition();
141 this.__query2a = query2a;
142 if (isMetafacadePropertyCachingEnabled())
143 {
144 this.__query2aSet = true;
145 }
146 }
147 return query2a;
148 }
149
150 /***
151 * @see org.andromda.cartridges.spring.metafacades.SpringQueryOperation#isCriteriaFinder()
152 */
153 protected abstract boolean handleIsCriteriaFinder();
154
155 private void handleIsCriteriaFinder3aPreCondition()
156 {
157 }
158
159 private void handleIsCriteriaFinder3aPostCondition()
160 {
161 }
162
163 private boolean __criteriaFinder3a;
164 private boolean __criteriaFinder3aSet = false;
165
166 public final boolean isCriteriaFinder()
167 {
168 boolean criteriaFinder3a = this.__criteriaFinder3a;
169 if (!this.__criteriaFinder3aSet)
170 {
171 handleIsCriteriaFinder3aPreCondition();
172 criteriaFinder3a = handleIsCriteriaFinder();
173 handleIsCriteriaFinder3aPostCondition();
174 this.__criteriaFinder3a = criteriaFinder3a;
175 if (isMetafacadePropertyCachingEnabled())
176 {
177 this.__criteriaFinder3aSet = true;
178 }
179 }
180 return criteriaFinder3a;
181 }
182
183 /***
184 * @see org.andromda.cartridges.spring.metafacades.SpringQueryOperation#getCriteriaArgument()
185 */
186 protected abstract org.andromda.metafacades.uml.ParameterFacade handleGetCriteriaArgument();
187
188 private void handleGetCriteriaArgument4aPreCondition()
189 {
190 }
191
192 private void handleGetCriteriaArgument4aPostCondition()
193 {
194 }
195
196 private org.andromda.metafacades.uml.ParameterFacade __criteriaArgument4a;
197 private boolean __criteriaArgument4aSet = false;
198
199 public final org.andromda.metafacades.uml.ParameterFacade getCriteriaArgument()
200 {
201 org.andromda.metafacades.uml.ParameterFacade criteriaArgument4a = this.__criteriaArgument4a;
202 if (!this.__criteriaArgument4aSet)
203 {
204 handleGetCriteriaArgument4aPreCondition();
205 criteriaArgument4a = handleGetCriteriaArgument();
206 handleGetCriteriaArgument4aPostCondition();
207 this.__criteriaArgument4a = criteriaArgument4a;
208 if (isMetafacadePropertyCachingEnabled())
209 {
210 this.__criteriaArgument4aSet = true;
211 }
212 }
213 return criteriaArgument4a;
214 }
215
216
217
218 protected abstract java.lang.String handleGetQuery(org.andromda.cartridges.spring.metafacades.SpringEntity entity);
219
220 private void handleGetQuery1oPreCondition()
221 {
222 }
223
224 private void handleGetQuery1oPostCondition()
225 {
226 }
227
228 public java.lang.String getQuery(org.andromda.cartridges.spring.metafacades.SpringEntity entity)
229 {
230 handleGetQuery1oPreCondition();
231 java.lang.String returnValue = handleGetQuery(entity);
232 handleGetQuery1oPostCondition();
233 return returnValue;
234 }
235
236 /***
237 * @see org.andromda.metafacades.uml.EntityQueryOperation
238 */
239 public boolean isEntityQueryOperationMetaType()
240 {
241 return true;
242 }
243
244 /***
245 * @see org.andromda.metafacades.uml.OperationFacade
246 */
247 public boolean isOperationFacadeMetaType()
248 {
249 return true;
250 }
251
252 /***
253 * @see org.andromda.metafacades.uml.ModelElementFacade
254 */
255 public boolean isModelElementFacadeMetaType()
256 {
257 return true;
258 }
259
260
261
262 public java.lang.String getQuery(java.lang.String translation)
263 {
264 return this.getSuperEntityQueryOperation().getQuery(translation);
265 }
266
267
268 public void copyTaggedValues(org.andromda.metafacades.uml.ModelElementFacade element)
269 {
270 this.getSuperEntityQueryOperation().copyTaggedValues(element);
271 }
272
273
274 public java.lang.Object findTaggedValue(java.lang.String tagName)
275 {
276 return this.getSuperEntityQueryOperation().findTaggedValue(tagName);
277 }
278
279
280 public java.util.Collection findTaggedValues(java.lang.String tagName)
281 {
282 return this.getSuperEntityQueryOperation().findTaggedValues(tagName);
283 }
284
285
286 public java.util.Collection getConstraints()
287 {
288 return this.getSuperEntityQueryOperation().getConstraints();
289 }
290
291
292 public java.util.Collection getConstraints(java.lang.String kind)
293 {
294 return this.getSuperEntityQueryOperation().getConstraints(kind);
295 }
296
297
298 public java.lang.String getDocumentation(java.lang.String indent, int lineLength)
299 {
300 return this.getSuperEntityQueryOperation().getDocumentation(indent, lineLength);
301 }
302
303
304 public java.lang.String getDocumentation(java.lang.String indent, int lineLength, boolean htmlStyle)
305 {
306 return this.getSuperEntityQueryOperation().getDocumentation(indent, lineLength, htmlStyle);
307 }
308
309
310 public java.lang.String getDocumentation(java.lang.String indent)
311 {
312 return this.getSuperEntityQueryOperation().getDocumentation(indent);
313 }
314
315
316 public java.lang.String getFullyQualifiedName(boolean modelName)
317 {
318 return this.getSuperEntityQueryOperation().getFullyQualifiedName(modelName);
319 }
320
321
322 public java.lang.String getFullyQualifiedName()
323 {
324 return this.getSuperEntityQueryOperation().getFullyQualifiedName();
325 }
326
327
328 public java.lang.String getFullyQualifiedNamePath()
329 {
330 return this.getSuperEntityQueryOperation().getFullyQualifiedNamePath();
331 }
332
333
334 public java.lang.String getId()
335 {
336 return this.getSuperEntityQueryOperation().getId();
337 }
338
339
340 public org.andromda.metafacades.uml.TypeMappings getLanguageMappings()
341 {
342 return this.getSuperEntityQueryOperation().getLanguageMappings();
343 }
344
345
346 public org.andromda.metafacades.uml.ModelFacade getModel()
347 {
348 return this.getSuperEntityQueryOperation().getModel();
349 }
350
351
352 public java.lang.String getName()
353 {
354 return this.getSuperEntityQueryOperation().getName();
355 }
356
357
358 public org.andromda.metafacades.uml.ModelElementFacade getPackage()
359 {
360 return this.getSuperEntityQueryOperation().getPackage();
361 }
362
363
364 public java.lang.String getPackageName(boolean modelName)
365 {
366 return this.getSuperEntityQueryOperation().getPackageName(modelName);
367 }
368
369
370 public java.lang.String getPackageName()
371 {
372 return this.getSuperEntityQueryOperation().getPackageName();
373 }
374
375
376 public java.lang.String getPackagePath()
377 {
378 return this.getSuperEntityQueryOperation().getPackagePath();
379 }
380
381
382 public org.andromda.metafacades.uml.PackageFacade getRootPackage()
383 {
384 return this.getSuperEntityQueryOperation().getRootPackage();
385 }
386
387
388 public java.util.Collection getSourceDependencies()
389 {
390 return this.getSuperEntityQueryOperation().getSourceDependencies();
391 }
392
393
394 public org.andromda.metafacades.uml.StateMachineFacade getStateMachineContext()
395 {
396 return this.getSuperEntityQueryOperation().getStateMachineContext();
397 }
398
399
400 public java.util.Collection getStereotypeNames()
401 {
402 return this.getSuperEntityQueryOperation().getStereotypeNames();
403 }
404
405
406 public java.util.Collection getStereotypes()
407 {
408 return this.getSuperEntityQueryOperation().getStereotypes();
409 }
410
411
412 public java.util.Collection getTaggedValues()
413 {
414 return this.getSuperEntityQueryOperation().getTaggedValues();
415 }
416
417
418 public java.util.Collection getTargetDependencies()
419 {
420 return this.getSuperEntityQueryOperation().getTargetDependencies();
421 }
422
423
424 public java.lang.Object getTemplateParameter(java.lang.String parameterName)
425 {
426 return this.getSuperEntityQueryOperation().getTemplateParameter(parameterName);
427 }
428
429
430 public java.util.Collection getTemplateParameters()
431 {
432 return this.getSuperEntityQueryOperation().getTemplateParameters();
433 }
434
435
436 public java.lang.String getVisibility()
437 {
438 return this.getSuperEntityQueryOperation().getVisibility();
439 }
440
441
442 public boolean hasExactStereotype(java.lang.String stereotypeName)
443 {
444 return this.getSuperEntityQueryOperation().hasExactStereotype(stereotypeName);
445 }
446
447
448 public boolean hasStereotype(java.lang.String stereotypeName)
449 {
450 return this.getSuperEntityQueryOperation().hasStereotype(stereotypeName);
451 }
452
453
454 public boolean isBindingDependenciesPresent()
455 {
456 return this.getSuperEntityQueryOperation().isBindingDependenciesPresent();
457 }
458
459
460 public boolean isConstraintsPresent()
461 {
462 return this.getSuperEntityQueryOperation().isConstraintsPresent();
463 }
464
465
466 public boolean isTemplateParametersPresent()
467 {
468 return this.getSuperEntityQueryOperation().isTemplateParametersPresent();
469 }
470
471
472 public java.lang.String translateConstraint(java.lang.String name, java.lang.String translation)
473 {
474 return this.getSuperEntityQueryOperation().translateConstraint(name, translation);
475 }
476
477
478 public java.lang.String[] translateConstraints(java.lang.String translation)
479 {
480 return this.getSuperEntityQueryOperation().translateConstraints(translation);
481 }
482
483
484 public java.lang.String[] translateConstraints(java.lang.String kind, java.lang.String translation)
485 {
486 return this.getSuperEntityQueryOperation().translateConstraints(kind, translation);
487 }
488
489
490 public org.andromda.metafacades.uml.ParameterFacade findParameter(java.lang.String name)
491 {
492 return this.getSuperEntityQueryOperation().findParameter(name);
493 }
494
495
496 public java.lang.Object findTaggedValue(java.lang.String name, boolean follow)
497 {
498 return this.getSuperEntityQueryOperation().findTaggedValue(name, follow);
499 }
500
501
502 public java.lang.String getArgumentNames()
503 {
504 return this.getSuperEntityQueryOperation().getArgumentNames();
505 }
506
507
508 public java.lang.String getArgumentTypeNames()
509 {
510 return this.getSuperEntityQueryOperation().getArgumentTypeNames();
511 }
512
513
514 public java.util.Collection getArguments()
515 {
516 return this.getSuperEntityQueryOperation().getArguments();
517 }
518
519
520 public java.lang.String getCall()
521 {
522 return this.getSuperEntityQueryOperation().getCall();
523 }
524
525
526 public java.lang.String getConcurrency()
527 {
528 return this.getSuperEntityQueryOperation().getConcurrency();
529 }
530
531
532 public java.lang.String getExceptionList(java.lang.String initialExceptions)
533 {
534 return this.getSuperEntityQueryOperation().getExceptionList(initialExceptions);
535 }
536
537
538 public java.lang.String getExceptionList()
539 {
540 return this.getSuperEntityQueryOperation().getExceptionList();
541 }
542
543
544 public java.util.Collection getExceptions()
545 {
546 return this.getSuperEntityQueryOperation().getExceptions();
547 }
548
549
550 public int getLower()
551 {
552 return this.getSuperEntityQueryOperation().getLower();
553 }
554
555
556 public org.andromda.metafacades.uml.OperationFacade getOverriddenOperation()
557 {
558 return this.getSuperEntityQueryOperation().getOverriddenOperation();
559 }
560
561
562 public org.andromda.metafacades.uml.ClassifierFacade getOwner()
563 {
564 return this.getSuperEntityQueryOperation().getOwner();
565 }
566
567
568 public java.util.Collection getParameters()
569 {
570 return this.getSuperEntityQueryOperation().getParameters();
571 }
572
573
574 public java.lang.String getPostconditionName()
575 {
576 return this.getSuperEntityQueryOperation().getPostconditionName();
577 }
578
579
580 public java.util.Collection getPostconditions()
581 {
582 return this.getSuperEntityQueryOperation().getPostconditions();
583 }
584
585
586 public java.lang.String getPreconditionCall()
587 {
588 return this.getSuperEntityQueryOperation().getPreconditionCall();
589 }
590
591
592 public java.lang.String getPreconditionName()
593 {
594 return this.getSuperEntityQueryOperation().getPreconditionName();
595 }
596
597
598 public java.lang.String getPreconditionSignature()
599 {
600 return this.getSuperEntityQueryOperation().getPreconditionSignature();
601 }
602
603
604 public java.util.Collection getPreconditions()
605 {
606 return this.getSuperEntityQueryOperation().getPreconditions();
607 }
608
609
610 public org.andromda.metafacades.uml.ParameterFacade getReturnParameter()
611 {
612 return this.getSuperEntityQueryOperation().getReturnParameter();
613 }
614
615
616 public org.andromda.metafacades.uml.ClassifierFacade getReturnType()
617 {
618 return this.getSuperEntityQueryOperation().getReturnType();
619 }
620
621
622 public java.lang.String getSignature(boolean withArgumentNames)
623 {
624 return this.getSuperEntityQueryOperation().getSignature(withArgumentNames);
625 }
626
627
628 public java.lang.String getSignature()
629 {
630 return this.getSuperEntityQueryOperation().getSignature();
631 }
632
633
634 public java.lang.String getSignature(java.lang.String argumentModifier)
635 {
636 return this.getSuperEntityQueryOperation().getSignature(argumentModifier);
637 }
638
639
640 public java.lang.String getTypedArgumentList(java.lang.String modifier)
641 {
642 return this.getSuperEntityQueryOperation().getTypedArgumentList(modifier);
643 }
644
645
646 public java.lang.String getTypedArgumentList()
647 {
648 return this.getSuperEntityQueryOperation().getTypedArgumentList();
649 }
650
651
652 public int getUpper()
653 {
654 return this.getSuperEntityQueryOperation().getUpper();
655 }
656
657
658 public boolean isAbstract()
659 {
660 return this.getSuperEntityQueryOperation().isAbstract();
661 }
662
663
664 public boolean isExceptionsPresent()
665 {
666 return this.getSuperEntityQueryOperation().isExceptionsPresent();
667 }
668
669
670 public boolean isOverriding()
671 {
672 return this.getSuperEntityQueryOperation().isOverriding();
673 }
674
675
676 public boolean isPostconditionsPresent()
677 {
678 return this.getSuperEntityQueryOperation().isPostconditionsPresent();
679 }
680
681
682 public boolean isPreconditionsPresent()
683 {
684 return this.getSuperEntityQueryOperation().isPreconditionsPresent();
685 }
686
687
688 public boolean isQuery()
689 {
690 return this.getSuperEntityQueryOperation().isQuery();
691 }
692
693
694 public boolean isReturnTypePresent()
695 {
696 return this.getSuperEntityQueryOperation().isReturnTypePresent();
697 }
698
699
700 public boolean isStatic()
701 {
702 return this.getSuperEntityQueryOperation().isStatic();
703 }
704
705 /***
706 * @see org.andromda.core.metafacade.MetafacadeBase#initialize()
707 */
708 public void initialize()
709 {
710 this.getSuperEntityQueryOperation().initialize();
711 }
712
713 /***
714 * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner()
715 */
716 public Object getValidationOwner()
717 {
718 Object owner = this.getSuperEntityQueryOperation().getValidationOwner();
719 return owner;
720 }
721
722 /***
723 * @see org.andromda.core.metafacade.MetafacadeBase#getValidationName()
724 */
725 public String getValidationName()
726 {
727 String name = this.getSuperEntityQueryOperation().getValidationName();
728 return name;
729 }
730
731 /***
732 * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(java.util.Collection)
733 */
734 public void validateInvariants(java.util.Collection validationMessages)
735 {
736 this.getSuperEntityQueryOperation().validateInvariants(validationMessages);
737 {
738 final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(!Boolean.valueOf(String.valueOf(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"useNamedParameters"))).booleanValue())).booleanValue()?org.andromda.translation.ocl.validation.OCLCollections.forAll(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"arguments"),new org.apache.commons.collections.Predicate(){public boolean evaluate(java.lang.Object object){return Boolean.valueOf(String.valueOf(!Boolean.valueOf(String.valueOf(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(object,"type.collectionType"))).booleanValue())).booleanValue();}}):true));
739 if (!constraintValid)
740 validationMessages.add(
741 new org.andromda.core.metafacade.ModelValidationMessage(
742 (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
743 "org::andromda::cartridges::spring::metafacades::SpringQueryOperation::collection parameters must use named parameters",
744 "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."));
745 }
746 }
747
748 /***
749 * The property that stores the name of the metafacade.
750 */
751 private static final String NAME_PROPERTY = "name";
752
753 /***
754 * @see java.lang.Object#toString()
755 */
756 public String toString()
757 {
758 final StringBuffer toString = new StringBuffer(this.getClass().getName());
759 toString.append("[");
760 try
761 {
762 toString.append(org.andromda.core.common.Introspector.instance().getProperty(this, NAME_PROPERTY));
763 }
764 catch (final Throwable throwable)
765 {
766
767 }
768 toString.append("]");
769 return toString.toString();
770 }
771 }