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 java.util.Map;
10 import org.andromda.core.common.Introspector;
11 import org.andromda.core.metafacade.MetafacadeBase;
12 import org.andromda.core.metafacade.MetafacadeFactory;
13 import org.andromda.core.metafacade.ModelValidationMessage;
14 import org.andromda.metafacades.uml.ActionFacade;
15 import org.andromda.metafacades.uml.ConstraintFacade;
16 import org.andromda.metafacades.uml.DependencyFacade;
17 import org.andromda.metafacades.uml.EventFacade;
18 import org.andromda.metafacades.uml.FrontEndAction;
19 import org.andromda.metafacades.uml.FrontEndActivityGraph;
20 import org.andromda.metafacades.uml.FrontEndControllerOperation;
21 import org.andromda.metafacades.uml.FrontEndEvent;
22 import org.andromda.metafacades.uml.FrontEndExceptionHandler;
23 import org.andromda.metafacades.uml.FrontEndParameter;
24 import org.andromda.metafacades.uml.FrontEndUseCase;
25 import org.andromda.metafacades.uml.GuardFacade;
26 import org.andromda.metafacades.uml.ModelElementFacade;
27 import org.andromda.metafacades.uml.ModelFacade;
28 import org.andromda.metafacades.uml.PackageFacade;
29 import org.andromda.metafacades.uml.StateMachineFacade;
30 import org.andromda.metafacades.uml.StateVertexFacade;
31 import org.andromda.metafacades.uml.StereotypeFacade;
32 import org.andromda.metafacades.uml.TaggedValueFacade;
33 import org.andromda.metafacades.uml.TemplateParameterFacade;
34 import org.andromda.metafacades.uml.TypeMappings;
35 import org.andromda.translation.ocl.validation.OCLExpressions;
36 import org.andromda.translation.ocl.validation.OCLIntrospector;
37 import org.andromda.translation.ocl.validation.OCLResultEnsurer;
38 import org.apache.log4j.Logger;
39
40 /**
41 * A Struts exception handler intercepts action exceptions and delegates them into a page that will
42 * handle it, by for example simply displaying it.
43 * MetafacadeLogic for StrutsExceptionHandler
44 *
45 * @see StrutsExceptionHandler
46 */
47 public abstract class StrutsExceptionHandlerLogic
48 extends MetafacadeBase
49 implements StrutsExceptionHandler
50 {
51 /**
52 * The underlying UML object
53 * @see Object
54 */
55 protected Object metaObject;
56
57 /** Create Metafacade implementation instance using the MetafacadeFactory from the context
58 * @param metaObjectIn
59 * @param context
60 */
61 protected StrutsExceptionHandlerLogic(Object metaObjectIn, String context)
62 {
63 super(metaObjectIn, getContext(context));
64 this.superFrontEndExceptionHandler =
65 (FrontEndExceptionHandler)
66 MetafacadeFactory.getInstance().createFacadeImpl(
67 "org.andromda.metafacades.uml.FrontEndExceptionHandler",
68 metaObjectIn,
69 getContext(context));
70 this.superStrutsForward =
71 (StrutsForward)
72 MetafacadeFactory.getInstance().createFacadeImpl(
73 "org.andromda.cartridges.bpm4struts.metafacades.StrutsForward",
74 metaObjectIn,
75 getContext(context));
76 this.metaObject = metaObjectIn;
77 }
78
79 /**
80 * The logger instance.
81 */
82 private static final Logger logger = Logger.getLogger(StrutsExceptionHandlerLogic.class);
83
84 /**
85 * Gets the context for this metafacade logic instance.
86 * @param context String. Set to StrutsExceptionHandler if null
87 * @return context String
88 */
89 private static String getContext(String context)
90 {
91 if (context == null)
92 {
93 context = "org.andromda.cartridges.bpm4struts.metafacades.StrutsExceptionHandler";
94 }
95 return context;
96 }
97
98 private FrontEndExceptionHandler superFrontEndExceptionHandler;
99 private boolean superFrontEndExceptionHandlerInitialized = false;
100
101 /**
102 * Gets the FrontEndExceptionHandler parent instance.
103 * @return this.superFrontEndExceptionHandler FrontEndExceptionHandler
104 */
105 protected FrontEndExceptionHandler getSuperFrontEndExceptionHandler()
106 {
107 if (!this.superFrontEndExceptionHandlerInitialized)
108 {
109 ((MetafacadeBase)this.superFrontEndExceptionHandler).setMetafacadeContext(this.getMetafacadeContext());
110 this.superFrontEndExceptionHandlerInitialized = true;
111 }
112 return this.superFrontEndExceptionHandler;
113 }
114
115 private StrutsForward superStrutsForward;
116 private boolean superStrutsForwardInitialized = false;
117
118 /**
119 * Gets the StrutsForward parent instance.
120 * @return this.superStrutsForward StrutsForward
121 */
122 protected StrutsForward getSuperStrutsForward()
123 {
124 if (!this.superStrutsForwardInitialized)
125 {
126 ((MetafacadeBase)this.superStrutsForward).setMetafacadeContext(this.getMetafacadeContext());
127 this.superStrutsForwardInitialized = true;
128 }
129 return this.superStrutsForward;
130 }
131
132 /** Reset context only for non-root metafacades
133 * @param context
134 * @see MetafacadeBase#resetMetafacadeContext(String context)
135 */
136 @Override
137 public void resetMetafacadeContext(String context)
138 {
139 if (!this.contextRoot) // reset context only for non-root metafacades
140 {
141 context = getContext(context); // to have same value as in original constructor call
142 setMetafacadeContext (context);
143 if (this.superFrontEndExceptionHandlerInitialized)
144 {
145 ((MetafacadeBase)this.superFrontEndExceptionHandler).resetMetafacadeContext(context);
146 }
147 if (this.superStrutsForwardInitialized)
148 {
149 ((MetafacadeBase)this.superStrutsForward).resetMetafacadeContext(context);
150 }
151 }
152 }
153
154 /**
155 * @return boolean true always
156 * @see StrutsExceptionHandler
157 */
158 public boolean isStrutsExceptionHandlerMetaType()
159 {
160 return true;
161 }
162
163 // --------------- attributes ---------------------
164
165 /**
166 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsExceptionHandler#getExceptionKey()
167 * @return String
168 */
169 protected abstract String handleGetExceptionKey();
170
171 private String __exceptionKey1a;
172 private boolean __exceptionKey1aSet = false;
173
174 /**
175 * The key to use with this handler's message resource bundle that will retrieve the error
176 * message template for this exception.
177 * @return (String)handleGetExceptionKey()
178 */
179 public final String getExceptionKey()
180 {
181 String exceptionKey1a = this.__exceptionKey1a;
182 if (!this.__exceptionKey1aSet)
183 {
184 // exceptionKey has no pre constraints
185 exceptionKey1a = handleGetExceptionKey();
186 // exceptionKey has no post constraints
187 this.__exceptionKey1a = exceptionKey1a;
188 if (isMetafacadePropertyCachingEnabled())
189 {
190 this.__exceptionKey1aSet = true;
191 }
192 }
193 return exceptionKey1a;
194 }
195
196 /**
197 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsExceptionHandler#getExceptionType()
198 * @return String
199 */
200 protected abstract String handleGetExceptionType();
201
202 private String __exceptionType2a;
203 private boolean __exceptionType2aSet = false;
204
205 /**
206 * Fully qualified Java class name of the exception type to register with this handler.
207 * @return (String)handleGetExceptionType()
208 */
209 public final String getExceptionType()
210 {
211 String exceptionType2a = this.__exceptionType2a;
212 if (!this.__exceptionType2aSet)
213 {
214 // exceptionType has no pre constraints
215 exceptionType2a = handleGetExceptionType();
216 // exceptionType has no post constraints
217 this.__exceptionType2a = exceptionType2a;
218 if (isMetafacadePropertyCachingEnabled())
219 {
220 this.__exceptionType2aSet = true;
221 }
222 }
223 return exceptionType2a;
224 }
225
226 /**
227 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsExceptionHandler#getExceptionPath()
228 * @return String
229 */
230 protected abstract String handleGetExceptionPath();
231
232 private String __exceptionPath3a;
233 private boolean __exceptionPath3aSet = false;
234
235 /**
236 * The module-relative URI to the resource that will complete the request/response if this
237 * exception occurs.
238 * @return (String)handleGetExceptionPath()
239 */
240 public final String getExceptionPath()
241 {
242 String exceptionPath3a = this.__exceptionPath3a;
243 if (!this.__exceptionPath3aSet)
244 {
245 // exceptionPath has no pre constraints
246 exceptionPath3a = handleGetExceptionPath();
247 // exceptionPath has no post constraints
248 this.__exceptionPath3a = exceptionPath3a;
249 if (isMetafacadePropertyCachingEnabled())
250 {
251 this.__exceptionPath3aSet = true;
252 }
253 }
254 return exceptionPath3a;
255 }
256
257 /**
258 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsExceptionHandler#getMessageKey()
259 * @return String
260 */
261 protected abstract String handleGetMessageKey();
262
263 private String __messageKey4a;
264 private boolean __messageKey4aSet = false;
265
266 /**
267 * TODO: Model Documentation for
268 * org.andromda.cartridges.bpm4struts.metafacades.StrutsExceptionHandler.messageKey
269 * @return (String)handleGetMessageKey()
270 */
271 public final String getMessageKey()
272 {
273 String messageKey4a = this.__messageKey4a;
274 if (!this.__messageKey4aSet)
275 {
276 // messageKey has no pre constraints
277 messageKey4a = handleGetMessageKey();
278 // messageKey has no post constraints
279 this.__messageKey4a = messageKey4a;
280 if (isMetafacadePropertyCachingEnabled())
281 {
282 this.__messageKey4aSet = true;
283 }
284 }
285 return messageKey4a;
286 }
287
288 // ------------- associations ------------------
289
290 /**
291 * @return true
292 * @see FrontEndExceptionHandler
293 */
294 public boolean isFrontEndExceptionHandlerMetaType()
295 {
296 return true;
297 }
298
299 /**
300 * @return true
301 * @see StrutsForward
302 */
303 public boolean isStrutsForwardMetaType()
304 {
305 return true;
306 }
307
308 /**
309 * @return true
310 * @see org.andromda.metafacades.uml.FrontEndForward
311 */
312 public boolean isFrontEndForwardMetaType()
313 {
314 return true;
315 }
316
317 /**
318 * @return true
319 * @see org.andromda.metafacades.uml.TransitionFacade
320 */
321 public boolean isTransitionFacadeMetaType()
322 {
323 return true;
324 }
325
326 /**
327 * @return true
328 * @see ModelElementFacade
329 */
330 public boolean isModelElementFacadeMetaType()
331 {
332 return true;
333 }
334
335 // ----------- delegates to FrontEndExceptionHandler ------------
336 /**
337 * Indicatesif this element carries the FrontEndException stereotype.
338 * @see FrontEndExceptionHandler#isFrontEndException()
339 */
340 public boolean isFrontEndException()
341 {
342 return this.getSuperFrontEndExceptionHandler().isFrontEndException();
343 }
344
345 /**
346 * The method name used to delegate to this forward.
347 * @see org.andromda.metafacades.uml.FrontEndForward#getActionMethodName()
348 */
349 public String getActionMethodName()
350 {
351 return this.getSuperFrontEndExceptionHandler().getActionMethodName();
352 }
353
354 /**
355 * The front-end actions directly containing this front-end forward.
356 * @see org.andromda.metafacades.uml.FrontEndForward#getActions()
357 */
358 public List<FrontEndAction> getActions()
359 {
360 return this.getSuperFrontEndExceptionHandler().getActions();
361 }
362
363 /**
364 * The trigger for this front-end forward.
365 * @see org.andromda.metafacades.uml.FrontEndForward#getDecisionTrigger()
366 */
367 public FrontEndEvent getDecisionTrigger()
368 {
369 return this.getSuperFrontEndExceptionHandler().getDecisionTrigger();
370 }
371
372 /**
373 * Tthe set of parameter used during transport in this forward.
374 * @see org.andromda.metafacades.uml.FrontEndForward#getForwardParameters()
375 */
376 public List<FrontEndParameter> getForwardParameters()
377 {
378 return this.getSuperFrontEndExceptionHandler().getForwardParameters();
379 }
380
381 /**
382 * The activity graph which holds this forward if the graph is contained in a FrontEndUseCase.
383 * @see org.andromda.metafacades.uml.FrontEndForward#getFrontEndActivityGraph()
384 */
385 public FrontEndActivityGraph getFrontEndActivityGraph()
386 {
387 return this.getSuperFrontEndExceptionHandler().getFrontEndActivityGraph();
388 }
389
390 /**
391 * The operation to which is called during execution of this front-end forward.
392 * @see org.andromda.metafacades.uml.FrontEndForward#getOperationCall()
393 */
394 public FrontEndControllerOperation getOperationCall()
395 {
396 return this.getSuperFrontEndExceptionHandler().getOperationCall();
397 }
398
399 /**
400 * The use case in which this forward is contained.
401 * @see org.andromda.metafacades.uml.FrontEndForward#getUseCase()
402 */
403 public FrontEndUseCase getUseCase()
404 {
405 return this.getSuperFrontEndExceptionHandler().getUseCase();
406 }
407
408 /**
409 * Indicates if this forward is contained in a FrontEndUseCase.
410 * @see org.andromda.metafacades.uml.FrontEndForward#isContainedInFrontEndUseCase()
411 */
412 public boolean isContainedInFrontEndUseCase()
413 {
414 return this.getSuperFrontEndExceptionHandler().isContainedInFrontEndUseCase();
415 }
416
417 /**
418 * Indicates if this action directly targets a "front-end" view, false otherwise.
419 * @see org.andromda.metafacades.uml.FrontEndForward#isEnteringView()
420 */
421 public boolean isEnteringView()
422 {
423 return this.getSuperFrontEndExceptionHandler().isEnteringView();
424 }
425
426 /**
427 * Indicates if this forward (transition) is coming out of a front-end view.
428 * @see org.andromda.metafacades.uml.FrontEndForward#isExitingView()
429 */
430 public boolean isExitingView()
431 {
432 return this.getSuperFrontEndExceptionHandler().isExitingView();
433 }
434
435 /**
436 * Copies all tagged values from the given ModelElementFacade to this model element facade.
437 * @see ModelElementFacade#copyTaggedValues(ModelElementFacade element)
438 */
439 public void copyTaggedValues(ModelElementFacade element)
440 {
441 this.getSuperFrontEndExceptionHandler().copyTaggedValues(element);
442 }
443
444 /**
445 * Finds the tagged value with the specified 'tagName'. In case there are more values the first
446 * one found will be returned.
447 * @see ModelElementFacade#findTaggedValue(String tagName)
448 */
449 public Object findTaggedValue(String tagName)
450 {
451 return this.getSuperFrontEndExceptionHandler().findTaggedValue(tagName);
452 }
453
454 /**
455 * Returns all the values for the tagged value with the specified name. The returned collection
456 * will contains only String instances, or will be empty. Never null.
457 * @see ModelElementFacade#findTaggedValues(String tagName)
458 */
459 public Collection<Object> findTaggedValues(String tagName)
460 {
461 return this.getSuperFrontEndExceptionHandler().findTaggedValues(tagName);
462 }
463
464 /**
465 * Returns the fully qualified name of the model element. The fully qualified name includes
466 * complete package qualified name of the underlying model element. The templates parameter will
467 * be replaced by the correct one given the binding relation of the parameter to this element.
468 * @see ModelElementFacade#getBindedFullyQualifiedName(ModelElementFacade bindedElement)
469 */
470 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
471 {
472 return this.getSuperFrontEndExceptionHandler().getBindedFullyQualifiedName(bindedElement);
473 }
474
475 /**
476 * Gets all constraints belonging to the model element.
477 * @see ModelElementFacade#getConstraints()
478 */
479 public Collection<ConstraintFacade> getConstraints()
480 {
481 return this.getSuperFrontEndExceptionHandler().getConstraints();
482 }
483
484 /**
485 * Returns the constraints of the argument kind that have been placed onto this model. Typical
486 * kinds are "inv", "pre" and "post". Other kinds are possible.
487 * @see ModelElementFacade#getConstraints(String kind)
488 */
489 public Collection<ConstraintFacade> getConstraints(String kind)
490 {
491 return this.getSuperFrontEndExceptionHandler().getConstraints(kind);
492 }
493
494 /**
495 * Gets the documentation for the model element, The indent argument is prefixed to each line.
496 * By default this method wraps lines after 64 characters.
497 * This method is equivalent to <code>getDocumentation(indent, 64)</code>.
498 * @see ModelElementFacade#getDocumentation(String indent)
499 */
500 public String getDocumentation(String indent)
501 {
502 return this.getSuperFrontEndExceptionHandler().getDocumentation(indent);
503 }
504
505 /**
506 * This method returns the documentation for this model element, with the lines wrapped after
507 * the specified number of characters, values of less than 1 will indicate no line wrapping is
508 * required. By default paragraphs are returned as HTML.
509 * This method is equivalent to <code>getDocumentation(indent, lineLength, true)</code>.
510 * @see ModelElementFacade#getDocumentation(String indent, int lineLength)
511 */
512 public String getDocumentation(String indent, int lineLength)
513 {
514 return this.getSuperFrontEndExceptionHandler().getDocumentation(indent, lineLength);
515 }
516
517 /**
518 * This method returns the documentation for this model element, with the lines wrapped after
519 * the specified number of characters, values of less than 1 will indicate no line wrapping is
520 * required. HTML style determines if HTML Escaping is applied.
521 * @see ModelElementFacade#getDocumentation(String indent, int lineLength, boolean htmlStyle)
522 */
523 public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
524 {
525 return this.getSuperFrontEndExceptionHandler().getDocumentation(indent, lineLength, htmlStyle);
526 }
527
528 /**
529 * The fully qualified name of this model element.
530 * @see ModelElementFacade#getFullyQualifiedName()
531 */
532 public String getFullyQualifiedName()
533 {
534 return this.getSuperFrontEndExceptionHandler().getFullyQualifiedName();
535 }
536
537 /**
538 * Returns the fully qualified name of the model element. The fully qualified name includes
539 * complete package qualified name of the underlying model element. If modelName is true, then
540 * the original name of the model element (the name contained within the model) will be the name
541 * returned, otherwise a name from a language mapping will be returned.
542 * @see ModelElementFacade#getFullyQualifiedName(boolean modelName)
543 */
544 public String getFullyQualifiedName(boolean modelName)
545 {
546 return this.getSuperFrontEndExceptionHandler().getFullyQualifiedName(modelName);
547 }
548
549 /**
550 * Returns the fully qualified name as a path, the returned value always starts with out a slash
551 * '/'.
552 * @see ModelElementFacade#getFullyQualifiedNamePath()
553 */
554 public String getFullyQualifiedNamePath()
555 {
556 return this.getSuperFrontEndExceptionHandler().getFullyQualifiedNamePath();
557 }
558
559 /**
560 * Gets the unique identifier of the underlying model element.
561 * @see ModelElementFacade#getId()
562 */
563 public String getId()
564 {
565 return this.getSuperFrontEndExceptionHandler().getId();
566 }
567
568 /**
569 * UML2: Retrieves the keywords for this element. Used to modify implementation properties which
570 * are not represented by other properties, i.e. native, transient, volatile, synchronized,
571 * (added annotations) override, deprecated. Can also be used to suppress compiler warnings:
572 * (added annotations) unchecked, fallthrough, path, serial, finally, all. Annotations require
573 * JDK5 compiler level.
574 * @see ModelElementFacade#getKeywords()
575 */
576 public Collection<String> getKeywords()
577 {
578 return this.getSuperFrontEndExceptionHandler().getKeywords();
579 }
580
581 /**
582 * UML2: Retrieves a localized label for this named element.
583 * @see ModelElementFacade#getLabel()
584 */
585 public String getLabel()
586 {
587 return this.getSuperFrontEndExceptionHandler().getLabel();
588 }
589
590 /**
591 * The language mappings that have been set for this model element.
592 * @see ModelElementFacade#getLanguageMappings()
593 */
594 public TypeMappings getLanguageMappings()
595 {
596 return this.getSuperFrontEndExceptionHandler().getLanguageMappings();
597 }
598
599 /**
600 * Return the model containing this model element (multiple models may be loaded and processed
601 * at the same time).
602 * @see ModelElementFacade#getModel()
603 */
604 public ModelFacade getModel()
605 {
606 return this.getSuperFrontEndExceptionHandler().getModel();
607 }
608
609 /**
610 * The name of the model element.
611 * @see ModelElementFacade#getName()
612 */
613 public String getName()
614 {
615 return this.getSuperFrontEndExceptionHandler().getName();
616 }
617
618 /**
619 * Gets the package to which this model element belongs.
620 * @see ModelElementFacade#getPackage()
621 */
622 public ModelElementFacade getPackage()
623 {
624 return this.getSuperFrontEndExceptionHandler().getPackage();
625 }
626
627 /**
628 * The name of this model element's package.
629 * @see ModelElementFacade#getPackageName()
630 */
631 public String getPackageName()
632 {
633 return this.getSuperFrontEndExceptionHandler().getPackageName();
634 }
635
636 /**
637 * Gets the package name (optionally providing the ability to retrieve the model name and not
638 * the mapped name).
639 * @see ModelElementFacade#getPackageName(boolean modelName)
640 */
641 public String getPackageName(boolean modelName)
642 {
643 return this.getSuperFrontEndExceptionHandler().getPackageName(modelName);
644 }
645
646 /**
647 * Returns the package as a path, the returned value always starts with out a slash '/'.
648 * @see ModelElementFacade#getPackagePath()
649 */
650 public String getPackagePath()
651 {
652 return this.getSuperFrontEndExceptionHandler().getPackagePath();
653 }
654
655 /**
656 * UML2: Returns the value of the 'Qualified Name' attribute. A name which allows the
657 * NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from
658 * the names of the containing namespaces starting at the root of the hierarchy and ending with
659 * the name of the NamedElement itself.
660 * @see ModelElementFacade#getQualifiedName()
661 */
662 public String getQualifiedName()
663 {
664 return this.getSuperFrontEndExceptionHandler().getQualifiedName();
665 }
666
667 /**
668 * Gets the root package for the model element.
669 * @see ModelElementFacade#getRootPackage()
670 */
671 public PackageFacade getRootPackage()
672 {
673 return this.getSuperFrontEndExceptionHandler().getRootPackage();
674 }
675
676 /**
677 * Gets the dependencies for which this model element is the source.
678 * @see ModelElementFacade#getSourceDependencies()
679 */
680 public Collection<DependencyFacade> getSourceDependencies()
681 {
682 return this.getSuperFrontEndExceptionHandler().getSourceDependencies();
683 }
684
685 /**
686 * If this model element is the context of an activity graph, this represents that activity
687 * graph.
688 * @see ModelElementFacade#getStateMachineContext()
689 */
690 public StateMachineFacade getStateMachineContext()
691 {
692 return this.getSuperFrontEndExceptionHandler().getStateMachineContext();
693 }
694
695 /**
696 * The collection of ALL stereotype names for this model element.
697 * @see ModelElementFacade#getStereotypeNames()
698 */
699 public Collection<String> getStereotypeNames()
700 {
701 return this.getSuperFrontEndExceptionHandler().getStereotypeNames();
702 }
703
704 /**
705 * Gets all stereotypes for this model element.
706 * @see ModelElementFacade#getStereotypes()
707 */
708 public Collection<StereotypeFacade> getStereotypes()
709 {
710 return this.getSuperFrontEndExceptionHandler().getStereotypes();
711 }
712
713 /**
714 * Return the TaggedValues associated with this model element, under all stereotypes.
715 * @see ModelElementFacade#getTaggedValues()
716 */
717 public Collection<TaggedValueFacade> getTaggedValues()
718 {
719 return this.getSuperFrontEndExceptionHandler().getTaggedValues();
720 }
721
722 /**
723 * Gets the dependencies for which this model element is the target.
724 * @see ModelElementFacade#getTargetDependencies()
725 */
726 public Collection<DependencyFacade> getTargetDependencies()
727 {
728 return this.getSuperFrontEndExceptionHandler().getTargetDependencies();
729 }
730
731 /**
732 * Get the template parameter for this model element having the parameterName
733 * @see ModelElementFacade#getTemplateParameter(String parameterName)
734 */
735 public Object getTemplateParameter(String parameterName)
736 {
737 return this.getSuperFrontEndExceptionHandler().getTemplateParameter(parameterName);
738 }
739
740 /**
741 * Get the template parameters for this model element
742 * @see ModelElementFacade#getTemplateParameters()
743 */
744 public Collection<TemplateParameterFacade> getTemplateParameters()
745 {
746 return this.getSuperFrontEndExceptionHandler().getTemplateParameters();
747 }
748
749 /**
750 * The visibility (i.e. public, private, protected or package) of the model element, will
751 * attempt a lookup for these values in the language mappings (if any).
752 * @see ModelElementFacade#getVisibility()
753 */
754 public String getVisibility()
755 {
756 return this.getSuperFrontEndExceptionHandler().getVisibility();
757 }
758
759 /**
760 * Returns true if the model element has the exact stereotype (meaning no stereotype inheritance
761 * is taken into account when searching for the stereotype), false otherwise.
762 * @see ModelElementFacade#hasExactStereotype(String stereotypeName)
763 */
764 public boolean hasExactStereotype(String stereotypeName)
765 {
766 return this.getSuperFrontEndExceptionHandler().hasExactStereotype(stereotypeName);
767 }
768
769 /**
770 * Does the UML Element contain the named Keyword? Keywords can be separated by space, comma,
771 * pipe, semicolon, or << >>
772 * @see ModelElementFacade#hasKeyword(String keywordName)
773 */
774 public boolean hasKeyword(String keywordName)
775 {
776 return this.getSuperFrontEndExceptionHandler().hasKeyword(keywordName);
777 }
778
779 /**
780 * Returns true if the model element has the specified stereotype. If the stereotype itself
781 * does not match, then a search will be made up the stereotype inheritance hierarchy, and if
782 * one of the stereotype's ancestors has a matching name this method will return true, false
783 * otherwise.
784 * For example, if we have a certain stereotype called <<exception>> and a model element has a
785 * stereotype called <<applicationException>> which extends <<exception>>, when calling this
786 * method with 'stereotypeName' defined as 'exception' the method would return true since
787 * <<applicationException>> inherits from <<exception>>. If you want to check if the model
788 * element has the exact stereotype, then use the method 'hasExactStereotype' instead.
789 * @see ModelElementFacade#hasStereotype(String stereotypeName)
790 */
791 public boolean hasStereotype(String stereotypeName)
792 {
793 return this.getSuperFrontEndExceptionHandler().hasStereotype(stereotypeName);
794 }
795
796 /**
797 * True if there are target dependencies from this element that are instances of BindingFacade.
798 * Deprecated in UML2: Use TemplateBinding parameters instead of dependencies.
799 * @see ModelElementFacade#isBindingDependenciesPresent()
800 */
801 public boolean isBindingDependenciesPresent()
802 {
803 return this.getSuperFrontEndExceptionHandler().isBindingDependenciesPresent();
804 }
805
806 /**
807 * Indicates if any constraints are present on this model element.
808 * @see ModelElementFacade#isConstraintsPresent()
809 */
810 public boolean isConstraintsPresent()
811 {
812 return this.getSuperFrontEndExceptionHandler().isConstraintsPresent();
813 }
814
815 /**
816 * Indicates if any documentation is present on this model element.
817 * @see ModelElementFacade#isDocumentationPresent()
818 */
819 public boolean isDocumentationPresent()
820 {
821 return this.getSuperFrontEndExceptionHandler().isDocumentationPresent();
822 }
823
824 /**
825 * True if this element name is a reserved word in Java, C#, ANSI or ISO C, C++, JavaScript.
826 * @see ModelElementFacade#isReservedWord()
827 */
828 public boolean isReservedWord()
829 {
830 return this.getSuperFrontEndExceptionHandler().isReservedWord();
831 }
832
833 /**
834 * True is there are template parameters on this model element. For UML2, applies to Class,
835 * Operation, Property, and Parameter.
836 * @see ModelElementFacade#isTemplateParametersPresent()
837 */
838 public boolean isTemplateParametersPresent()
839 {
840 return this.getSuperFrontEndExceptionHandler().isTemplateParametersPresent();
841 }
842
843 /**
844 * True if this element name is a valid identifier name in Java, C#, ANSI or ISO C, C++,
845 * JavaScript. Contains no spaces, special characters etc. Constraint always applied on
846 * Enumerations and Interfaces, optionally applies on other model elements.
847 * @see ModelElementFacade#isValidIdentifierName()
848 */
849 public boolean isValidIdentifierName()
850 {
851 return this.getSuperFrontEndExceptionHandler().isValidIdentifierName();
852 }
853
854 /**
855 * Searches for the constraint with the specified 'name' on this model element, and if found
856 * translates it using the specified 'translation' from a translation library discovered by the
857 * framework.
858 * @see ModelElementFacade#translateConstraint(String name, String translation)
859 */
860 public String translateConstraint(String name, String translation)
861 {
862 return this.getSuperFrontEndExceptionHandler().translateConstraint(name, translation);
863 }
864
865 /**
866 * Translates all constraints belonging to this model element with the given 'translation'.
867 * @see ModelElementFacade#translateConstraints(String translation)
868 */
869 public String[] translateConstraints(String translation)
870 {
871 return this.getSuperFrontEndExceptionHandler().translateConstraints(translation);
872 }
873
874 /**
875 * Translates the constraints of the specified 'kind' belonging to this model element.
876 * @see ModelElementFacade#translateConstraints(String kind, String translation)
877 */
878 public String[] translateConstraints(String kind, String translation)
879 {
880 return this.getSuperFrontEndExceptionHandler().translateConstraints(kind, translation);
881 }
882
883 /**
884 * An action is a named element that is the fundamental unit of executable functionality. The
885 * execution
886 * of an action represents some transformation or processing in the modeled system, be it a
887 * computer
888 * system or otherwise. An action represents a single step within an activity, that is, one that
889 * is not
890 * further decomposed within the activity. An action has pre- and post-conditions.
891 * @see org.andromda.metafacades.uml.TransitionFacade#getEffect()
892 */
893 public ActionFacade getEffect()
894 {
895 return this.getSuperFrontEndExceptionHandler().getEffect();
896 }
897
898 /**
899 * A representation of the model object 'Constraint'. A condition or restriction expressed in
900 * natural
901 * language text or in a machine readable language for the purpose of declaring some of the
902 * semantics
903 * of an element.
904 * @see org.andromda.metafacades.uml.TransitionFacade#getGuard()
905 */
906 public GuardFacade getGuard()
907 {
908 return this.getSuperFrontEndExceptionHandler().getGuard();
909 }
910
911 /**
912 * A representation of the model object 'Vertex'. An abstraction of a node in a state machine
913 * graph. In
914 * general, it can be the source or destination of any number of transitions.
915 * @see org.andromda.metafacades.uml.TransitionFacade#getSource()
916 */
917 public StateVertexFacade getSource()
918 {
919 return this.getSuperFrontEndExceptionHandler().getSource();
920 }
921
922 /**
923 * A representation of the model object 'Vertex'. An abstraction of a node in a state machine
924 * graph. In
925 * general, it can be the source or destination of any number of transitions.
926 * @see org.andromda.metafacades.uml.TransitionFacade#getTarget()
927 */
928 public StateVertexFacade getTarget()
929 {
930 return this.getSuperFrontEndExceptionHandler().getTarget();
931 }
932
933 /**
934 * If a trigger is present on this transition, this event represents that trigger.
935 * @see org.andromda.metafacades.uml.TransitionFacade#getTrigger()
936 */
937 public EventFacade getTrigger()
938 {
939 return this.getSuperFrontEndExceptionHandler().getTrigger();
940 }
941
942 /**
943 * TODO: Model Documentation for
944 * org.andromda.metafacades.uml.TransitionFacade.enteringActionState
945 * @see org.andromda.metafacades.uml.TransitionFacade#isEnteringActionState()
946 */
947 public boolean isEnteringActionState()
948 {
949 return this.getSuperFrontEndExceptionHandler().isEnteringActionState();
950 }
951
952 /**
953 * TODO: Model Documentation for
954 * org.andromda.metafacades.uml.TransitionFacade.enteringDecisionPoint
955 * @see org.andromda.metafacades.uml.TransitionFacade#isEnteringDecisionPoint()
956 */
957 public boolean isEnteringDecisionPoint()
958 {
959 return this.getSuperFrontEndExceptionHandler().isEnteringDecisionPoint();
960 }
961
962 /**
963 * TODO: Model Documentation for
964 * org.andromda.metafacades.uml.TransitionFacade.enteringFinalState
965 * @see org.andromda.metafacades.uml.TransitionFacade#isEnteringFinalState()
966 */
967 public boolean isEnteringFinalState()
968 {
969 return this.getSuperFrontEndExceptionHandler().isEnteringFinalState();
970 }
971
972 /**
973 * TODO: Model Documentation for
974 * org.andromda.metafacades.uml.TransitionFacade.exitingActionState
975 * @see org.andromda.metafacades.uml.TransitionFacade#isExitingActionState()
976 */
977 public boolean isExitingActionState()
978 {
979 return this.getSuperFrontEndExceptionHandler().isExitingActionState();
980 }
981
982 /**
983 * TODO: Model Documentation for
984 * org.andromda.metafacades.uml.TransitionFacade.exitingDecisionPoint
985 * @see org.andromda.metafacades.uml.TransitionFacade#isExitingDecisionPoint()
986 */
987 public boolean isExitingDecisionPoint()
988 {
989 return this.getSuperFrontEndExceptionHandler().isExitingDecisionPoint();
990 }
991
992 /**
993 * TODO: Model Documentation for
994 * org.andromda.metafacades.uml.TransitionFacade.exitingInitialState
995 * @see org.andromda.metafacades.uml.TransitionFacade#isExitingInitialState()
996 */
997 public boolean isExitingInitialState()
998 {
999 return this.getSuperFrontEndExceptionHandler().isExitingInitialState();
1000 }
1001
1002 /**
1003 * TODO: Model Documentation for org.andromda.metafacades.uml.TransitionFacade.triggerPresent
1004 * @see org.andromda.metafacades.uml.TransitionFacade#isTriggerPresent()
1005 */
1006 public boolean isTriggerPresent()
1007 {
1008 return this.getSuperFrontEndExceptionHandler().isTriggerPresent();
1009 }
1010
1011 // ----------- delegates to StrutsForward ------------
1012 /**
1013 * The name for this forward. This name is always lowercase and words are separated using dots,
1014 * not unlike the convention for Java package names.
1015 * @see StrutsForward#getForwardName()
1016 */
1017 public String getForwardName()
1018 {
1019 return this.getSuperStrutsForward().getForwardName();
1020 }
1021
1022 /**
1023 * Returns the path targetted by this forward.
1024 * @see StrutsForward#getForwardPath()
1025 */
1026 public String getForwardPath()
1027 {
1028 return this.getSuperStrutsForward().getForwardPath();
1029 }
1030
1031 /**
1032 * If this forward is guarded (such as with decision points) this method return the name of that
1033 * guard.
1034 * @see StrutsForward#getGuardName()
1035 */
1036 public String getGuardName()
1037 {
1038 return this.getSuperStrutsForward().getGuardName();
1039 }
1040
1041 /**
1042 * Returns the activity graph which holds this action if the graph is contained in a
1043 * FrontEndUseCase.
1044 * @see StrutsForward#getStrutsActivityGraph()
1045 */
1046 public StrutsActivityGraph getStrutsActivityGraph()
1047 {
1048 return this.getSuperStrutsForward().getStrutsActivityGraph();
1049 }
1050
1051 /**
1052 * A map of key=value pairs, one for each success message.
1053 * @see StrutsForward#getSuccessMessages()
1054 */
1055 public Map getSuccessMessages()
1056 {
1057 return this.getSuperStrutsForward().getSuccessMessages();
1058 }
1059
1060 /**
1061 * The resource bundle key of the name for the target element. This method returns the key for
1062 * the use-case or jsp page. If targetting anything else this method returns null.
1063 * @see StrutsForward#getTargetNameKey()
1064 */
1065 public String getTargetNameKey()
1066 {
1067 return this.getSuperStrutsForward().getTargetNameKey();
1068 }
1069
1070 /**
1071 * A map of key=value pairs, one for each warning message.
1072 * @see StrutsForward#getWarningMessages()
1073 */
1074 public Map getWarningMessages()
1075 {
1076 return this.getSuperStrutsForward().getWarningMessages();
1077 }
1078
1079 /**
1080 * True if this action directly targets a JSP page, false otherwise.
1081 * @see StrutsForward#isEnteringPage()
1082 */
1083 public boolean isEnteringPage()
1084 {
1085 return this.getSuperStrutsForward().isEnteringPage();
1086 }
1087
1088 /**
1089 * Whether or not this forward (transition) is coming out of a page.
1090 * @see StrutsForward#isExitingPage()
1091 */
1092 public boolean isExitingPage()
1093 {
1094 return this.getSuperStrutsForward().isExitingPage();
1095 }
1096
1097 /**
1098 * TODO: Model Documentation for
1099 * StrutsForward.successMessagesPresent
1100 * @see StrutsForward#isSuccessMessagesPresent()
1101 */
1102 public boolean isSuccessMessagesPresent()
1103 {
1104 return this.getSuperStrutsForward().isSuccessMessagesPresent();
1105 }
1106
1107 /**
1108 * TODO: Model Documentation for
1109 * StrutsForward.warningMessagesPresent
1110 * @see StrutsForward#isWarningMessagesPresent()
1111 */
1112 public boolean isWarningMessagesPresent()
1113 {
1114 return this.getSuperStrutsForward().isWarningMessagesPresent();
1115 }
1116
1117 /**
1118 * @see MetafacadeBase#initialize()
1119 */
1120 @Override
1121 public void initialize()
1122 {
1123 this.getSuperFrontEndExceptionHandler().initialize();
1124 this.getSuperStrutsForward().initialize();
1125 }
1126
1127 /**
1128 * @return Object getSuperFrontEndExceptionHandler().getValidationOwner()
1129 * @see MetafacadeBase#getValidationOwner()
1130 */
1131 @Override
1132 public Object getValidationOwner()
1133 {
1134 Object owner = this.getSuperFrontEndExceptionHandler().getValidationOwner();
1135 if (owner == null)
1136 {
1137 owner = this.getSuperStrutsForward().getValidationOwner();
1138 }
1139 return owner;
1140 }
1141
1142 /**
1143 * @return String getSuperFrontEndExceptionHandler().getValidationName()
1144 * @see MetafacadeBase#getValidationName()
1145 */
1146 @Override
1147 public String getValidationName()
1148 {
1149 String name = this.getSuperFrontEndExceptionHandler().getValidationName();
1150 if (name == null)
1151 {
1152 name = this.getSuperStrutsForward().getValidationName();
1153 }
1154 return name;
1155 }
1156
1157 /**
1158 * <p><b>Constraint:</b> org::andromda::cartridges::bpm4struts::metafacades::StrutsExceptionHandler::must target page or final state</p>
1159 * <p><b>Error:</b> When you model an action-exception you must either target a FrontEndView action state or a final state.</p>
1160 * <p><b>OCL:</b> context StrutsExceptionHandler inv: enteringPage = false implies enteringFinalState</p>
1161 * @param validationMessages Collection<ModelValidationMessage>
1162 * @see MetafacadeBase#validateInvariants(Collection validationMessages)
1163 */
1164 @Override
1165 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
1166 {
1167 this.getSuperFrontEndExceptionHandler().validateInvariants(validationMessages);
1168 this.getSuperStrutsForward().validateInvariants(validationMessages);
1169 try
1170 {
1171 final Object contextElement = this.THIS();
1172 boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"enteringPage"),false))).booleanValue()?Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"enteringFinalState"))).booleanValue():true));
1173 if (!constraintValid)
1174 {
1175 validationMessages.add(
1176 new ModelValidationMessage(
1177 (MetafacadeBase)contextElement ,
1178 "org::andromda::cartridges::bpm4struts::metafacades::StrutsExceptionHandler::must target page or final state",
1179 "When you model an action-exception you must either target a FrontEndView action state or a final state."));
1180 }
1181 }
1182 catch (Throwable th)
1183 {
1184 Throwable cause = th.getCause();
1185 int depth = 0; // Some throwables have infinite recursion
1186 while (cause != null && depth < 7)
1187 {
1188 th = cause;
1189 depth++;
1190 }
1191 logger.error("Error validating constraint 'org::andromda::cartridges::bpm4struts::metafacades::StrutsExceptionHandler::must target page or final state' ON "
1192 + this.THIS().toString() + ": " + th.getMessage(), th);
1193 }
1194 }
1195
1196 /**
1197 * The property that stores the name of the metafacade.
1198 */
1199 private static final String NAME_PROPERTY = "name";
1200 private static final String FQNAME_PROPERTY = "fullyQualifiedName";
1201
1202 /**
1203 * @see Object#toString()
1204 */
1205 @Override
1206 public String toString()
1207 {
1208 final StringBuilder toString = new StringBuilder(this.getClass().getName());
1209 toString.append("[");
1210 try
1211 {
1212 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
1213 }
1214 catch (final Throwable tryAgain)
1215 {
1216 try
1217 {
1218 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
1219 }
1220 catch (final Throwable ignore)
1221 {
1222 // - just ignore when the metafacade doesn't have a name or fullyQualifiedName property
1223 }
1224 }
1225 toString.append("]");
1226 return toString.toString();
1227 }
1228 }