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