001// license-header java merge-point 002// 003// Attention: generated code (by MetafacadeLogic.vsl) - do not modify! 004// 005package org.andromda.cartridges.bpm4struts.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.ConstraintFacade; 014import org.andromda.metafacades.uml.DependencyFacade; 015import org.andromda.metafacades.uml.FrontEndAction; 016import org.andromda.metafacades.uml.FrontEndControllerOperation; 017import org.andromda.metafacades.uml.FrontEndEvent; 018import org.andromda.metafacades.uml.ModelElementFacade; 019import org.andromda.metafacades.uml.ModelFacade; 020import org.andromda.metafacades.uml.PackageFacade; 021import org.andromda.metafacades.uml.ParameterFacade; 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.OCLIntrospector; 031import org.andromda.translation.ocl.validation.OCLResultEnsurer; 032import org.apache.log4j.Logger; 033 034/** 035 * A Struts trigger is represented by clicking a hyperlink or posting an action form. 036 * MetafacadeLogic for StrutsTrigger 037 * 038 * @see StrutsTrigger 039 */ 040public abstract class StrutsTriggerLogic 041 extends MetafacadeBase 042 implements StrutsTrigger 043{ 044 /** 045 * The underlying UML object 046 * @see Object 047 */ 048 protected Object metaObject; 049 050 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 051 * @param metaObjectIn 052 * @param context 053 */ 054 protected StrutsTriggerLogic(Object metaObjectIn, String context) 055 { 056 super(metaObjectIn, getContext(context)); 057 this.superFrontEndEvent = 058 (FrontEndEvent) 059 MetafacadeFactory.getInstance().createFacadeImpl( 060 "org.andromda.metafacades.uml.FrontEndEvent", 061 metaObjectIn, 062 getContext(context)); 063 this.metaObject = metaObjectIn; 064 } 065 066 /** 067 * The logger instance. 068 */ 069 private static final Logger logger = Logger.getLogger(StrutsTriggerLogic.class); 070 071 /** 072 * Gets the context for this metafacade logic instance. 073 * @param context String. Set to StrutsTrigger if null 074 * @return context String 075 */ 076 private static String getContext(String context) 077 { 078 if (context == null) 079 { 080 context = "org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger"; 081 } 082 return context; 083 } 084 085 private FrontEndEvent superFrontEndEvent; 086 private boolean superFrontEndEventInitialized = false; 087 088 /** 089 * Gets the FrontEndEvent parent instance. 090 * @return this.superFrontEndEvent FrontEndEvent 091 */ 092 private FrontEndEvent getSuperFrontEndEvent() 093 { 094 if (!this.superFrontEndEventInitialized) 095 { 096 ((MetafacadeBase)this.superFrontEndEvent).setMetafacadeContext(this.getMetafacadeContext()); 097 this.superFrontEndEventInitialized = true; 098 } 099 return this.superFrontEndEvent; 100 } 101 102 /** Reset context only for non-root metafacades 103 * @param context 104 * @see MetafacadeBase#resetMetafacadeContext(String context) 105 */ 106 @Override 107 public void resetMetafacadeContext(String context) 108 { 109 if (!this.contextRoot) // reset context only for non-root metafacades 110 { 111 context = getContext(context); // to have same value as in original constructor call 112 setMetafacadeContext (context); 113 if (this.superFrontEndEventInitialized) 114 { 115 ((MetafacadeBase)this.superFrontEndEvent).resetMetafacadeContext(context); 116 } 117 } 118 } 119 120 /** 121 * @return boolean true always 122 * @see StrutsTrigger 123 */ 124 public boolean isStrutsTriggerMetaType() 125 { 126 return true; 127 } 128 129 // --------------- attributes --------------------- 130 131 /** 132 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getNotAllowedTitleKey() 133 * @return String 134 */ 135 protected abstract String handleGetNotAllowedTitleKey(); 136 137 private String __notAllowedTitleKey1a; 138 private boolean __notAllowedTitleKey1aSet = false; 139 140 /** 141 * The message key to use as a tooltip when the user is not allowed to use this trigger. 142 * @return (String)handleGetNotAllowedTitleKey() 143 */ 144 public final String getNotAllowedTitleKey() 145 { 146 String notAllowedTitleKey1a = this.__notAllowedTitleKey1a; 147 if (!this.__notAllowedTitleKey1aSet) 148 { 149 // notAllowedTitleKey has no pre constraints 150 notAllowedTitleKey1a = handleGetNotAllowedTitleKey(); 151 // notAllowedTitleKey has no post constraints 152 this.__notAllowedTitleKey1a = notAllowedTitleKey1a; 153 if (isMetafacadePropertyCachingEnabled()) 154 { 155 this.__notAllowedTitleKey1aSet = true; 156 } 157 } 158 return notAllowedTitleKey1a; 159 } 160 161 /** 162 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getTitleKey() 163 * @return String 164 */ 165 protected abstract String handleGetTitleKey(); 166 167 private String __titleKey2a; 168 private boolean __titleKey2aSet = false; 169 170 /** 171 * The message title key to use as a tooltip for this trigger. 172 * @return (String)handleGetTitleKey() 173 */ 174 public final String getTitleKey() 175 { 176 String titleKey2a = this.__titleKey2a; 177 if (!this.__titleKey2aSet) 178 { 179 // titleKey has no pre constraints 180 titleKey2a = handleGetTitleKey(); 181 // titleKey has no post constraints 182 this.__titleKey2a = titleKey2a; 183 if (isMetafacadePropertyCachingEnabled()) 184 { 185 this.__titleKey2aSet = true; 186 } 187 } 188 return titleKey2a; 189 } 190 191 /** 192 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getResetTitleKey() 193 * @return String 194 */ 195 protected abstract String handleGetResetTitleKey(); 196 197 private String __resetTitleKey3a; 198 private boolean __resetTitleKey3aSet = false; 199 200 /** 201 * The message reset title key to use as a tooltip for this trigger's reset feature. 202 * @return (String)handleGetResetTitleKey() 203 */ 204 public final String getResetTitleKey() 205 { 206 String resetTitleKey3a = this.__resetTitleKey3a; 207 if (!this.__resetTitleKey3aSet) 208 { 209 // resetTitleKey has no pre constraints 210 resetTitleKey3a = handleGetResetTitleKey(); 211 // resetTitleKey has no post constraints 212 this.__resetTitleKey3a = resetTitleKey3a; 213 if (isMetafacadePropertyCachingEnabled()) 214 { 215 this.__resetTitleKey3aSet = true; 216 } 217 } 218 return resetTitleKey3a; 219 } 220 221 /** 222 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getResetNotAllowedTitleKey() 223 * @return String 224 */ 225 protected abstract String handleGetResetNotAllowedTitleKey(); 226 227 private String __resetNotAllowedTitleKey4a; 228 private boolean __resetNotAllowedTitleKey4aSet = false; 229 230 /** 231 * Returns the message key to use as a tooltip when the user is not allowed to use reset the 232 * form behind this trigger. 233 * @return (String)handleGetResetNotAllowedTitleKey() 234 */ 235 public final String getResetNotAllowedTitleKey() 236 { 237 String resetNotAllowedTitleKey4a = this.__resetNotAllowedTitleKey4a; 238 if (!this.__resetNotAllowedTitleKey4aSet) 239 { 240 // resetNotAllowedTitleKey has no pre constraints 241 resetNotAllowedTitleKey4a = handleGetResetNotAllowedTitleKey(); 242 // resetNotAllowedTitleKey has no post constraints 243 this.__resetNotAllowedTitleKey4a = resetNotAllowedTitleKey4a; 244 if (isMetafacadePropertyCachingEnabled()) 245 { 246 this.__resetNotAllowedTitleKey4aSet = true; 247 } 248 } 249 return resetNotAllowedTitleKey4a; 250 } 251 252 /** 253 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getTriggerKey() 254 * @return String 255 */ 256 protected abstract String handleGetTriggerKey(); 257 258 private String __triggerKey5a; 259 private boolean __triggerKey5aSet = false; 260 261 /** 262 * The message reset key for this trigger. 263 * @return (String)handleGetTriggerKey() 264 */ 265 public final String getTriggerKey() 266 { 267 String triggerKey5a = this.__triggerKey5a; 268 if (!this.__triggerKey5aSet) 269 { 270 // triggerKey has no pre constraints 271 triggerKey5a = handleGetTriggerKey(); 272 // triggerKey has no post constraints 273 this.__triggerKey5a = triggerKey5a; 274 if (isMetafacadePropertyCachingEnabled()) 275 { 276 this.__triggerKey5aSet = true; 277 } 278 } 279 return triggerKey5a; 280 } 281 282 /** 283 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getTriggerValue() 284 * @return String 285 */ 286 protected abstract String handleGetTriggerValue(); 287 288 private String __triggerValue6a; 289 private boolean __triggerValue6aSet = false; 290 291 /** 292 * The resource message value for this trigger, this would be the button label or hyperlink 293 * name. 294 * @return (String)handleGetTriggerValue() 295 */ 296 public final String getTriggerValue() 297 { 298 String triggerValue6a = this.__triggerValue6a; 299 if (!this.__triggerValue6aSet) 300 { 301 // triggerValue has no pre constraints 302 triggerValue6a = handleGetTriggerValue(); 303 // triggerValue has no post constraints 304 this.__triggerValue6a = triggerValue6a; 305 if (isMetafacadePropertyCachingEnabled()) 306 { 307 this.__triggerValue6aSet = true; 308 } 309 } 310 return triggerValue6a; 311 } 312 313 /** 314 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getTitleValue() 315 * @return String 316 */ 317 protected abstract String handleGetTitleValue(); 318 319 private String __titleValue7a; 320 private boolean __titleValue7aSet = false; 321 322 /** 323 * The default resource message value for this trigger's tooltip. 324 * @return (String)handleGetTitleValue() 325 */ 326 public final String getTitleValue() 327 { 328 String titleValue7a = this.__titleValue7a; 329 if (!this.__titleValue7aSet) 330 { 331 // titleValue has no pre constraints 332 titleValue7a = handleGetTitleValue(); 333 // titleValue has no post constraints 334 this.__titleValue7a = titleValue7a; 335 if (isMetafacadePropertyCachingEnabled()) 336 { 337 this.__titleValue7aSet = true; 338 } 339 } 340 return titleValue7a; 341 } 342 343 /** 344 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getResetTitleValue() 345 * @return String 346 */ 347 protected abstract String handleGetResetTitleValue(); 348 349 private String __resetTitleValue8a; 350 private boolean __resetTitleValue8aSet = false; 351 352 /** 353 * The tooltip value for this trigger's reset feature. 354 * @return (String)handleGetResetTitleValue() 355 */ 356 public final String getResetTitleValue() 357 { 358 String resetTitleValue8a = this.__resetTitleValue8a; 359 if (!this.__resetTitleValue8aSet) 360 { 361 // resetTitleValue has no pre constraints 362 resetTitleValue8a = handleGetResetTitleValue(); 363 // resetTitleValue has no post constraints 364 this.__resetTitleValue8a = resetTitleValue8a; 365 if (isMetafacadePropertyCachingEnabled()) 366 { 367 this.__resetTitleValue8aSet = true; 368 } 369 } 370 return resetTitleValue8a; 371 } 372 373 /** 374 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getResetNotAllowedTitleValue() 375 * @return String 376 */ 377 protected abstract String handleGetResetNotAllowedTitleValue(); 378 379 private String __resetNotAllowedTitleValue9a; 380 private boolean __resetNotAllowedTitleValue9aSet = false; 381 382 /** 383 * The message value to use as a tooltip when the user is not allowed to use reset the form 384 * behind this trigger. 385 * @return (String)handleGetResetNotAllowedTitleValue() 386 */ 387 public final String getResetNotAllowedTitleValue() 388 { 389 String resetNotAllowedTitleValue9a = this.__resetNotAllowedTitleValue9a; 390 if (!this.__resetNotAllowedTitleValue9aSet) 391 { 392 // resetNotAllowedTitleValue has no pre constraints 393 resetNotAllowedTitleValue9a = handleGetResetNotAllowedTitleValue(); 394 // resetNotAllowedTitleValue has no post constraints 395 this.__resetNotAllowedTitleValue9a = resetNotAllowedTitleValue9a; 396 if (isMetafacadePropertyCachingEnabled()) 397 { 398 this.__resetNotAllowedTitleValue9aSet = true; 399 } 400 } 401 return resetNotAllowedTitleValue9a; 402 } 403 404 /** 405 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getNotAllowedTitleValue() 406 * @return String 407 */ 408 protected abstract String handleGetNotAllowedTitleValue(); 409 410 private String __notAllowedTitleValue10a; 411 private boolean __notAllowedTitleValue10aSet = false; 412 413 /** 414 * The message value to use as a tooltip when the user is not allowed to use this trigger. 415 * @return (String)handleGetNotAllowedTitleValue() 416 */ 417 public final String getNotAllowedTitleValue() 418 { 419 String notAllowedTitleValue10a = this.__notAllowedTitleValue10a; 420 if (!this.__notAllowedTitleValue10aSet) 421 { 422 // notAllowedTitleValue has no pre constraints 423 notAllowedTitleValue10a = handleGetNotAllowedTitleValue(); 424 // notAllowedTitleValue has no post constraints 425 this.__notAllowedTitleValue10a = notAllowedTitleValue10a; 426 if (isMetafacadePropertyCachingEnabled()) 427 { 428 this.__notAllowedTitleValue10aSet = true; 429 } 430 } 431 return notAllowedTitleValue10a; 432 } 433 434 /** 435 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#isActionTrigger() 436 * @return boolean 437 */ 438 protected abstract boolean handleIsActionTrigger(); 439 440 private boolean __actionTrigger11a; 441 private boolean __actionTrigger11aSet = false; 442 443 /** 444 * True if this trigger is modeled on an action transition. That means, the transition is coming 445 * out of an action state with the FrontEndView stereotype. False otherwise. 446 * @return (boolean)handleIsActionTrigger() 447 */ 448 public final boolean isActionTrigger() 449 { 450 boolean actionTrigger11a = this.__actionTrigger11a; 451 if (!this.__actionTrigger11aSet) 452 { 453 // actionTrigger has no pre constraints 454 actionTrigger11a = handleIsActionTrigger(); 455 // actionTrigger has no post constraints 456 this.__actionTrigger11a = actionTrigger11a; 457 if (isMetafacadePropertyCachingEnabled()) 458 { 459 this.__actionTrigger11aSet = true; 460 } 461 } 462 return actionTrigger11a; 463 } 464 465 /** 466 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getResetMessageKey() 467 * @return String 468 */ 469 protected abstract String handleGetResetMessageKey(); 470 471 private String __resetMessageKey12a; 472 private boolean __resetMessageKey12aSet = false; 473 474 /** 475 * The message key to use for reset button labels. 476 * @return (String)handleGetResetMessageKey() 477 */ 478 public final String getResetMessageKey() 479 { 480 String resetMessageKey12a = this.__resetMessageKey12a; 481 if (!this.__resetMessageKey12aSet) 482 { 483 // resetMessageKey has no pre constraints 484 resetMessageKey12a = handleGetResetMessageKey(); 485 // resetMessageKey has no post constraints 486 this.__resetMessageKey12a = resetMessageKey12a; 487 if (isMetafacadePropertyCachingEnabled()) 488 { 489 this.__resetMessageKey12aSet = true; 490 } 491 } 492 return resetMessageKey12a; 493 } 494 495 /** 496 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsTrigger#getResetMessageValue() 497 * @return String 498 */ 499 protected abstract String handleGetResetMessageValue(); 500 501 private String __resetMessageValue13a; 502 private boolean __resetMessageValue13aSet = false; 503 504 /** 505 * The message value to use for reset button labels. 506 * @return (String)handleGetResetMessageValue() 507 */ 508 public final String getResetMessageValue() 509 { 510 String resetMessageValue13a = this.__resetMessageValue13a; 511 if (!this.__resetMessageValue13aSet) 512 { 513 // resetMessageValue has no pre constraints 514 resetMessageValue13a = handleGetResetMessageValue(); 515 // resetMessageValue has no post constraints 516 this.__resetMessageValue13a = resetMessageValue13a; 517 if (isMetafacadePropertyCachingEnabled()) 518 { 519 this.__resetMessageValue13aSet = true; 520 } 521 } 522 return resetMessageValue13a; 523 } 524 525 // ------------- associations ------------------ 526 527 private StrutsAction __getStrutsAction1r; 528 private boolean __getStrutsAction1rSet = false; 529 530 /** 531 * Returns the trigger that calls this action. Typically this is a button or an hyperlink. 532 * @return (StrutsAction)handleGetStrutsAction() 533 */ 534 public final StrutsAction getStrutsAction() 535 { 536 StrutsAction getStrutsAction1r = this.__getStrutsAction1r; 537 if (!this.__getStrutsAction1rSet) 538 { 539 // actionTrigger has no pre constraints 540 Object result = handleGetStrutsAction(); 541 MetafacadeBase shieldedResult = this.shieldedElement(result); 542 try 543 { 544 getStrutsAction1r = (StrutsAction)shieldedResult; 545 } 546 catch (ClassCastException ex) 547 { 548 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 549 StrutsTriggerLogic.logger.warn("incorrect metafacade cast for StrutsTriggerLogic.getStrutsAction StrutsAction " + result + ": " + shieldedResult); 550 } 551 // actionTrigger has no post constraints 552 this.__getStrutsAction1r = getStrutsAction1r; 553 if (isMetafacadePropertyCachingEnabled()) 554 { 555 this.__getStrutsAction1rSet = true; 556 } 557 } 558 return getStrutsAction1r; 559 } 560 561 /** 562 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 563 * @return Object 564 */ 565 protected abstract Object handleGetStrutsAction(); 566 567 /** 568 * @return true 569 * @see FrontEndEvent 570 */ 571 public boolean isFrontEndEventMetaType() 572 { 573 return true; 574 } 575 576 /** 577 * @return true 578 * @see org.andromda.metafacades.uml.EventFacade 579 */ 580 public boolean isEventFacadeMetaType() 581 { 582 return true; 583 } 584 585 /** 586 * @return true 587 * @see ModelElementFacade 588 */ 589 public boolean isModelElementFacadeMetaType() 590 { 591 return true; 592 } 593 594 // ----------- delegates to FrontEndEvent ------------ 595 /** 596 * The parameters to this event. 597 * @see org.andromda.metafacades.uml.EventFacade#getParameters() 598 */ 599 public Collection<ParameterFacade> getParameters() 600 { 601 return this.getSuperFrontEndEvent().getParameters(); 602 } 603 604 /** 605 * If this event is located on an action state, this will represent that state. 606 * @see org.andromda.metafacades.uml.EventFacade#getState() 607 */ 608 public StateFacade getState() 609 { 610 return this.getSuperFrontEndEvent().getState(); 611 } 612 613 /** 614 * If this event is located on a transition, this represents that transition. 615 * @see org.andromda.metafacades.uml.EventFacade#getTransition() 616 */ 617 public TransitionFacade getTransition() 618 { 619 return this.getSuperFrontEndEvent().getTransition(); 620 } 621 622 /** 623 * The action which triggers the "front-end" event. 624 * @see FrontEndEvent#getAction() 625 */ 626 public FrontEndAction getAction() 627 { 628 return this.getSuperFrontEndEvent().getAction(); 629 } 630 631 /** 632 * The call to the controller for this front-end event (if any). 633 * @see FrontEndEvent#getControllerCall() 634 */ 635 public FrontEndControllerOperation getControllerCall() 636 { 637 return this.getSuperFrontEndEvent().getControllerCall(); 638 } 639 640 /** 641 * Gets all controller operation calls for the front-end event. 642 * @see FrontEndEvent#getControllerCalls() 643 */ 644 public List<FrontEndControllerOperation> getControllerCalls() 645 { 646 return this.getSuperFrontEndEvent().getControllerCalls(); 647 } 648 649 /** 650 * Indicates whether or not this front end event is contained within a FrontEndUseCase. 651 * @see FrontEndEvent#isContainedInFrontEndUseCase() 652 */ 653 public boolean isContainedInFrontEndUseCase() 654 { 655 return this.getSuperFrontEndEvent().isContainedInFrontEndUseCase(); 656 } 657 658 /** 659 * Copies all tagged values from the given ModelElementFacade to this model element facade. 660 * @see ModelElementFacade#copyTaggedValues(ModelElementFacade element) 661 */ 662 public void copyTaggedValues(ModelElementFacade element) 663 { 664 this.getSuperFrontEndEvent().copyTaggedValues(element); 665 } 666 667 /** 668 * Finds the tagged value with the specified 'tagName'. In case there are more values the first 669 * one found will be returned. 670 * @see ModelElementFacade#findTaggedValue(String tagName) 671 */ 672 public Object findTaggedValue(String tagName) 673 { 674 return this.getSuperFrontEndEvent().findTaggedValue(tagName); 675 } 676 677 /** 678 * Returns all the values for the tagged value with the specified name. The returned collection 679 * will contains only String instances, or will be empty. Never null. 680 * @see ModelElementFacade#findTaggedValues(String tagName) 681 */ 682 public Collection<Object> findTaggedValues(String tagName) 683 { 684 return this.getSuperFrontEndEvent().findTaggedValues(tagName); 685 } 686 687 /** 688 * Returns the fully qualified name of the model element. The fully qualified name includes 689 * complete package qualified name of the underlying model element. The templates parameter will 690 * be replaced by the correct one given the binding relation of the parameter to this element. 691 * @see ModelElementFacade#getBindedFullyQualifiedName(ModelElementFacade bindedElement) 692 */ 693 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement) 694 { 695 return this.getSuperFrontEndEvent().getBindedFullyQualifiedName(bindedElement); 696 } 697 698 /** 699 * Gets all constraints belonging to the model element. 700 * @see ModelElementFacade#getConstraints() 701 */ 702 public Collection<ConstraintFacade> getConstraints() 703 { 704 return this.getSuperFrontEndEvent().getConstraints(); 705 } 706 707 /** 708 * Returns the constraints of the argument kind that have been placed onto this model. Typical 709 * kinds are "inv", "pre" and "post". Other kinds are possible. 710 * @see ModelElementFacade#getConstraints(String kind) 711 */ 712 public Collection<ConstraintFacade> getConstraints(String kind) 713 { 714 return this.getSuperFrontEndEvent().getConstraints(kind); 715 } 716 717 /** 718 * Gets the documentation for the model element, The indent argument is prefixed to each line. 719 * By default this method wraps lines after 64 characters. 720 * This method is equivalent to <code>getDocumentation(indent, 64)</code>. 721 * @see ModelElementFacade#getDocumentation(String indent) 722 */ 723 public String getDocumentation(String indent) 724 { 725 return this.getSuperFrontEndEvent().getDocumentation(indent); 726 } 727 728 /** 729 * This method returns the documentation for this model element, with the lines wrapped after 730 * the specified number of characters, values of less than 1 will indicate no line wrapping is 731 * required. By default paragraphs are returned as HTML. 732 * This method is equivalent to <code>getDocumentation(indent, lineLength, true)</code>. 733 * @see ModelElementFacade#getDocumentation(String indent, int lineLength) 734 */ 735 public String getDocumentation(String indent, int lineLength) 736 { 737 return this.getSuperFrontEndEvent().getDocumentation(indent, lineLength); 738 } 739 740 /** 741 * This method returns the documentation for this model element, with the lines wrapped after 742 * the specified number of characters, values of less than 1 will indicate no line wrapping is 743 * required. HTML style determines if HTML Escaping is applied. 744 * @see ModelElementFacade#getDocumentation(String indent, int lineLength, boolean htmlStyle) 745 */ 746 public String getDocumentation(String indent, int lineLength, boolean htmlStyle) 747 { 748 return this.getSuperFrontEndEvent().getDocumentation(indent, lineLength, htmlStyle); 749 } 750 751 /** 752 * The fully qualified name of this model element. 753 * @see ModelElementFacade#getFullyQualifiedName() 754 */ 755 public String getFullyQualifiedName() 756 { 757 return this.getSuperFrontEndEvent().getFullyQualifiedName(); 758 } 759 760 /** 761 * Returns the fully qualified name of the model element. The fully qualified name includes 762 * complete package qualified name of the underlying model element. If modelName is true, then 763 * the original name of the model element (the name contained within the model) will be the name 764 * returned, otherwise a name from a language mapping will be returned. 765 * @see ModelElementFacade#getFullyQualifiedName(boolean modelName) 766 */ 767 public String getFullyQualifiedName(boolean modelName) 768 { 769 return this.getSuperFrontEndEvent().getFullyQualifiedName(modelName); 770 } 771 772 /** 773 * Returns the fully qualified name as a path, the returned value always starts with out a slash 774 * '/'. 775 * @see ModelElementFacade#getFullyQualifiedNamePath() 776 */ 777 public String getFullyQualifiedNamePath() 778 { 779 return this.getSuperFrontEndEvent().getFullyQualifiedNamePath(); 780 } 781 782 /** 783 * Gets the unique identifier of the underlying model element. 784 * @see ModelElementFacade#getId() 785 */ 786 public String getId() 787 { 788 return this.getSuperFrontEndEvent().getId(); 789 } 790 791 /** 792 * UML2: Retrieves the keywords for this element. Used to modify implementation properties which 793 * are not represented by other properties, i.e. native, transient, volatile, synchronized, 794 * (added annotations) override, deprecated. Can also be used to suppress compiler warnings: 795 * (added annotations) unchecked, fallthrough, path, serial, finally, all. Annotations require 796 * JDK5 compiler level. 797 * @see ModelElementFacade#getKeywords() 798 */ 799 public Collection<String> getKeywords() 800 { 801 return this.getSuperFrontEndEvent().getKeywords(); 802 } 803 804 /** 805 * UML2: Retrieves a localized label for this named element. 806 * @see ModelElementFacade#getLabel() 807 */ 808 public String getLabel() 809 { 810 return this.getSuperFrontEndEvent().getLabel(); 811 } 812 813 /** 814 * The language mappings that have been set for this model element. 815 * @see ModelElementFacade#getLanguageMappings() 816 */ 817 public TypeMappings getLanguageMappings() 818 { 819 return this.getSuperFrontEndEvent().getLanguageMappings(); 820 } 821 822 /** 823 * Return the model containing this model element (multiple models may be loaded and processed 824 * at the same time). 825 * @see ModelElementFacade#getModel() 826 */ 827 public ModelFacade getModel() 828 { 829 return this.getSuperFrontEndEvent().getModel(); 830 } 831 832 /** 833 * The name of the model element. 834 * @see ModelElementFacade#getName() 835 */ 836 public String getName() 837 { 838 return this.getSuperFrontEndEvent().getName(); 839 } 840 841 /** 842 * Gets the package to which this model element belongs. 843 * @see ModelElementFacade#getPackage() 844 */ 845 public ModelElementFacade getPackage() 846 { 847 return this.getSuperFrontEndEvent().getPackage(); 848 } 849 850 /** 851 * The name of this model element's package. 852 * @see ModelElementFacade#getPackageName() 853 */ 854 public String getPackageName() 855 { 856 return this.getSuperFrontEndEvent().getPackageName(); 857 } 858 859 /** 860 * Gets the package name (optionally providing the ability to retrieve the model name and not 861 * the mapped name). 862 * @see ModelElementFacade#getPackageName(boolean modelName) 863 */ 864 public String getPackageName(boolean modelName) 865 { 866 return this.getSuperFrontEndEvent().getPackageName(modelName); 867 } 868 869 /** 870 * Returns the package as a path, the returned value always starts with out a slash '/'. 871 * @see ModelElementFacade#getPackagePath() 872 */ 873 public String getPackagePath() 874 { 875 return this.getSuperFrontEndEvent().getPackagePath(); 876 } 877 878 /** 879 * UML2: Returns the value of the 'Qualified Name' attribute. A name which allows the 880 * NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from 881 * the names of the containing namespaces starting at the root of the hierarchy and ending with 882 * the name of the NamedElement itself. 883 * @see ModelElementFacade#getQualifiedName() 884 */ 885 public String getQualifiedName() 886 { 887 return this.getSuperFrontEndEvent().getQualifiedName(); 888 } 889 890 /** 891 * Gets the root package for the model element. 892 * @see ModelElementFacade#getRootPackage() 893 */ 894 public PackageFacade getRootPackage() 895 { 896 return this.getSuperFrontEndEvent().getRootPackage(); 897 } 898 899 /** 900 * Gets the dependencies for which this model element is the source. 901 * @see ModelElementFacade#getSourceDependencies() 902 */ 903 public Collection<DependencyFacade> getSourceDependencies() 904 { 905 return this.getSuperFrontEndEvent().getSourceDependencies(); 906 } 907 908 /** 909 * If this model element is the context of an activity graph, this represents that activity 910 * graph. 911 * @see ModelElementFacade#getStateMachineContext() 912 */ 913 public StateMachineFacade getStateMachineContext() 914 { 915 return this.getSuperFrontEndEvent().getStateMachineContext(); 916 } 917 918 /** 919 * The collection of ALL stereotype names for this model element. 920 * @see ModelElementFacade#getStereotypeNames() 921 */ 922 public Collection<String> getStereotypeNames() 923 { 924 return this.getSuperFrontEndEvent().getStereotypeNames(); 925 } 926 927 /** 928 * Gets all stereotypes for this model element. 929 * @see ModelElementFacade#getStereotypes() 930 */ 931 public Collection<StereotypeFacade> getStereotypes() 932 { 933 return this.getSuperFrontEndEvent().getStereotypes(); 934 } 935 936 /** 937 * Return the TaggedValues associated with this model element, under all stereotypes. 938 * @see ModelElementFacade#getTaggedValues() 939 */ 940 public Collection<TaggedValueFacade> getTaggedValues() 941 { 942 return this.getSuperFrontEndEvent().getTaggedValues(); 943 } 944 945 /** 946 * Gets the dependencies for which this model element is the target. 947 * @see ModelElementFacade#getTargetDependencies() 948 */ 949 public Collection<DependencyFacade> getTargetDependencies() 950 { 951 return this.getSuperFrontEndEvent().getTargetDependencies(); 952 } 953 954 /** 955 * Get the template parameter for this model element having the parameterName 956 * @see ModelElementFacade#getTemplateParameter(String parameterName) 957 */ 958 public Object getTemplateParameter(String parameterName) 959 { 960 return this.getSuperFrontEndEvent().getTemplateParameter(parameterName); 961 } 962 963 /** 964 * Get the template parameters for this model element 965 * @see ModelElementFacade#getTemplateParameters() 966 */ 967 public Collection<TemplateParameterFacade> getTemplateParameters() 968 { 969 return this.getSuperFrontEndEvent().getTemplateParameters(); 970 } 971 972 /** 973 * The visibility (i.e. public, private, protected or package) of the model element, will 974 * attempt a lookup for these values in the language mappings (if any). 975 * @see ModelElementFacade#getVisibility() 976 */ 977 public String getVisibility() 978 { 979 return this.getSuperFrontEndEvent().getVisibility(); 980 } 981 982 /** 983 * Returns true if the model element has the exact stereotype (meaning no stereotype inheritance 984 * is taken into account when searching for the stereotype), false otherwise. 985 * @see ModelElementFacade#hasExactStereotype(String stereotypeName) 986 */ 987 public boolean hasExactStereotype(String stereotypeName) 988 { 989 return this.getSuperFrontEndEvent().hasExactStereotype(stereotypeName); 990 } 991 992 /** 993 * Does the UML Element contain the named Keyword? Keywords can be separated by space, comma, 994 * pipe, semicolon, or << >> 995 * @see ModelElementFacade#hasKeyword(String keywordName) 996 */ 997 public boolean hasKeyword(String keywordName) 998 { 999 return this.getSuperFrontEndEvent().hasKeyword(keywordName); 1000 } 1001 1002 /** 1003 * Returns true if the model element has the specified stereotype. If the stereotype itself 1004 * does not match, then a search will be made up the stereotype inheritance hierarchy, and if 1005 * one of the stereotype's ancestors has a matching name this method will return true, false 1006 * otherwise. 1007 * For example, if we have a certain stereotype called <<exception>> and a model element has a 1008 * stereotype called <<applicationException>> which extends <<exception>>, when calling this 1009 * method with 'stereotypeName' defined as 'exception' the method would return true since 1010 * <<applicationException>> inherits from <<exception>>. If you want to check if the model 1011 * element has the exact stereotype, then use the method 'hasExactStereotype' instead. 1012 * @see ModelElementFacade#hasStereotype(String stereotypeName) 1013 */ 1014 public boolean hasStereotype(String stereotypeName) 1015 { 1016 return this.getSuperFrontEndEvent().hasStereotype(stereotypeName); 1017 } 1018 1019 /** 1020 * True if there are target dependencies from this element that are instances of BindingFacade. 1021 * Deprecated in UML2: Use TemplateBinding parameters instead of dependencies. 1022 * @see ModelElementFacade#isBindingDependenciesPresent() 1023 */ 1024 public boolean isBindingDependenciesPresent() 1025 { 1026 return this.getSuperFrontEndEvent().isBindingDependenciesPresent(); 1027 } 1028 1029 /** 1030 * Indicates if any constraints are present on this model element. 1031 * @see ModelElementFacade#isConstraintsPresent() 1032 */ 1033 public boolean isConstraintsPresent() 1034 { 1035 return this.getSuperFrontEndEvent().isConstraintsPresent(); 1036 } 1037 1038 /** 1039 * Indicates if any documentation is present on this model element. 1040 * @see ModelElementFacade#isDocumentationPresent() 1041 */ 1042 public boolean isDocumentationPresent() 1043 { 1044 return this.getSuperFrontEndEvent().isDocumentationPresent(); 1045 } 1046 1047 /** 1048 * True if this element name is a reserved word in Java, C#, ANSI or ISO C, C++, JavaScript. 1049 * @see ModelElementFacade#isReservedWord() 1050 */ 1051 public boolean isReservedWord() 1052 { 1053 return this.getSuperFrontEndEvent().isReservedWord(); 1054 } 1055 1056 /** 1057 * True is there are template parameters on this model element. For UML2, applies to Class, 1058 * Operation, Property, and Parameter. 1059 * @see ModelElementFacade#isTemplateParametersPresent() 1060 */ 1061 public boolean isTemplateParametersPresent() 1062 { 1063 return this.getSuperFrontEndEvent().isTemplateParametersPresent(); 1064 } 1065 1066 /** 1067 * True if this element name is a valid identifier name in Java, C#, ANSI or ISO C, C++, 1068 * JavaScript. Contains no spaces, special characters etc. Constraint always applied on 1069 * Enumerations and Interfaces, optionally applies on other model elements. 1070 * @see ModelElementFacade#isValidIdentifierName() 1071 */ 1072 public boolean isValidIdentifierName() 1073 { 1074 return this.getSuperFrontEndEvent().isValidIdentifierName(); 1075 } 1076 1077 /** 1078 * Searches for the constraint with the specified 'name' on this model element, and if found 1079 * translates it using the specified 'translation' from a translation library discovered by the 1080 * framework. 1081 * @see ModelElementFacade#translateConstraint(String name, String translation) 1082 */ 1083 public String translateConstraint(String name, String translation) 1084 { 1085 return this.getSuperFrontEndEvent().translateConstraint(name, translation); 1086 } 1087 1088 /** 1089 * Translates all constraints belonging to this model element with the given 'translation'. 1090 * @see ModelElementFacade#translateConstraints(String translation) 1091 */ 1092 public String[] translateConstraints(String translation) 1093 { 1094 return this.getSuperFrontEndEvent().translateConstraints(translation); 1095 } 1096 1097 /** 1098 * Translates the constraints of the specified 'kind' belonging to this model element. 1099 * @see ModelElementFacade#translateConstraints(String kind, String translation) 1100 */ 1101 public String[] translateConstraints(String kind, String translation) 1102 { 1103 return this.getSuperFrontEndEvent().translateConstraints(kind, translation); 1104 } 1105 1106 /** 1107 * @see MetafacadeBase#initialize() 1108 */ 1109 @Override 1110 public void initialize() 1111 { 1112 this.getSuperFrontEndEvent().initialize(); 1113 } 1114 1115 /** 1116 * @return Object getSuperFrontEndEvent().getValidationOwner() 1117 * @see MetafacadeBase#getValidationOwner() 1118 */ 1119 @Override 1120 public Object getValidationOwner() 1121 { 1122 Object owner = this.getSuperFrontEndEvent().getValidationOwner(); 1123 return owner; 1124 } 1125 1126 /** 1127 * @return String getSuperFrontEndEvent().getValidationName() 1128 * @see MetafacadeBase#getValidationName() 1129 */ 1130 @Override 1131 public String getValidationName() 1132 { 1133 String name = this.getSuperFrontEndEvent().getValidationName(); 1134 return name; 1135 } 1136 1137 /** 1138 * <p><b>Constraint:</b> org::andromda::cartridges::bpm4struts::metafacades::StrutsTrigger::each action trigger must have a name</p> 1139 * <p><b>Error:</b> Every trigger modeled on a transition going out of a FrontEndView action state must have a name. These triggers are known as action-triggers.</p> 1140 * <p><b>OCL:</b> context StrutsTrigger inv: transition.exitingPage implies name->notEmpty()</p> 1141 * @param validationMessages Collection<ModelValidationMessage> 1142 * @see MetafacadeBase#validateInvariants(Collection validationMessages) 1143 */ 1144 @Override 1145 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 1146 { 1147 this.getSuperFrontEndEvent().validateInvariants(validationMessages); 1148 try 1149 { 1150 final Object contextElement = this.THIS(); 1151 boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"transition.exitingPage"))).booleanValue()?OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"name")):true)); 1152 if (!constraintValid) 1153 { 1154 validationMessages.add( 1155 new ModelValidationMessage( 1156 (MetafacadeBase)contextElement , 1157 "org::andromda::cartridges::bpm4struts::metafacades::StrutsTrigger::each action trigger must have a name", 1158 "Every trigger modeled on a transition going out of a FrontEndView action state must have a name. These triggers are known as action-triggers.")); 1159 } 1160 } 1161 catch (Throwable th) 1162 { 1163 Throwable cause = th.getCause(); 1164 int depth = 0; // Some throwables have infinite recursion 1165 while (cause != null && depth < 7) 1166 { 1167 th = cause; 1168 depth++; 1169 } 1170 logger.error("Error validating constraint 'org::andromda::cartridges::bpm4struts::metafacades::StrutsTrigger::each action trigger must have a name' ON " 1171 + this.THIS().toString() + ": " + th.getMessage(), th); 1172 } 1173 } 1174 1175 /** 1176 * The property that stores the name of the metafacade. 1177 */ 1178 private static final String NAME_PROPERTY = "name"; 1179 private static final String FQNAME_PROPERTY = "fullyQualifiedName"; 1180 1181 /** 1182 * @see Object#toString() 1183 */ 1184 @Override 1185 public String toString() 1186 { 1187 final StringBuilder toString = new StringBuilder(this.getClass().getName()); 1188 toString.append("["); 1189 try 1190 { 1191 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY)); 1192 } 1193 catch (final Throwable tryAgain) 1194 { 1195 try 1196 { 1197 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY)); 1198 } 1199 catch (final Throwable ignore) 1200 { 1201 // - just ignore when the metafacade doesn't have a name or fullyQualifiedName property 1202 } 1203 } 1204 toString.append("]"); 1205 return toString.toString(); 1206 } 1207}