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.Service
8    *
9    * @see org.andromda.metafacades.uml.Service
10   */
11  public abstract class ServiceLogic
12      extends org.andromda.metafacades.uml14.ClassifierFacadeLogicImpl
13      implements org.andromda.metafacades.uml.Service
14  {
15  
16      protected Object metaObject;
17  
18      public ServiceLogic(Object metaObject, String context)
19      {
20          super((org.omg.uml.foundation.core.Classifier)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.Service";
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.Service
50       */
51      public boolean isServiceMetaType()
52      {
53          return true;
54      }
55      
56      // ------------- associations ------------------
57  
58      private void handleGetServiceReferences1rPreCondition()
59      {
60      }
61  
62      private void handleGetServiceReferences1rPostCondition()
63      {
64      }
65  
66      public final java.util.Collection getServiceReferences()
67      {
68          java.util.Collection getServiceReferences1r = null;
69          handleGetServiceReferences1rPreCondition();
70          Object result = this.shieldedElements(handleGetServiceReferences());
71          try
72          {
73              getServiceReferences1r = (java.util.Collection)result;
74          }
75          catch (ClassCastException ex)
76          {
77              // ignore since the metafacade shouldn't
78              // be set if its not of the correct type
79          }
80          handleGetServiceReferences1rPostCondition();
81          return getServiceReferences1r;
82      }
83  
84      protected abstract java.util.Collection handleGetServiceReferences();
85  
86      private void handleGetEntityReferences2rPreCondition()
87      {
88      }
89  
90      private void handleGetEntityReferences2rPostCondition()
91      {
92      }
93  
94      public final java.util.Collection getEntityReferences()
95      {
96          java.util.Collection getEntityReferences2r = null;
97          handleGetEntityReferences2rPreCondition();
98          Object result = this.shieldedElements(handleGetEntityReferences());
99          try
100         {
101             getEntityReferences2r = (java.util.Collection)result;
102         }
103         catch (ClassCastException ex)
104         {
105             // ignore since the metafacade shouldn't
106             // be set if its not of the correct type
107         }
108         handleGetEntityReferences2rPostCondition();
109         return getEntityReferences2r;
110     }
111 
112     protected abstract java.util.Collection handleGetEntityReferences();
113 
114     private void handleGetRoles3rPreCondition()
115     {
116     }
117 
118     private void handleGetRoles3rPostCondition()
119     {
120     }
121 
122     public final java.util.Collection getRoles()
123     {
124         java.util.Collection getRoles3r = null;
125         handleGetRoles3rPreCondition();
126         Object result = this.shieldedElements(handleGetRoles());
127         try
128         {
129             getRoles3r = (java.util.Collection)result;
130         }
131         catch (ClassCastException ex)
132         {
133             // ignore since the metafacade shouldn't
134             // be set if its not of the correct type
135         }
136         handleGetRoles3rPostCondition();
137         return getRoles3r;
138     }
139 
140     protected abstract java.util.Collection handleGetRoles();
141 
142     private void handleGetAllRoles4rPreCondition()
143     {
144     }
145 
146     private void handleGetAllRoles4rPostCondition()
147     {
148     }
149 
150     public final java.util.Collection getAllRoles()
151     {
152         java.util.Collection getAllRoles4r = null;
153         handleGetAllRoles4rPreCondition();
154         Object result = this.shieldedElements(handleGetAllRoles());
155         try
156         {
157             getAllRoles4r = (java.util.Collection)result;
158         }
159         catch (ClassCastException ex)
160         {
161             // ignore since the metafacade shouldn't
162             // be set if its not of the correct type
163         }
164         handleGetAllRoles4rPostCondition();
165         return getAllRoles4r;
166     }
167 
168     protected abstract java.util.Collection handleGetAllRoles();
169 
170     private void handleGetAllServiceReferences6rPreCondition()
171     {
172     }
173 
174     private void handleGetAllServiceReferences6rPostCondition()
175     {
176     }
177 
178     public final java.util.Collection getAllServiceReferences()
179     {
180         java.util.Collection getAllServiceReferences6r = null;
181         handleGetAllServiceReferences6rPreCondition();
182         Object result = this.shieldedElements(handleGetAllServiceReferences());
183         try
184         {
185             getAllServiceReferences6r = (java.util.Collection)result;
186         }
187         catch (ClassCastException ex)
188         {
189             // ignore since the metafacade shouldn't
190             // be set if its not of the correct type
191         }
192         handleGetAllServiceReferences6rPostCondition();
193         return getAllServiceReferences6r;
194     }
195 
196     protected abstract java.util.Collection handleGetAllServiceReferences();
197 
198     /***
199      * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(java.util.Collection)
200      */
201     public void validateInvariants(java.util.Collection validationMessages)
202     {
203         super.validateInvariants(validationMessages);
204         {
205             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(org.andromda.translation.ocl.validation.OCLCollections.notEmpty(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"generalization")))).booleanValue()?org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"generalization") instanceof org.andromda.metafacades.uml.Service:true)); 
206             if (!constraintValid)
207                 validationMessages.add(
208                     new org.andromda.core.metafacade.ModelValidationMessage(
209                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
210                         "org::andromda::metafacades::uml::Service::a service can only generalize another service",
211                         "A service can only generalize another service."));
212         }
213         {
214             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(org.andromda.translation.ocl.validation.OCLCollections.notEmpty(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"specializations")))).booleanValue()?org.andromda.translation.ocl.validation.OCLCollections.forAll(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"specializations"),new org.apache.commons.collections.Predicate(){public boolean evaluate(java.lang.Object object){return Boolean.valueOf(String.valueOf(object instanceof org.andromda.metafacades.uml.Service)).booleanValue();}}):true)); 
215             if (!constraintValid)
216                 validationMessages.add(
217                     new org.andromda.core.metafacade.ModelValidationMessage(
218                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
219                         "org::andromda::metafacades::uml::Service::services can only specialize other service",
220                         "A service can only specialize another service."));
221         }
222     }
223     
224     /***
225      * The property that stores the name of the metafacade.
226      */
227     private static final String NAME_PROPERTY = "name";
228     
229     /***
230      * @see java.lang.Object#toString()
231      */
232     public String toString()
233     {
234         final StringBuffer toString = new StringBuffer(this.getClass().getName());
235         toString.append("[");
236         try
237         {
238             toString.append(org.andromda.core.common.Introspector.instance().getProperty(this, NAME_PROPERTY));
239         }
240         catch (final Throwable throwable)
241         {
242             // - just ignore when the metafacade doesn't have a name property
243         }
244         toString.append("]");
245         return toString.toString();
246     }
247 }