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