001// license-header java merge-point 002// 003// Attention: generated code (by MetafacadeLogic.vsl) - do not modify! 004// 005package org.andromda.cartridges.jbpm.metafacades; 006 007import java.util.Collection; 008import java.util.List; 009import org.andromda.core.common.Introspector; 010import org.andromda.core.metafacade.MetafacadeBase; 011import org.andromda.core.metafacade.MetafacadeFactory; 012import org.andromda.core.metafacade.ModelValidationMessage; 013import org.andromda.metafacades.uml.ActionFacade; 014import org.andromda.metafacades.uml.ActionStateFacade; 015import org.andromda.metafacades.uml.ConstraintFacade; 016import org.andromda.metafacades.uml.DependencyFacade; 017import org.andromda.metafacades.uml.EventFacade; 018import org.andromda.metafacades.uml.ModelElementFacade; 019import org.andromda.metafacades.uml.ModelFacade; 020import org.andromda.metafacades.uml.PackageFacade; 021import org.andromda.metafacades.uml.PartitionFacade; 022import org.andromda.metafacades.uml.StateFacade; 023import org.andromda.metafacades.uml.StateMachineFacade; 024import org.andromda.metafacades.uml.StereotypeFacade; 025import org.andromda.metafacades.uml.TaggedValueFacade; 026import org.andromda.metafacades.uml.TemplateParameterFacade; 027import org.andromda.metafacades.uml.TransitionFacade; 028import org.andromda.metafacades.uml.TypeMappings; 029import org.andromda.translation.ocl.validation.OCLCollections; 030import org.andromda.translation.ocl.validation.OCLExpressions; 031import org.andromda.translation.ocl.validation.OCLIntrospector; 032import org.andromda.translation.ocl.validation.OCLResultEnsurer; 033import org.apache.commons.collections.Predicate; 034import org.apache.log4j.Logger; 035 036/** 037 * TODO: Model Documentation for org.andromda.cartridges.jbpm.metafacades.JBpmNode 038 * MetafacadeLogic for JBpmNode 039 * 040 * @see JBpmNode 041 */ 042public abstract class JBpmNodeLogic 043 extends MetafacadeBase 044 implements JBpmNode 045{ 046 /** 047 * The underlying UML object 048 * @see Object 049 */ 050 protected Object metaObject; 051 052 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 053 * @param metaObjectIn 054 * @param context 055 */ 056 protected JBpmNodeLogic(Object metaObjectIn, String context) 057 { 058 super(metaObjectIn, getContext(context)); 059 this.superJBpmEventState = 060 (JBpmEventState) 061 MetafacadeFactory.getInstance().createFacadeImpl( 062 "org.andromda.cartridges.jbpm.metafacades.JBpmEventState", 063 metaObjectIn, 064 getContext(context)); 065 this.superActionStateFacade = 066 (ActionStateFacade) 067 MetafacadeFactory.getInstance().createFacadeImpl( 068 "org.andromda.metafacades.uml.ActionStateFacade", 069 metaObjectIn, 070 getContext(context)); 071 this.metaObject = metaObjectIn; 072 } 073 074 /** 075 * The logger instance. 076 */ 077 private static final Logger logger = Logger.getLogger(JBpmNodeLogic.class); 078 079 /** 080 * Gets the context for this metafacade logic instance. 081 * @param context String. Set to JBpmNode if null 082 * @return context String 083 */ 084 private static String getContext(String context) 085 { 086 if (context == null) 087 { 088 context = "org.andromda.cartridges.jbpm.metafacades.JBpmNode"; 089 } 090 return context; 091 } 092 093 private JBpmEventState superJBpmEventState; 094 private boolean superJBpmEventStateInitialized = false; 095 096 /** 097 * Gets the JBpmEventState parent instance. 098 * @return this.superJBpmEventState JBpmEventState 099 */ 100 protected JBpmEventState getSuperJBpmEventState() 101 { 102 if (!this.superJBpmEventStateInitialized) 103 { 104 ((MetafacadeBase)this.superJBpmEventState).setMetafacadeContext(this.getMetafacadeContext()); 105 this.superJBpmEventStateInitialized = true; 106 } 107 return this.superJBpmEventState; 108 } 109 110 private ActionStateFacade superActionStateFacade; 111 private boolean superActionStateFacadeInitialized = false; 112 113 /** 114 * Gets the ActionStateFacade parent instance. 115 * @return this.superActionStateFacade ActionStateFacade 116 */ 117 protected ActionStateFacade getSuperActionStateFacade() 118 { 119 if (!this.superActionStateFacadeInitialized) 120 { 121 ((MetafacadeBase)this.superActionStateFacade).setMetafacadeContext(this.getMetafacadeContext()); 122 this.superActionStateFacadeInitialized = true; 123 } 124 return this.superActionStateFacade; 125 } 126 127 /** Reset context only for non-root metafacades 128 * @param context 129 * @see MetafacadeBase#resetMetafacadeContext(String context) 130 */ 131 @Override 132 public void resetMetafacadeContext(String context) 133 { 134 if (!this.contextRoot) // reset context only for non-root metafacades 135 { 136 context = getContext(context); // to have same value as in original constructor call 137 setMetafacadeContext (context); 138 if (this.superJBpmEventStateInitialized) 139 { 140 ((MetafacadeBase)this.superJBpmEventState).resetMetafacadeContext(context); 141 } 142 if (this.superActionStateFacadeInitialized) 143 { 144 ((MetafacadeBase)this.superActionStateFacade).resetMetafacadeContext(context); 145 } 146 } 147 } 148 149 /** 150 * @return boolean true always 151 * @see JBpmNode 152 */ 153 public boolean isJBpmNodeMetaType() 154 { 155 return true; 156 } 157 158 // --------------- attributes --------------------- 159 160 /** 161 * @see org.andromda.cartridges.jbpm.metafacades.JBpmNode#isTaskNode() 162 * @return boolean 163 */ 164 protected abstract boolean handleIsTaskNode(); 165 166 private boolean __taskNode1a; 167 private boolean __taskNode1aSet = false; 168 169 /** 170 * TODO: Model Documentation for org.andromda.cartridges.jbpm.metafacades.JBpmNode.taskNode 171 * @return (boolean)handleIsTaskNode() 172 */ 173 public final boolean isTaskNode() 174 { 175 boolean taskNode1a = this.__taskNode1a; 176 if (!this.__taskNode1aSet) 177 { 178 // taskNode has no pre constraints 179 taskNode1a = handleIsTaskNode(); 180 // taskNode has no post constraints 181 this.__taskNode1a = taskNode1a; 182 if (isMetafacadePropertyCachingEnabled()) 183 { 184 this.__taskNode1aSet = true; 185 } 186 } 187 return taskNode1a; 188 } 189 190 // ------------- associations ------------------ 191 192 private JBpmSwimlane __getSwimlane1r; 193 private boolean __getSwimlane1rSet = false; 194 195 /** 196 * TODO: Model Documentation for org.andromda.cartridges.jbpm.metafacades.JBpmNode 197 * @return (JBpmSwimlane)handleGetSwimlane() 198 */ 199 public final JBpmSwimlane getSwimlane() 200 { 201 JBpmSwimlane getSwimlane1r = this.__getSwimlane1r; 202 if (!this.__getSwimlane1rSet) 203 { 204 // jBpmNode has no pre constraints 205 Object result = handleGetSwimlane(); 206 MetafacadeBase shieldedResult = this.shieldedElement(result); 207 try 208 { 209 getSwimlane1r = (JBpmSwimlane)shieldedResult; 210 } 211 catch (ClassCastException ex) 212 { 213 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 214 JBpmNodeLogic.logger.warn("incorrect metafacade cast for JBpmNodeLogic.getSwimlane JBpmSwimlane " + result + ": " + shieldedResult); 215 } 216 // jBpmNode has no post constraints 217 this.__getSwimlane1r = getSwimlane1r; 218 if (isMetafacadePropertyCachingEnabled()) 219 { 220 this.__getSwimlane1rSet = true; 221 } 222 } 223 return getSwimlane1r; 224 } 225 226 /** 227 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 228 * @return Object 229 */ 230 protected abstract Object handleGetSwimlane(); 231 232 /** 233 * @return true 234 * @see JBpmEventState 235 */ 236 public boolean isJBpmEventStateMetaType() 237 { 238 return true; 239 } 240 241 /** 242 * @return true 243 * @see ActionStateFacade 244 */ 245 public boolean isActionStateFacadeMetaType() 246 { 247 return true; 248 } 249 250 /** 251 * @return true 252 * @see StateFacade 253 */ 254 public boolean isStateFacadeMetaType() 255 { 256 return true; 257 } 258 259 /** 260 * @return true 261 * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex 262 */ 263 public boolean isJBpmStateVertexMetaType() 264 { 265 return true; 266 } 267 268 /** 269 * @return true 270 * @see org.andromda.metafacades.uml.StateVertexFacade 271 */ 272 public boolean isStateVertexFacadeMetaType() 273 { 274 return true; 275 } 276 277 /** 278 * @return true 279 * @see ModelElementFacade 280 */ 281 public boolean isModelElementFacadeMetaType() 282 { 283 return true; 284 } 285 286 // ----------- delegates to JBpmEventState ------------ 287 /** 288 * TODO: Model Documentation for JBpmAction 289 * @see JBpmEventState#getAfterSignals() 290 */ 291 public List<JBpmAction> getAfterSignals() 292 { 293 return this.getSuperJBpmEventState().getAfterSignals(); 294 } 295 296 /** 297 * TODO: Model Documentation for JBpmAction 298 * @see JBpmEventState#getBeforeSignals() 299 */ 300 public List<JBpmAction> getBeforeSignals() 301 { 302 return this.getSuperJBpmEventState().getBeforeSignals(); 303 } 304 305 /** 306 * TODO: Model Documentation for JBpmAction 307 * @see JBpmEventState#getNodeEnters() 308 */ 309 public List<JBpmAction> getNodeEnters() 310 { 311 return this.getSuperJBpmEventState().getNodeEnters(); 312 } 313 314 /** 315 * TODO: Model Documentation for JBpmAction 316 * @see JBpmEventState#getNodeLeaves() 317 */ 318 public List<JBpmAction> getNodeLeaves() 319 { 320 return this.getSuperJBpmEventState().getNodeLeaves(); 321 } 322 323 /** 324 * TODO: Model Documentation for JBpmAction 325 * @see JBpmEventState#getTasks() 326 */ 327 public List<JBpmAction> getTasks() 328 { 329 return this.getSuperJBpmEventState().getTasks(); 330 } 331 332 /** 333 * TODO: Model Documentation for JBpmAction 334 * @see JBpmEventState#getTimers() 335 */ 336 public List<JBpmAction> getTimers() 337 { 338 return this.getSuperJBpmEventState().getTimers(); 339 } 340 341 /** 342 * Copies all tagged values from the given ModelElementFacade to this model element facade. 343 * @see ModelElementFacade#copyTaggedValues(ModelElementFacade element) 344 */ 345 public void copyTaggedValues(ModelElementFacade element) 346 { 347 this.getSuperJBpmEventState().copyTaggedValues(element); 348 } 349 350 /** 351 * Finds the tagged value with the specified 'tagName'. In case there are more values the first 352 * one found will be returned. 353 * @see ModelElementFacade#findTaggedValue(String tagName) 354 */ 355 public Object findTaggedValue(String tagName) 356 { 357 return this.getSuperJBpmEventState().findTaggedValue(tagName); 358 } 359 360 /** 361 * Returns all the values for the tagged value with the specified name. The returned collection 362 * will contains only String instances, or will be empty. Never null. 363 * @see ModelElementFacade#findTaggedValues(String tagName) 364 */ 365 public Collection<Object> findTaggedValues(String tagName) 366 { 367 return this.getSuperJBpmEventState().findTaggedValues(tagName); 368 } 369 370 /** 371 * Returns the fully qualified name of the model element. The fully qualified name includes 372 * complete package qualified name of the underlying model element. The templates parameter will 373 * be replaced by the correct one given the binding relation of the parameter to this element. 374 * @see ModelElementFacade#getBindedFullyQualifiedName(ModelElementFacade bindedElement) 375 */ 376 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement) 377 { 378 return this.getSuperJBpmEventState().getBindedFullyQualifiedName(bindedElement); 379 } 380 381 /** 382 * Gets all constraints belonging to the model element. 383 * @see ModelElementFacade#getConstraints() 384 */ 385 public Collection<ConstraintFacade> getConstraints() 386 { 387 return this.getSuperJBpmEventState().getConstraints(); 388 } 389 390 /** 391 * Returns the constraints of the argument kind that have been placed onto this model. Typical 392 * kinds are "inv", "pre" and "post". Other kinds are possible. 393 * @see ModelElementFacade#getConstraints(String kind) 394 */ 395 public Collection<ConstraintFacade> getConstraints(String kind) 396 { 397 return this.getSuperJBpmEventState().getConstraints(kind); 398 } 399 400 /** 401 * Gets the documentation for the model element, The indent argument is prefixed to each line. 402 * By default this method wraps lines after 64 characters. 403 * This method is equivalent to <code>getDocumentation(indent, 64)</code>. 404 * @see ModelElementFacade#getDocumentation(String indent) 405 */ 406 public String getDocumentation(String indent) 407 { 408 return this.getSuperJBpmEventState().getDocumentation(indent); 409 } 410 411 /** 412 * This method returns the documentation for this model element, with the lines wrapped after 413 * the specified number of characters, values of less than 1 will indicate no line wrapping is 414 * required. By default paragraphs are returned as HTML. 415 * This method is equivalent to <code>getDocumentation(indent, lineLength, true)</code>. 416 * @see ModelElementFacade#getDocumentation(String indent, int lineLength) 417 */ 418 public String getDocumentation(String indent, int lineLength) 419 { 420 return this.getSuperJBpmEventState().getDocumentation(indent, lineLength); 421 } 422 423 /** 424 * This method returns the documentation for this model element, with the lines wrapped after 425 * the specified number of characters, values of less than 1 will indicate no line wrapping is 426 * required. HTML style determines if HTML Escaping is applied. 427 * @see ModelElementFacade#getDocumentation(String indent, int lineLength, boolean htmlStyle) 428 */ 429 public String getDocumentation(String indent, int lineLength, boolean htmlStyle) 430 { 431 return this.getSuperJBpmEventState().getDocumentation(indent, lineLength, htmlStyle); 432 } 433 434 /** 435 * The fully qualified name of this model element. 436 * @see ModelElementFacade#getFullyQualifiedName() 437 */ 438 public String getFullyQualifiedName() 439 { 440 return this.getSuperJBpmEventState().getFullyQualifiedName(); 441 } 442 443 /** 444 * Returns the fully qualified name of the model element. The fully qualified name includes 445 * complete package qualified name of the underlying model element. If modelName is true, then 446 * the original name of the model element (the name contained within the model) will be the name 447 * returned, otherwise a name from a language mapping will be returned. 448 * @see ModelElementFacade#getFullyQualifiedName(boolean modelName) 449 */ 450 public String getFullyQualifiedName(boolean modelName) 451 { 452 return this.getSuperJBpmEventState().getFullyQualifiedName(modelName); 453 } 454 455 /** 456 * Returns the fully qualified name as a path, the returned value always starts with out a slash 457 * '/'. 458 * @see ModelElementFacade#getFullyQualifiedNamePath() 459 */ 460 public String getFullyQualifiedNamePath() 461 { 462 return this.getSuperJBpmEventState().getFullyQualifiedNamePath(); 463 } 464 465 /** 466 * Gets the unique identifier of the underlying model element. 467 * @see ModelElementFacade#getId() 468 */ 469 public String getId() 470 { 471 return this.getSuperJBpmEventState().getId(); 472 } 473 474 /** 475 * UML2: Retrieves the keywords for this element. Used to modify implementation properties which 476 * are not represented by other properties, i.e. native, transient, volatile, synchronized, 477 * (added annotations) override, deprecated. Can also be used to suppress compiler warnings: 478 * (added annotations) unchecked, fallthrough, path, serial, finally, all. Annotations require 479 * JDK5 compiler level. 480 * @see ModelElementFacade#getKeywords() 481 */ 482 public Collection<String> getKeywords() 483 { 484 return this.getSuperJBpmEventState().getKeywords(); 485 } 486 487 /** 488 * UML2: Retrieves a localized label for this named element. 489 * @see ModelElementFacade#getLabel() 490 */ 491 public String getLabel() 492 { 493 return this.getSuperJBpmEventState().getLabel(); 494 } 495 496 /** 497 * The language mappings that have been set for this model element. 498 * @see ModelElementFacade#getLanguageMappings() 499 */ 500 public TypeMappings getLanguageMappings() 501 { 502 return this.getSuperJBpmEventState().getLanguageMappings(); 503 } 504 505 /** 506 * Return the model containing this model element (multiple models may be loaded and processed 507 * at the same time). 508 * @see ModelElementFacade#getModel() 509 */ 510 public ModelFacade getModel() 511 { 512 return this.getSuperJBpmEventState().getModel(); 513 } 514 515 /** 516 * The name of the model element. 517 * @see ModelElementFacade#getName() 518 */ 519 public String getName() 520 { 521 return this.getSuperJBpmEventState().getName(); 522 } 523 524 /** 525 * Gets the package to which this model element belongs. 526 * @see ModelElementFacade#getPackage() 527 */ 528 public ModelElementFacade getPackage() 529 { 530 return this.getSuperJBpmEventState().getPackage(); 531 } 532 533 /** 534 * The name of this model element's package. 535 * @see ModelElementFacade#getPackageName() 536 */ 537 public String getPackageName() 538 { 539 return this.getSuperJBpmEventState().getPackageName(); 540 } 541 542 /** 543 * Gets the package name (optionally providing the ability to retrieve the model name and not 544 * the mapped name). 545 * @see ModelElementFacade#getPackageName(boolean modelName) 546 */ 547 public String getPackageName(boolean modelName) 548 { 549 return this.getSuperJBpmEventState().getPackageName(modelName); 550 } 551 552 /** 553 * Returns the package as a path, the returned value always starts with out a slash '/'. 554 * @see ModelElementFacade#getPackagePath() 555 */ 556 public String getPackagePath() 557 { 558 return this.getSuperJBpmEventState().getPackagePath(); 559 } 560 561 /** 562 * UML2: Returns the value of the 'Qualified Name' attribute. A name which allows the 563 * NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from 564 * the names of the containing namespaces starting at the root of the hierarchy and ending with 565 * the name of the NamedElement itself. 566 * @see ModelElementFacade#getQualifiedName() 567 */ 568 public String getQualifiedName() 569 { 570 return this.getSuperJBpmEventState().getQualifiedName(); 571 } 572 573 /** 574 * Gets the root package for the model element. 575 * @see ModelElementFacade#getRootPackage() 576 */ 577 public PackageFacade getRootPackage() 578 { 579 return this.getSuperJBpmEventState().getRootPackage(); 580 } 581 582 /** 583 * Gets the dependencies for which this model element is the source. 584 * @see ModelElementFacade#getSourceDependencies() 585 */ 586 public Collection<DependencyFacade> getSourceDependencies() 587 { 588 return this.getSuperJBpmEventState().getSourceDependencies(); 589 } 590 591 /** 592 * If this model element is the context of an activity graph, this represents that activity 593 * graph. 594 * @see ModelElementFacade#getStateMachineContext() 595 */ 596 public StateMachineFacade getStateMachineContext() 597 { 598 return this.getSuperJBpmEventState().getStateMachineContext(); 599 } 600 601 /** 602 * The collection of ALL stereotype names for this model element. 603 * @see ModelElementFacade#getStereotypeNames() 604 */ 605 public Collection<String> getStereotypeNames() 606 { 607 return this.getSuperJBpmEventState().getStereotypeNames(); 608 } 609 610 /** 611 * Gets all stereotypes for this model element. 612 * @see ModelElementFacade#getStereotypes() 613 */ 614 public Collection<StereotypeFacade> getStereotypes() 615 { 616 return this.getSuperJBpmEventState().getStereotypes(); 617 } 618 619 /** 620 * Return the TaggedValues associated with this model element, under all stereotypes. 621 * @see ModelElementFacade#getTaggedValues() 622 */ 623 public Collection<TaggedValueFacade> getTaggedValues() 624 { 625 return this.getSuperJBpmEventState().getTaggedValues(); 626 } 627 628 /** 629 * Gets the dependencies for which this model element is the target. 630 * @see ModelElementFacade#getTargetDependencies() 631 */ 632 public Collection<DependencyFacade> getTargetDependencies() 633 { 634 return this.getSuperJBpmEventState().getTargetDependencies(); 635 } 636 637 /** 638 * Get the template parameter for this model element having the parameterName 639 * @see ModelElementFacade#getTemplateParameter(String parameterName) 640 */ 641 public Object getTemplateParameter(String parameterName) 642 { 643 return this.getSuperJBpmEventState().getTemplateParameter(parameterName); 644 } 645 646 /** 647 * Get the template parameters for this model element 648 * @see ModelElementFacade#getTemplateParameters() 649 */ 650 public Collection<TemplateParameterFacade> getTemplateParameters() 651 { 652 return this.getSuperJBpmEventState().getTemplateParameters(); 653 } 654 655 /** 656 * The visibility (i.e. public, private, protected or package) of the model element, will 657 * attempt a lookup for these values in the language mappings (if any). 658 * @see ModelElementFacade#getVisibility() 659 */ 660 public String getVisibility() 661 { 662 return this.getSuperJBpmEventState().getVisibility(); 663 } 664 665 /** 666 * Returns true if the model element has the exact stereotype (meaning no stereotype inheritance 667 * is taken into account when searching for the stereotype), false otherwise. 668 * @see ModelElementFacade#hasExactStereotype(String stereotypeName) 669 */ 670 public boolean hasExactStereotype(String stereotypeName) 671 { 672 return this.getSuperJBpmEventState().hasExactStereotype(stereotypeName); 673 } 674 675 /** 676 * Does the UML Element contain the named Keyword? Keywords can be separated by space, comma, 677 * pipe, semicolon, or << >> 678 * @see ModelElementFacade#hasKeyword(String keywordName) 679 */ 680 public boolean hasKeyword(String keywordName) 681 { 682 return this.getSuperJBpmEventState().hasKeyword(keywordName); 683 } 684 685 /** 686 * Returns true if the model element has the specified stereotype. If the stereotype itself 687 * does not match, then a search will be made up the stereotype inheritance hierarchy, and if 688 * one of the stereotype's ancestors has a matching name this method will return true, false 689 * otherwise. 690 * For example, if we have a certain stereotype called <<exception>> and a model element has a 691 * stereotype called <<applicationException>> which extends <<exception>>, when calling this 692 * method with 'stereotypeName' defined as 'exception' the method would return true since 693 * <<applicationException>> inherits from <<exception>>. If you want to check if the model 694 * element has the exact stereotype, then use the method 'hasExactStereotype' instead. 695 * @see ModelElementFacade#hasStereotype(String stereotypeName) 696 */ 697 public boolean hasStereotype(String stereotypeName) 698 { 699 return this.getSuperJBpmEventState().hasStereotype(stereotypeName); 700 } 701 702 /** 703 * True if there are target dependencies from this element that are instances of BindingFacade. 704 * Deprecated in UML2: Use TemplateBinding parameters instead of dependencies. 705 * @see ModelElementFacade#isBindingDependenciesPresent() 706 */ 707 public boolean isBindingDependenciesPresent() 708 { 709 return this.getSuperJBpmEventState().isBindingDependenciesPresent(); 710 } 711 712 /** 713 * Indicates if any constraints are present on this model element. 714 * @see ModelElementFacade#isConstraintsPresent() 715 */ 716 public boolean isConstraintsPresent() 717 { 718 return this.getSuperJBpmEventState().isConstraintsPresent(); 719 } 720 721 /** 722 * Indicates if any documentation is present on this model element. 723 * @see ModelElementFacade#isDocumentationPresent() 724 */ 725 public boolean isDocumentationPresent() 726 { 727 return this.getSuperJBpmEventState().isDocumentationPresent(); 728 } 729 730 /** 731 * True if this element name is a reserved word in Java, C#, ANSI or ISO C, C++, JavaScript. 732 * @see ModelElementFacade#isReservedWord() 733 */ 734 public boolean isReservedWord() 735 { 736 return this.getSuperJBpmEventState().isReservedWord(); 737 } 738 739 /** 740 * True is there are template parameters on this model element. For UML2, applies to Class, 741 * Operation, Property, and Parameter. 742 * @see ModelElementFacade#isTemplateParametersPresent() 743 */ 744 public boolean isTemplateParametersPresent() 745 { 746 return this.getSuperJBpmEventState().isTemplateParametersPresent(); 747 } 748 749 /** 750 * True if this element name is a valid identifier name in Java, C#, ANSI or ISO C, C++, 751 * JavaScript. Contains no spaces, special characters etc. Constraint always applied on 752 * Enumerations and Interfaces, optionally applies on other model elements. 753 * @see ModelElementFacade#isValidIdentifierName() 754 */ 755 public boolean isValidIdentifierName() 756 { 757 return this.getSuperJBpmEventState().isValidIdentifierName(); 758 } 759 760 /** 761 * Searches for the constraint with the specified 'name' on this model element, and if found 762 * translates it using the specified 'translation' from a translation library discovered by the 763 * framework. 764 * @see ModelElementFacade#translateConstraint(String name, String translation) 765 */ 766 public String translateConstraint(String name, String translation) 767 { 768 return this.getSuperJBpmEventState().translateConstraint(name, translation); 769 } 770 771 /** 772 * Translates all constraints belonging to this model element with the given 'translation'. 773 * @see ModelElementFacade#translateConstraints(String translation) 774 */ 775 public String[] translateConstraints(String translation) 776 { 777 return this.getSuperJBpmEventState().translateConstraints(translation); 778 } 779 780 /** 781 * Translates the constraints of the specified 'kind' belonging to this model element. 782 * @see ModelElementFacade#translateConstraints(String kind, String translation) 783 */ 784 public String[] translateConstraints(String kind, String translation) 785 { 786 return this.getSuperJBpmEventState().translateConstraints(kind, translation); 787 } 788 789 /** 790 * Events to which is being deferred in this action state. 791 * @see StateFacade#getDeferrableEvents() 792 */ 793 public Collection<EventFacade> getDeferrableEvents() 794 { 795 return this.getSuperJBpmEventState().getDeferrableEvents(); 796 } 797 798 /** 799 * Models a situation during which some (usually implicit) invariant condition holds. The states 800 * of 801 * protocol state machines are exposed to the users of their context classifiers. A protocol 802 * state 803 * represents an exposed stable situation of its context classifier: when an instance of the 804 * classifier 805 * is not processing any operation, users of this instance can always know its state 806 * configuration. 807 * @see org.andromda.metafacades.uml.StateVertexFacade#getContainer() 808 */ 809 public StateFacade getContainer() 810 { 811 return this.getSuperJBpmEventState().getContainer(); 812 } 813 814 /** 815 * A directed relationship between a source vertex and a target vertex. It may be part of a 816 * compound 817 * transition, which takes the state machine from one state configuration to another, 818 * representing the 819 * complete response of the state machine to an occurrence of an event of a particular type. 820 * @see org.andromda.metafacades.uml.StateVertexFacade#getIncomings() 821 */ 822 public Collection<TransitionFacade> getIncomings() 823 { 824 return this.getSuperJBpmEventState().getIncomings(); 825 } 826 827 /** 828 * A directed relationship between a source vertex and a target vertex. It may be part of a 829 * compound 830 * transition, which takes the state machine from one state configuration to another, 831 * representing the 832 * complete response of the state machine to an occurrence of an event of a particular type. 833 * @see org.andromda.metafacades.uml.StateVertexFacade#getOutgoings() 834 */ 835 public Collection<TransitionFacade> getOutgoings() 836 { 837 return this.getSuperJBpmEventState().getOutgoings(); 838 } 839 840 /** 841 * The partition (if any) to which this vertex belongs. 842 * @see org.andromda.metafacades.uml.StateVertexFacade#getPartition() 843 */ 844 public PartitionFacade getPartition() 845 { 846 return this.getSuperJBpmEventState().getPartition(); 847 } 848 849 /** 850 * State machines can be used to express the behavior of part of a system. Behavior is modeled 851 * as a 852 * traversal of a graph of state nodes interconnected by one or more joined transition arcs that 853 * are 854 * triggered by the dispatching of series of (event) occurrences. During this traversal, the 855 * state 856 * machine executes a series of activities associated with various elements of the state 857 * machine. 858 * @see org.andromda.metafacades.uml.StateVertexFacade#getStateMachine() 859 */ 860 public StateMachineFacade getStateMachine() 861 { 862 return this.getSuperJBpmEventState().getStateMachine(); 863 } 864 865 // ----------- delegates to ActionStateFacade ------------ 866 /** 867 * The entry action for this action state (if any). 868 * @see ActionStateFacade#getEntry() 869 */ 870 public ActionFacade getEntry() 871 { 872 return this.getSuperActionStateFacade().getEntry(); 873 } 874 875 /** 876 * @see MetafacadeBase#initialize() 877 */ 878 @Override 879 public void initialize() 880 { 881 this.getSuperJBpmEventState().initialize(); 882 this.getSuperActionStateFacade().initialize(); 883 } 884 885 /** 886 * @return Object getSuperJBpmEventState().getValidationOwner() 887 * @see MetafacadeBase#getValidationOwner() 888 */ 889 @Override 890 public Object getValidationOwner() 891 { 892 Object owner = this.getSuperJBpmEventState().getValidationOwner(); 893 if (owner == null) 894 { 895 owner = this.getSuperActionStateFacade().getValidationOwner(); 896 } 897 return owner; 898 } 899 900 /** 901 * @return String getSuperJBpmEventState().getValidationName() 902 * @see MetafacadeBase#getValidationName() 903 */ 904 @Override 905 public String getValidationName() 906 { 907 String name = this.getSuperJBpmEventState().getValidationName(); 908 if (name == null) 909 { 910 name = this.getSuperActionStateFacade().getValidationName(); 911 } 912 return name; 913 } 914 915 /** 916 * <p><b>Constraint:</b> org::andromda::cartridges::jbpm::metafacades::JBpmState::state name is required</p> 917 * <p><b>Error:</b> The name of a state (action state) cannot be empty.</p> 918 * <p><b>OCL:</b> context JBpmState inv: name->notEmpty()</p> 919 * <p><b>Constraint:</b> org::andromda::cartridges::jbpm::metafacades::JBpmNode::outgoing transitions need names when there is more than one exiting a node</p> 920 * <p><b>Error:</b> When more than one transition is exiting a node it is required for them all to have a non-empty name.</p> 921 * <p><b>OCL:</b> context JBpmNode inv: outgoings->size() > 1 implies outgoings->forAll(name->notEmpty())</p> 922 * <p><b>Constraint:</b> org::andromda::cartridges::jbpm::metafacades::JBpmNode::name must not conflict with definition</p> 923 * <p><b>Error:</b> The name of this node's class will conflict with the name of the interface it is implementing, which is derived from the use-case name. Please either change the name of this node or the name of the encapsulating use-case.</p> 924 * <p><b>OCL:</b> context JBpmNode inv: name <> processDefinition.nodeInterfaceName</p> 925 * @param validationMessages Collection<ModelValidationMessage> 926 * @see MetafacadeBase#validateInvariants(Collection validationMessages) 927 */ 928 @Override 929 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 930 { 931 this.getSuperJBpmEventState().validateInvariants(validationMessages); 932 this.getSuperActionStateFacade().validateInvariants(validationMessages); 933 try 934 { 935 final Object contextElement = this.THIS(); 936 boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"name"))); 937 if (!constraintValid) 938 { 939 validationMessages.add( 940 new ModelValidationMessage( 941 (MetafacadeBase)contextElement , 942 "org::andromda::cartridges::jbpm::metafacades::JBpmState::state name is required", 943 "The name of a state (action state) cannot be empty.")); 944 } 945 } 946 catch (Throwable th) 947 { 948 Throwable cause = th.getCause(); 949 int depth = 0; // Some throwables have infinite recursion 950 while (cause != null && depth < 7) 951 { 952 th = cause; 953 depth++; 954 } 955 logger.error("Error validating constraint 'org::andromda::cartridges::jbpm::metafacades::JBpmState::state name is required' ON " 956 + this.THIS().toString() + ": " + th.getMessage(), th); 957 } 958 try 959 { 960 final Object contextElement = this.THIS(); 961 boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLExpressions.greater(OCLCollections.size(OCLIntrospector.invoke(contextElement,"outgoings")),1))).booleanValue()?OCLCollections.forAll(OCLIntrospector.invoke(contextElement,"outgoings"),new Predicate(){public boolean evaluate(Object object){return Boolean.valueOf(String.valueOf(OCLCollections.notEmpty(OCLIntrospector.invoke(object,"name")))).booleanValue();}}):true)); 962 if (!constraintValid) 963 { 964 validationMessages.add( 965 new ModelValidationMessage( 966 (MetafacadeBase)contextElement , 967 "org::andromda::cartridges::jbpm::metafacades::JBpmNode::outgoing transitions need names when there is more than one exiting a node", 968 "When more than one transition is exiting a node it is required for them all to have a non-empty name.")); 969 } 970 } 971 catch (Throwable th) 972 { 973 Throwable cause = th.getCause(); 974 int depth = 0; // Some throwables have infinite recursion 975 while (cause != null && depth < 7) 976 { 977 th = cause; 978 depth++; 979 } 980 logger.error("Error validating constraint 'org::andromda::cartridges::jbpm::metafacades::JBpmNode::outgoing transitions need names when there is more than one exiting a node' ON " 981 + this.THIS().toString() + ": " + th.getMessage(), th); 982 } 983 try 984 { 985 final Object contextElement = this.THIS(); 986 boolean constraintValid = OCLResultEnsurer.ensure(OCLExpressions.notEqual(OCLIntrospector.invoke(contextElement,"name"),OCLIntrospector.invoke(contextElement,"processDefinition.nodeInterfaceName"))); 987 if (!constraintValid) 988 { 989 validationMessages.add( 990 new ModelValidationMessage( 991 (MetafacadeBase)contextElement , 992 "org::andromda::cartridges::jbpm::metafacades::JBpmNode::name must not conflict with definition", 993 "The name of this node's class will conflict with the name of the interface it is implementing, which is derived from the use-case name. Please either change the name of this node or the name of the encapsulating use-case.")); 994 } 995 } 996 catch (Throwable th) 997 { 998 Throwable cause = th.getCause(); 999 int depth = 0; // Some throwables have infinite recursion 1000 while (cause != null && depth < 7) 1001 { 1002 th = cause; 1003 depth++; 1004 } 1005 logger.error("Error validating constraint 'org::andromda::cartridges::jbpm::metafacades::JBpmNode::name must not conflict with definition' ON " 1006 + this.THIS().toString() + ": " + th.getMessage(), th); 1007 } 1008 } 1009 1010 /** 1011 * The property that stores the name of the metafacade. 1012 */ 1013 private static final String NAME_PROPERTY = "name"; 1014 private static final String FQNAME_PROPERTY = "fullyQualifiedName"; 1015 1016 /** 1017 * @see Object#toString() 1018 */ 1019 @Override 1020 public String toString() 1021 { 1022 final StringBuilder toString = new StringBuilder(this.getClass().getName()); 1023 toString.append("["); 1024 try 1025 { 1026 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY)); 1027 } 1028 catch (final Throwable tryAgain) 1029 { 1030 try 1031 { 1032 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY)); 1033 } 1034 catch (final Throwable ignore) 1035 { 1036 // - just ignore when the metafacade doesn't have a name or fullyQualifiedName property 1037 } 1038 } 1039 toString.append("]"); 1040 return toString.toString(); 1041 } 1042}