View Javadoc

1   //
2   // Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
3   //
4   package org.andromda.metafacades.uml14;
5   
6   /***
7    * MetafacadeLogic for org.andromda.metafacades.uml.Role
8    *
9    * @see org.andromda.metafacades.uml.Role
10   */
11  public abstract class RoleLogic
12      extends org.andromda.metafacades.uml14.ActorFacadeLogicImpl
13      implements org.andromda.metafacades.uml.Role
14  {
15  
16      protected Object metaObject;
17  
18      public RoleLogic(Object metaObject, String context)
19      {
20          super((org.omg.uml.behavioralelements.usecases.Actor)metaObject, getContext(context));
21          this.metaObject = metaObject;
22      }
23  
24      /***
25       * Gets the context for this metafacade logic instance.
26       */
27      private static String getContext(String context)
28      {
29          if (context == null)
30          {
31              context = "org.andromda.metafacades.uml.Role";
32          }
33          return context;
34      }
35  
36      /***
37       * @see org.andromda.core.metafacade.MetafacadeBase
38       */
39      public void resetMetafacadeContext(String context)
40      {
41          if (!this.contextRoot) // reset context only for non-root metafacades
42          {
43              context = getContext(context);  // to have same value as in original constructor call
44              setMetafacadeContext (context);
45          }
46      }
47  
48      /***
49       * @see org.andromda.metafacades.uml.Role
50       */
51      public boolean isRoleMetaType()
52      {
53          return true;
54      }
55      
56      // --------------- attributes ---------------------
57  
58     /***
59      * @see org.andromda.metafacades.uml.Role#isReferencesPresent()
60      */
61      protected abstract boolean handleIsReferencesPresent();
62  
63      private void handleIsReferencesPresent1aPreCondition()
64      {
65      }
66  
67      private void handleIsReferencesPresent1aPostCondition()
68      {
69      }
70  
71      private boolean __referencesPresent1a;
72      private boolean __referencesPresent1aSet = false;
73  
74      public final boolean isReferencesPresent()
75      {
76          boolean referencesPresent1a = this.__referencesPresent1a;
77          if (!this.__referencesPresent1aSet)
78          {
79              handleIsReferencesPresent1aPreCondition();
80              referencesPresent1a = handleIsReferencesPresent();
81              handleIsReferencesPresent1aPostCondition();
82              this.__referencesPresent1a = referencesPresent1a;
83              if (isMetafacadePropertyCachingEnabled())
84              {
85                  this.__referencesPresent1aSet = true;
86              }
87          }
88          return referencesPresent1a;
89      }
90  
91      // ------------- associations ------------------
92  
93      /***
94       * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(java.util.Collection)
95       */
96      public void validateInvariants(java.util.Collection validationMessages)
97      {
98          super.validateInvariants(validationMessages);
99          {
100             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure(org.andromda.translation.ocl.validation.OCLCollections.notEmpty(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"name"))&&org.andromda.translation.ocl.validation.OCLCollections.isUnique(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"model.allActors"),new org.apache.commons.collections.Transformer(){public Object transform(java.lang.Object object){return org.andromda.translation.ocl.validation.OCLIntrospector.invoke(object,"name");}})); 
101             if (!constraintValid)
102                 validationMessages.add(
103                     new org.andromda.core.metafacade.ModelValidationMessage(
104                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
105                         "org::andromda::metafacades::uml::Role::non-empty unique role name",
106                         "Each role must have a non-empty name that is unique among all other roles."));
107         }
108     }
109     
110     /***
111      * The property that stores the name of the metafacade.
112      */
113     private static final String NAME_PROPERTY = "name";
114     
115     /***
116      * @see java.lang.Object#toString()
117      */
118     public String toString()
119     {
120         final StringBuffer toString = new StringBuffer(this.getClass().getName());
121         toString.append("[");
122         try
123         {
124             toString.append(org.andromda.core.common.Introspector.instance().getProperty(this, NAME_PROPERTY));
125         }
126         catch (final Throwable throwable)
127         {
128             // - just ignore when the metafacade doesn't have a name property
129         }
130         toString.append("]");
131         return toString.toString();
132     }
133 }