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 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.ActionStateFacade;
13 import org.andromda.metafacades.uml.ConstraintFacade;
14 import org.andromda.metafacades.uml.DependencyFacade;
15 import org.andromda.metafacades.uml.FinalStateFacade;
16 import org.andromda.metafacades.uml.FrontEndAction;
17 import org.andromda.metafacades.uml.FrontEndActivityGraph;
18 import org.andromda.metafacades.uml.FrontEndController;
19 import org.andromda.metafacades.uml.ModelElementFacade;
20 import org.andromda.metafacades.uml.ModelFacade;
21 import org.andromda.metafacades.uml.ObjectFlowStateFacade;
22 import org.andromda.metafacades.uml.PackageFacade;
23 import org.andromda.metafacades.uml.PartitionFacade;
24 import org.andromda.metafacades.uml.PseudostateFacade;
25 import org.andromda.metafacades.uml.StateFacade;
26 import org.andromda.metafacades.uml.StateMachineFacade;
27 import org.andromda.metafacades.uml.StereotypeFacade;
28 import org.andromda.metafacades.uml.TaggedValueFacade;
29 import org.andromda.metafacades.uml.TemplateParameterFacade;
30 import org.andromda.metafacades.uml.TransitionFacade;
31 import org.andromda.metafacades.uml.TypeMappings;
32 import org.andromda.metafacades.uml.UseCaseFacade;
33 import org.andromda.translation.ocl.validation.OCLCollections;
34 import org.andromda.translation.ocl.validation.OCLIntrospector;
35 import org.andromda.translation.ocl.validation.OCLResultEnsurer;
36 import org.apache.log4j.Logger;
37
38 /**
39 * Represents the activity graph describing the details of a Struts use-case.
40 * MetafacadeLogic for StrutsActivityGraph
41 *
42 * @see StrutsActivityGraph
43 */
44 public abstract class StrutsActivityGraphLogic
45 extends MetafacadeBase
46 implements StrutsActivityGraph
47 {
48 /**
49 * The underlying UML object
50 * @see Object
51 */
52 protected Object metaObject;
53
54 /** Create Metafacade implementation instance using the MetafacadeFactory from the context
55 * @param metaObjectIn
56 * @param context
57 */
58 protected StrutsActivityGraphLogic(Object metaObjectIn, String context)
59 {
60 super(metaObjectIn, getContext(context));
61 this.superFrontEndActivityGraph =
62 (FrontEndActivityGraph)
63 MetafacadeFactory.getInstance().createFacadeImpl(
64 "org.andromda.metafacades.uml.FrontEndActivityGraph",
65 metaObjectIn,
66 getContext(context));
67 this.metaObject = metaObjectIn;
68 }
69
70 /**
71 * The logger instance.
72 */
73 private static final Logger logger = Logger.getLogger(StrutsActivityGraphLogic.class);
74
75 /**
76 * Gets the context for this metafacade logic instance.
77 * @param context String. Set to StrutsActivityGraph if null
78 * @return context String
79 */
80 private static String getContext(String context)
81 {
82 if (context == null)
83 {
84 context = "org.andromda.cartridges.bpm4struts.metafacades.StrutsActivityGraph";
85 }
86 return context;
87 }
88
89 private FrontEndActivityGraph superFrontEndActivityGraph;
90 private boolean superFrontEndActivityGraphInitialized = false;
91
92 /**
93 * Gets the FrontEndActivityGraph parent instance.
94 * @return this.superFrontEndActivityGraph FrontEndActivityGraph
95 */
96 private FrontEndActivityGraph getSuperFrontEndActivityGraph()
97 {
98 if (!this.superFrontEndActivityGraphInitialized)
99 {
100 ((MetafacadeBase)this.superFrontEndActivityGraph).setMetafacadeContext(this.getMetafacadeContext());
101 this.superFrontEndActivityGraphInitialized = true;
102 }
103 return this.superFrontEndActivityGraph;
104 }
105
106 /** Reset context only for non-root metafacades
107 * @param context
108 * @see MetafacadeBase#resetMetafacadeContext(String context)
109 */
110 @Override
111 public void resetMetafacadeContext(String context)
112 {
113 if (!this.contextRoot) // reset context only for non-root metafacades
114 {
115 context = getContext(context); // to have same value as in original constructor call
116 setMetafacadeContext (context);
117 if (this.superFrontEndActivityGraphInitialized)
118 {
119 ((MetafacadeBase)this.superFrontEndActivityGraph).resetMetafacadeContext(context);
120 }
121 }
122 }
123
124 /**
125 * @return boolean true always
126 * @see StrutsActivityGraph
127 */
128 public boolean isStrutsActivityGraphMetaType()
129 {
130 return true;
131 }
132
133 // ------------- associations ------------------
134
135 private StrutsAction __getFirstAction1r;
136 private boolean __getFirstAction1rSet = false;
137
138 /**
139 * Represents the activity graph describing the details of a Struts use-case.
140 * @return (StrutsAction)handleGetFirstAction()
141 */
142 public final StrutsAction getFirstAction()
143 {
144 StrutsAction getFirstAction1r = this.__getFirstAction1r;
145 if (!this.__getFirstAction1rSet)
146 {
147 // strutsActivityGraph has no pre constraints
148 Object result = handleGetFirstAction();
149 MetafacadeBase shieldedResult = this.shieldedElement(result);
150 try
151 {
152 getFirstAction1r = (StrutsAction)shieldedResult;
153 }
154 catch (ClassCastException ex)
155 {
156 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
157 StrutsActivityGraphLogic.logger.warn("incorrect metafacade cast for StrutsActivityGraphLogic.getFirstAction StrutsAction " + result + ": " + shieldedResult);
158 }
159 // strutsActivityGraph has no post constraints
160 this.__getFirstAction1r = getFirstAction1r;
161 if (isMetafacadePropertyCachingEnabled())
162 {
163 this.__getFirstAction1rSet = true;
164 }
165 }
166 return getFirstAction1r;
167 }
168
169 /**
170 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
171 * @return Object
172 */
173 protected abstract Object handleGetFirstAction();
174
175 /**
176 * @return true
177 * @see FrontEndActivityGraph
178 */
179 public boolean isFrontEndActivityGraphMetaType()
180 {
181 return true;
182 }
183
184 /**
185 * @return true
186 * @see org.andromda.metafacades.uml.ActivityGraphFacade
187 */
188 public boolean isActivityGraphFacadeMetaType()
189 {
190 return true;
191 }
192
193 /**
194 * @return true
195 * @see StateMachineFacade
196 */
197 public boolean isStateMachineFacadeMetaType()
198 {
199 return true;
200 }
201
202 /**
203 * @return true
204 * @see ModelElementFacade
205 */
206 public boolean isModelElementFacadeMetaType()
207 {
208 return true;
209 }
210
211 // ----------- delegates to FrontEndActivityGraph ------------
212 /**
213 * The set of action states contained in this activity graph.
214 * @see org.andromda.metafacades.uml.ActivityGraphFacade#getActionStates()
215 */
216 public Collection<ActionStateFacade> getActionStates()
217 {
218 return this.getSuperFrontEndActivityGraph().getActionStates();
219 }
220
221 /**
222 * The set of object flow states contained in this activity graph.
223 * @see org.andromda.metafacades.uml.ActivityGraphFacade#getObjectFlowStates()
224 */
225 public Collection<ObjectFlowStateFacade> getObjectFlowStates()
226 {
227 return this.getSuperFrontEndActivityGraph().getObjectFlowStates();
228 }
229
230 /**
231 * The set of partitions contained in this activity graph. Partitions are also known as
232 * swimlanes in UML.
233 * @see org.andromda.metafacades.uml.ActivityGraphFacade#getPartitions()
234 */
235 public Collection<PartitionFacade> getPartitions()
236 {
237 return this.getSuperFrontEndActivityGraph().getPartitions();
238 }
239
240 /**
241 * The use-case owning this activity graph.
242 * @see org.andromda.metafacades.uml.ActivityGraphFacade#getUseCase()
243 */
244 public UseCaseFacade getUseCase()
245 {
246 return this.getSuperFrontEndActivityGraph().getUseCase();
247 }
248
249 /**
250 * The controller context for this activity graph. This controller can be the target of
251 * deferrable events in the action states and transitions in this graph.
252 * @see FrontEndActivityGraph#getController()
253 */
254 public FrontEndController getController()
255 {
256 return this.getSuperFrontEndActivityGraph().getController();
257 }
258
259 /**
260 * This is the initial action encountered in this activity graph. This is the one and only
261 * transition coming out of the initial state.
262 * @see FrontEndActivityGraph#getInitialAction()
263 */
264 public FrontEndAction getInitialAction()
265 {
266 return this.getSuperFrontEndActivityGraph().getInitialAction();
267 }
268
269 /**
270 * True if this element is contained in a FrontEndUseCase.
271 * @see FrontEndActivityGraph#isContainedInFrontEndUseCase()
272 */
273 public boolean isContainedInFrontEndUseCase()
274 {
275 return this.getSuperFrontEndActivityGraph().isContainedInFrontEndUseCase();
276 }
277
278 /**
279 * Copies all tagged values from the given ModelElementFacade to this model element facade.
280 * @see ModelElementFacade#copyTaggedValues(ModelElementFacade element)
281 */
282 public void copyTaggedValues(ModelElementFacade element)
283 {
284 this.getSuperFrontEndActivityGraph().copyTaggedValues(element);
285 }
286
287 /**
288 * Finds the tagged value with the specified 'tagName'. In case there are more values the first
289 * one found will be returned.
290 * @see ModelElementFacade#findTaggedValue(String tagName)
291 */
292 public Object findTaggedValue(String tagName)
293 {
294 return this.getSuperFrontEndActivityGraph().findTaggedValue(tagName);
295 }
296
297 /**
298 * Returns all the values for the tagged value with the specified name. The returned collection
299 * will contains only String instances, or will be empty. Never null.
300 * @see ModelElementFacade#findTaggedValues(String tagName)
301 */
302 public Collection<Object> findTaggedValues(String tagName)
303 {
304 return this.getSuperFrontEndActivityGraph().findTaggedValues(tagName);
305 }
306
307 /**
308 * Returns the fully qualified name of the model element. The fully qualified name includes
309 * complete package qualified name of the underlying model element. The templates parameter will
310 * be replaced by the correct one given the binding relation of the parameter to this element.
311 * @see ModelElementFacade#getBindedFullyQualifiedName(ModelElementFacade bindedElement)
312 */
313 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
314 {
315 return this.getSuperFrontEndActivityGraph().getBindedFullyQualifiedName(bindedElement);
316 }
317
318 /**
319 * Gets all constraints belonging to the model element.
320 * @see ModelElementFacade#getConstraints()
321 */
322 public Collection<ConstraintFacade> getConstraints()
323 {
324 return this.getSuperFrontEndActivityGraph().getConstraints();
325 }
326
327 /**
328 * Returns the constraints of the argument kind that have been placed onto this model. Typical
329 * kinds are "inv", "pre" and "post". Other kinds are possible.
330 * @see ModelElementFacade#getConstraints(String kind)
331 */
332 public Collection<ConstraintFacade> getConstraints(String kind)
333 {
334 return this.getSuperFrontEndActivityGraph().getConstraints(kind);
335 }
336
337 /**
338 * Gets the documentation for the model element, The indent argument is prefixed to each line.
339 * By default this method wraps lines after 64 characters.
340 * This method is equivalent to <code>getDocumentation(indent, 64)</code>.
341 * @see ModelElementFacade#getDocumentation(String indent)
342 */
343 public String getDocumentation(String indent)
344 {
345 return this.getSuperFrontEndActivityGraph().getDocumentation(indent);
346 }
347
348 /**
349 * This method returns the documentation for this model element, with the lines wrapped after
350 * the specified number of characters, values of less than 1 will indicate no line wrapping is
351 * required. By default paragraphs are returned as HTML.
352 * This method is equivalent to <code>getDocumentation(indent, lineLength, true)</code>.
353 * @see ModelElementFacade#getDocumentation(String indent, int lineLength)
354 */
355 public String getDocumentation(String indent, int lineLength)
356 {
357 return this.getSuperFrontEndActivityGraph().getDocumentation(indent, lineLength);
358 }
359
360 /**
361 * This method returns the documentation for this model element, with the lines wrapped after
362 * the specified number of characters, values of less than 1 will indicate no line wrapping is
363 * required. HTML style determines if HTML Escaping is applied.
364 * @see ModelElementFacade#getDocumentation(String indent, int lineLength, boolean htmlStyle)
365 */
366 public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
367 {
368 return this.getSuperFrontEndActivityGraph().getDocumentation(indent, lineLength, htmlStyle);
369 }
370
371 /**
372 * The fully qualified name of this model element.
373 * @see ModelElementFacade#getFullyQualifiedName()
374 */
375 public String getFullyQualifiedName()
376 {
377 return this.getSuperFrontEndActivityGraph().getFullyQualifiedName();
378 }
379
380 /**
381 * Returns the fully qualified name of the model element. The fully qualified name includes
382 * complete package qualified name of the underlying model element. If modelName is true, then
383 * the original name of the model element (the name contained within the model) will be the name
384 * returned, otherwise a name from a language mapping will be returned.
385 * @see ModelElementFacade#getFullyQualifiedName(boolean modelName)
386 */
387 public String getFullyQualifiedName(boolean modelName)
388 {
389 return this.getSuperFrontEndActivityGraph().getFullyQualifiedName(modelName);
390 }
391
392 /**
393 * Returns the fully qualified name as a path, the returned value always starts with out a slash
394 * '/'.
395 * @see ModelElementFacade#getFullyQualifiedNamePath()
396 */
397 public String getFullyQualifiedNamePath()
398 {
399 return this.getSuperFrontEndActivityGraph().getFullyQualifiedNamePath();
400 }
401
402 /**
403 * Gets the unique identifier of the underlying model element.
404 * @see ModelElementFacade#getId()
405 */
406 public String getId()
407 {
408 return this.getSuperFrontEndActivityGraph().getId();
409 }
410
411 /**
412 * UML2: Retrieves the keywords for this element. Used to modify implementation properties which
413 * are not represented by other properties, i.e. native, transient, volatile, synchronized,
414 * (added annotations) override, deprecated. Can also be used to suppress compiler warnings:
415 * (added annotations) unchecked, fallthrough, path, serial, finally, all. Annotations require
416 * JDK5 compiler level.
417 * @see ModelElementFacade#getKeywords()
418 */
419 public Collection<String> getKeywords()
420 {
421 return this.getSuperFrontEndActivityGraph().getKeywords();
422 }
423
424 /**
425 * UML2: Retrieves a localized label for this named element.
426 * @see ModelElementFacade#getLabel()
427 */
428 public String getLabel()
429 {
430 return this.getSuperFrontEndActivityGraph().getLabel();
431 }
432
433 /**
434 * The language mappings that have been set for this model element.
435 * @see ModelElementFacade#getLanguageMappings()
436 */
437 public TypeMappings getLanguageMappings()
438 {
439 return this.getSuperFrontEndActivityGraph().getLanguageMappings();
440 }
441
442 /**
443 * Return the model containing this model element (multiple models may be loaded and processed
444 * at the same time).
445 * @see ModelElementFacade#getModel()
446 */
447 public ModelFacade getModel()
448 {
449 return this.getSuperFrontEndActivityGraph().getModel();
450 }
451
452 /**
453 * The name of the model element.
454 * @see ModelElementFacade#getName()
455 */
456 public String getName()
457 {
458 return this.getSuperFrontEndActivityGraph().getName();
459 }
460
461 /**
462 * Gets the package to which this model element belongs.
463 * @see ModelElementFacade#getPackage()
464 */
465 public ModelElementFacade getPackage()
466 {
467 return this.getSuperFrontEndActivityGraph().getPackage();
468 }
469
470 /**
471 * The name of this model element's package.
472 * @see ModelElementFacade#getPackageName()
473 */
474 public String getPackageName()
475 {
476 return this.getSuperFrontEndActivityGraph().getPackageName();
477 }
478
479 /**
480 * Gets the package name (optionally providing the ability to retrieve the model name and not
481 * the mapped name).
482 * @see ModelElementFacade#getPackageName(boolean modelName)
483 */
484 public String getPackageName(boolean modelName)
485 {
486 return this.getSuperFrontEndActivityGraph().getPackageName(modelName);
487 }
488
489 /**
490 * Returns the package as a path, the returned value always starts with out a slash '/'.
491 * @see ModelElementFacade#getPackagePath()
492 */
493 public String getPackagePath()
494 {
495 return this.getSuperFrontEndActivityGraph().getPackagePath();
496 }
497
498 /**
499 * UML2: Returns the value of the 'Qualified Name' attribute. A name which allows the
500 * NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from
501 * the names of the containing namespaces starting at the root of the hierarchy and ending with
502 * the name of the NamedElement itself.
503 * @see ModelElementFacade#getQualifiedName()
504 */
505 public String getQualifiedName()
506 {
507 return this.getSuperFrontEndActivityGraph().getQualifiedName();
508 }
509
510 /**
511 * Gets the root package for the model element.
512 * @see ModelElementFacade#getRootPackage()
513 */
514 public PackageFacade getRootPackage()
515 {
516 return this.getSuperFrontEndActivityGraph().getRootPackage();
517 }
518
519 /**
520 * Gets the dependencies for which this model element is the source.
521 * @see ModelElementFacade#getSourceDependencies()
522 */
523 public Collection<DependencyFacade> getSourceDependencies()
524 {
525 return this.getSuperFrontEndActivityGraph().getSourceDependencies();
526 }
527
528 /**
529 * If this model element is the context of an activity graph, this represents that activity
530 * graph.
531 * @see ModelElementFacade#getStateMachineContext()
532 */
533 public StateMachineFacade getStateMachineContext()
534 {
535 return this.getSuperFrontEndActivityGraph().getStateMachineContext();
536 }
537
538 /**
539 * The collection of ALL stereotype names for this model element.
540 * @see ModelElementFacade#getStereotypeNames()
541 */
542 public Collection<String> getStereotypeNames()
543 {
544 return this.getSuperFrontEndActivityGraph().getStereotypeNames();
545 }
546
547 /**
548 * Gets all stereotypes for this model element.
549 * @see ModelElementFacade#getStereotypes()
550 */
551 public Collection<StereotypeFacade> getStereotypes()
552 {
553 return this.getSuperFrontEndActivityGraph().getStereotypes();
554 }
555
556 /**
557 * Return the TaggedValues associated with this model element, under all stereotypes.
558 * @see ModelElementFacade#getTaggedValues()
559 */
560 public Collection<TaggedValueFacade> getTaggedValues()
561 {
562 return this.getSuperFrontEndActivityGraph().getTaggedValues();
563 }
564
565 /**
566 * Gets the dependencies for which this model element is the target.
567 * @see ModelElementFacade#getTargetDependencies()
568 */
569 public Collection<DependencyFacade> getTargetDependencies()
570 {
571 return this.getSuperFrontEndActivityGraph().getTargetDependencies();
572 }
573
574 /**
575 * Get the template parameter for this model element having the parameterName
576 * @see ModelElementFacade#getTemplateParameter(String parameterName)
577 */
578 public Object getTemplateParameter(String parameterName)
579 {
580 return this.getSuperFrontEndActivityGraph().getTemplateParameter(parameterName);
581 }
582
583 /**
584 * Get the template parameters for this model element
585 * @see ModelElementFacade#getTemplateParameters()
586 */
587 public Collection<TemplateParameterFacade> getTemplateParameters()
588 {
589 return this.getSuperFrontEndActivityGraph().getTemplateParameters();
590 }
591
592 /**
593 * The visibility (i.e. public, private, protected or package) of the model element, will
594 * attempt a lookup for these values in the language mappings (if any).
595 * @see ModelElementFacade#getVisibility()
596 */
597 public String getVisibility()
598 {
599 return this.getSuperFrontEndActivityGraph().getVisibility();
600 }
601
602 /**
603 * Returns true if the model element has the exact stereotype (meaning no stereotype inheritance
604 * is taken into account when searching for the stereotype), false otherwise.
605 * @see ModelElementFacade#hasExactStereotype(String stereotypeName)
606 */
607 public boolean hasExactStereotype(String stereotypeName)
608 {
609 return this.getSuperFrontEndActivityGraph().hasExactStereotype(stereotypeName);
610 }
611
612 /**
613 * Does the UML Element contain the named Keyword? Keywords can be separated by space, comma,
614 * pipe, semicolon, or << >>
615 * @see ModelElementFacade#hasKeyword(String keywordName)
616 */
617 public boolean hasKeyword(String keywordName)
618 {
619 return this.getSuperFrontEndActivityGraph().hasKeyword(keywordName);
620 }
621
622 /**
623 * Returns true if the model element has the specified stereotype. If the stereotype itself
624 * does not match, then a search will be made up the stereotype inheritance hierarchy, and if
625 * one of the stereotype's ancestors has a matching name this method will return true, false
626 * otherwise.
627 * For example, if we have a certain stereotype called <<exception>> and a model element has a
628 * stereotype called <<applicationException>> which extends <<exception>>, when calling this
629 * method with 'stereotypeName' defined as 'exception' the method would return true since
630 * <<applicationException>> inherits from <<exception>>. If you want to check if the model
631 * element has the exact stereotype, then use the method 'hasExactStereotype' instead.
632 * @see ModelElementFacade#hasStereotype(String stereotypeName)
633 */
634 public boolean hasStereotype(String stereotypeName)
635 {
636 return this.getSuperFrontEndActivityGraph().hasStereotype(stereotypeName);
637 }
638
639 /**
640 * True if there are target dependencies from this element that are instances of BindingFacade.
641 * Deprecated in UML2: Use TemplateBinding parameters instead of dependencies.
642 * @see ModelElementFacade#isBindingDependenciesPresent()
643 */
644 public boolean isBindingDependenciesPresent()
645 {
646 return this.getSuperFrontEndActivityGraph().isBindingDependenciesPresent();
647 }
648
649 /**
650 * Indicates if any constraints are present on this model element.
651 * @see ModelElementFacade#isConstraintsPresent()
652 */
653 public boolean isConstraintsPresent()
654 {
655 return this.getSuperFrontEndActivityGraph().isConstraintsPresent();
656 }
657
658 /**
659 * Indicates if any documentation is present on this model element.
660 * @see ModelElementFacade#isDocumentationPresent()
661 */
662 public boolean isDocumentationPresent()
663 {
664 return this.getSuperFrontEndActivityGraph().isDocumentationPresent();
665 }
666
667 /**
668 * True if this element name is a reserved word in Java, C#, ANSI or ISO C, C++, JavaScript.
669 * @see ModelElementFacade#isReservedWord()
670 */
671 public boolean isReservedWord()
672 {
673 return this.getSuperFrontEndActivityGraph().isReservedWord();
674 }
675
676 /**
677 * True is there are template parameters on this model element. For UML2, applies to Class,
678 * Operation, Property, and Parameter.
679 * @see ModelElementFacade#isTemplateParametersPresent()
680 */
681 public boolean isTemplateParametersPresent()
682 {
683 return this.getSuperFrontEndActivityGraph().isTemplateParametersPresent();
684 }
685
686 /**
687 * True if this element name is a valid identifier name in Java, C#, ANSI or ISO C, C++,
688 * JavaScript. Contains no spaces, special characters etc. Constraint always applied on
689 * Enumerations and Interfaces, optionally applies on other model elements.
690 * @see ModelElementFacade#isValidIdentifierName()
691 */
692 public boolean isValidIdentifierName()
693 {
694 return this.getSuperFrontEndActivityGraph().isValidIdentifierName();
695 }
696
697 /**
698 * Searches for the constraint with the specified 'name' on this model element, and if found
699 * translates it using the specified 'translation' from a translation library discovered by the
700 * framework.
701 * @see ModelElementFacade#translateConstraint(String name, String translation)
702 */
703 public String translateConstraint(String name, String translation)
704 {
705 return this.getSuperFrontEndActivityGraph().translateConstraint(name, translation);
706 }
707
708 /**
709 * Translates all constraints belonging to this model element with the given 'translation'.
710 * @see ModelElementFacade#translateConstraints(String translation)
711 */
712 public String[] translateConstraints(String translation)
713 {
714 return this.getSuperFrontEndActivityGraph().translateConstraints(translation);
715 }
716
717 /**
718 * Translates the constraints of the specified 'kind' belonging to this model element.
719 * @see ModelElementFacade#translateConstraints(String kind, String translation)
720 */
721 public String[] translateConstraints(String kind, String translation)
722 {
723 return this.getSuperFrontEndActivityGraph().translateConstraints(kind, translation);
724 }
725
726 /**
727 * Represents a model element. It may be an Element or NamedElement. A named element is an
728 * element in a
729 * model that may have a name. An element is a constituent of a model. As such, it has the
730 * capability
731 * of owning other elements.
732 * @see StateMachineFacade#getContextElement()
733 */
734 public ModelElementFacade getContextElement()
735 {
736 return this.getSuperFrontEndActivityGraph().getContextElement();
737 }
738
739 /**
740 * A special kind of state signifying that the enclosing region is completed. If the enclosing
741 * region
742 * is directly contained in a state machine and all other regions in the state machine also are
743 * completed, then it means that the entire state machine is completed.
744 * @see StateMachineFacade#getFinalStates()
745 */
746 public Collection<FinalStateFacade> getFinalStates()
747 {
748 return this.getSuperFrontEndActivityGraph().getFinalStates();
749 }
750
751 /**
752 * The first initial state (if any) found in this activity graph. Although technically many
753 * initial states per graph are allowed, it makes sense to have only one, for this reason we
754 * provide this property.
755 * @see StateMachineFacade#getInitialState()
756 */
757 public PseudostateFacade getInitialState()
758 {
759 return this.getSuperFrontEndActivityGraph().getInitialState();
760 }
761
762 /**
763 * An abstraction that encompasses different types of transient vertices in the state machine
764 * graph.
765 * @see StateMachineFacade#getInitialStates()
766 */
767 public Collection<PseudostateFacade> getInitialStates()
768 {
769 return this.getSuperFrontEndActivityGraph().getInitialStates();
770 }
771
772 /**
773 * The first transition on the first initial state found for this activity graph.
774 * @see StateMachineFacade#getInitialTransition()
775 */
776 public TransitionFacade getInitialTransition()
777 {
778 return this.getSuperFrontEndActivityGraph().getInitialTransition();
779 }
780
781 /**
782 * An abstraction that encompasses different types of transient vertices in the state machine
783 * graph.
784 * @see StateMachineFacade#getPseudostates()
785 */
786 public Collection<PseudostateFacade> getPseudostates()
787 {
788 return this.getSuperFrontEndActivityGraph().getPseudostates();
789 }
790
791 /**
792 * Models a situation during which some (usually implicit) invariant condition holds. The states
793 * of
794 * protocol state machines are exposed to the users of their context classifiers. A protocol
795 * state
796 * represents an exposed stable situation of its context classifier: when an instance of the
797 * classifier
798 * is not processing any operation, users of this instance can always know its state
799 * configuration.
800 * @see StateMachineFacade#getStates()
801 */
802 public Collection<StateFacade> getStates()
803 {
804 return this.getSuperFrontEndActivityGraph().getStates();
805 }
806
807 /**
808 * A directed relationship between a source vertex and a target vertex. It may be part of a
809 * compound
810 * transition, which takes the state machine from one state configuration to another,
811 * representing the
812 * complete response of the state machine to an occurrence of an event of a particular type.
813 * @see StateMachineFacade#getTransitions()
814 */
815 public Collection<TransitionFacade> getTransitions()
816 {
817 return this.getSuperFrontEndActivityGraph().getTransitions();
818 }
819
820 /**
821 * @see MetafacadeBase#initialize()
822 */
823 @Override
824 public void initialize()
825 {
826 this.getSuperFrontEndActivityGraph().initialize();
827 }
828
829 /**
830 * @return Object getSuperFrontEndActivityGraph().getValidationOwner()
831 * @see MetafacadeBase#getValidationOwner()
832 */
833 @Override
834 public Object getValidationOwner()
835 {
836 Object owner = this.getSuperFrontEndActivityGraph().getValidationOwner();
837 return owner;
838 }
839
840 /**
841 * @return String getSuperFrontEndActivityGraph().getValidationName()
842 * @see MetafacadeBase#getValidationName()
843 */
844 @Override
845 public String getValidationName()
846 {
847 String name = this.getSuperFrontEndActivityGraph().getValidationName();
848 return name;
849 }
850
851 /**
852 * <p><b>Constraint:</b> org::andromda::cartridges::bpm4struts::metafacades::StrutsActivityGraph::graph must have an action modeled on it's initial state</p>
853 * <p><b>Error:</b> Each activity graph must have an action transition exiting the initial state, this is the minimum required.</p>
854 * <p><b>OCL:</b> context StrutsActivityGraph inv: firstAction->notEmpty()</p>
855 * <p><b>Constraint:</b> org::andromda::cartridges::bpm4struts::metafacades::StrutsActivityGraph::front end graph must have a controller context</p>
856 * <p><b>Error:</b> An activity graph must have a controller class context to which (optionally) operations can be deferred. Make sure this graph's use-case has the FrontEndUseCase stereotype.</p>
857 * <p><b>OCL:</b> context FrontEndActivityGraph inv: controller->notEmpty()</p>
858 * @param validationMessages Collection<ModelValidationMessage>
859 * @see MetafacadeBase#validateInvariants(Collection validationMessages)
860 */
861 @Override
862 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
863 {
864 this.getSuperFrontEndActivityGraph().validateInvariants(validationMessages);
865 try
866 {
867 final Object contextElement = this.THIS();
868 boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"firstAction")));
869 if (!constraintValid)
870 {
871 validationMessages.add(
872 new ModelValidationMessage(
873 (MetafacadeBase)contextElement ,
874 "org::andromda::cartridges::bpm4struts::metafacades::StrutsActivityGraph::graph must have an action modeled on it's initial state",
875 "Each activity graph must have an action transition exiting the initial state, this is the minimum required."));
876 }
877 }
878 catch (Throwable th)
879 {
880 Throwable cause = th.getCause();
881 int depth = 0; // Some throwables have infinite recursion
882 while (cause != null && depth < 7)
883 {
884 th = cause;
885 depth++;
886 }
887 logger.error("Error validating constraint 'org::andromda::cartridges::bpm4struts::metafacades::StrutsActivityGraph::graph must have an action modeled on it's initial state' ON "
888 + this.THIS().toString() + ": " + th.getMessage(), th);
889 }
890 try
891 {
892 final Object contextElement = this.THIS();
893 boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"controller")));
894 if (!constraintValid)
895 {
896 validationMessages.add(
897 new ModelValidationMessage(
898 (MetafacadeBase)contextElement ,
899 "org::andromda::cartridges::bpm4struts::metafacades::StrutsActivityGraph::front end graph must have a controller context",
900 "An activity graph must have a controller class context to which (optionally) operations can be deferred. Make sure this graph's use-case has the FrontEndUseCase stereotype."));
901 }
902 }
903 catch (Throwable th)
904 {
905 Throwable cause = th.getCause();
906 int depth = 0; // Some throwables have infinite recursion
907 while (cause != null && depth < 7)
908 {
909 th = cause;
910 depth++;
911 }
912 logger.error("Error validating constraint 'org::andromda::cartridges::bpm4struts::metafacades::StrutsActivityGraph::front end graph must have a controller context' ON "
913 + this.THIS().toString() + ": " + th.getMessage(), th);
914 }
915 }
916
917 /**
918 * The property that stores the name of the metafacade.
919 */
920 private static final String NAME_PROPERTY = "name";
921 private static final String FQNAME_PROPERTY = "fullyQualifiedName";
922
923 /**
924 * @see Object#toString()
925 */
926 @Override
927 public String toString()
928 {
929 final StringBuilder toString = new StringBuilder(this.getClass().getName());
930 toString.append("[");
931 try
932 {
933 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
934 }
935 catch (final Throwable tryAgain)
936 {
937 try
938 {
939 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
940 }
941 catch (final Throwable ignore)
942 {
943 // - just ignore when the metafacade doesn't have a name or fullyQualifiedName property
944 }
945 }
946 toString.append("]");
947 return toString.toString();
948 }
949 }