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