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.FrontEndView
8    *
9    * @see org.andromda.metafacades.uml.FrontEndView
10   */
11  public abstract class FrontEndViewLogic
12      extends org.andromda.metafacades.uml14.FrontEndActionStateLogicImpl
13      implements org.andromda.metafacades.uml.FrontEndView
14  {
15  
16      protected Object metaObject;
17  
18      public FrontEndViewLogic(Object metaObject, String context)
19      {
20          super(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.FrontEndView";
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.FrontEndView
50       */
51      public boolean isFrontEndViewMetaType()
52      {
53          return true;
54      }
55      
56      // --------------- attributes ---------------------
57  
58     /***
59      * @see org.andromda.metafacades.uml.FrontEndView#isFrontEndView()
60      */
61      protected abstract boolean handleIsFrontEndView();
62  
63      private void handleIsFrontEndView1aPreCondition()
64      {
65      }
66  
67      private void handleIsFrontEndView1aPostCondition()
68      {
69      }
70  
71      private boolean __frontEndView1a;
72      private boolean __frontEndView1aSet = false;
73  
74      public final boolean isFrontEndView()
75      {
76          boolean frontEndView1a = this.__frontEndView1a;
77          if (!this.__frontEndView1aSet)
78          {
79              handleIsFrontEndView1aPreCondition();
80              frontEndView1a = handleIsFrontEndView();
81              handleIsFrontEndView1aPostCondition();
82              this.__frontEndView1a = frontEndView1a;
83              if (isMetafacadePropertyCachingEnabled())
84              {
85                  this.__frontEndView1aSet = true;
86              }
87          }
88          return frontEndView1a;
89      }
90  
91      // ------------- associations ------------------
92  
93      private void handleGetUseCase1rPreCondition()
94      {
95      }
96  
97      private void handleGetUseCase1rPostCondition()
98      {
99      }
100 
101     private org.andromda.metafacades.uml.FrontEndUseCase __getUseCase1r;
102     private boolean __getUseCase1rSet = false;
103 
104     public final org.andromda.metafacades.uml.FrontEndUseCase getUseCase()
105     {
106         org.andromda.metafacades.uml.FrontEndUseCase getUseCase1r = this.__getUseCase1r;
107         if (!this.__getUseCase1rSet)
108         {
109             handleGetUseCase1rPreCondition();
110             Object result = this.shieldedElement(handleGetUseCase());
111             try
112             {
113                 getUseCase1r = (org.andromda.metafacades.uml.FrontEndUseCase)result;
114             }
115             catch (ClassCastException ex)
116             {
117                 // ignore since the metafacade shouldn't
118                 // be set if its not of the correct type
119             }
120             handleGetUseCase1rPostCondition();
121             this.__getUseCase1r = getUseCase1r;
122             if (isMetafacadePropertyCachingEnabled())
123             {
124                 this.__getUseCase1rSet = true;
125             }
126         }
127         return getUseCase1r;
128     }
129 
130     protected abstract java.lang.Object handleGetUseCase();
131 
132     private void handleGetVariables2rPreCondition()
133     {
134     }
135 
136     private void handleGetVariables2rPostCondition()
137     {
138     }
139 
140     private java.util.List __getVariables2r;
141     private boolean __getVariables2rSet = false;
142 
143     public final java.util.List getVariables()
144     {
145         java.util.List getVariables2r = this.__getVariables2r;
146         if (!this.__getVariables2rSet)
147         {
148             handleGetVariables2rPreCondition();
149             Object result = this.shieldedElements(handleGetVariables());
150             try
151             {
152                 getVariables2r = (java.util.List)result;
153             }
154             catch (ClassCastException ex)
155             {
156                 // ignore since the metafacade shouldn't
157                 // be set if its not of the correct type
158             }
159             handleGetVariables2rPostCondition();
160             this.__getVariables2r = getVariables2r;
161             if (isMetafacadePropertyCachingEnabled())
162             {
163                 this.__getVariables2rSet = true;
164             }
165         }
166         return getVariables2r;
167     }
168 
169     protected abstract java.util.List handleGetVariables();
170 
171     private void handleGetActions3rPreCondition()
172     {
173     }
174 
175     private void handleGetActions3rPostCondition()
176     {
177     }
178 
179     private java.util.List __getActions3r;
180     private boolean __getActions3rSet = false;
181 
182     public final java.util.List getActions()
183     {
184         java.util.List getActions3r = this.__getActions3r;
185         if (!this.__getActions3rSet)
186         {
187             handleGetActions3rPreCondition();
188             Object result = this.shieldedElements(handleGetActions());
189             try
190             {
191                 getActions3r = (java.util.List)result;
192             }
193             catch (ClassCastException ex)
194             {
195                 // ignore since the metafacade shouldn't
196                 // be set if its not of the correct type
197             }
198             handleGetActions3rPostCondition();
199             this.__getActions3r = getActions3r;
200             if (isMetafacadePropertyCachingEnabled())
201             {
202                 this.__getActions3rSet = true;
203             }
204         }
205         return getActions3r;
206     }
207 
208     protected abstract java.util.List handleGetActions();
209 
210     private void handleGetAllFormFields4rPreCondition()
211     {
212     }
213 
214     private void handleGetAllFormFields4rPostCondition()
215     {
216     }
217 
218     private java.util.List __getAllFormFields4r;
219     private boolean __getAllFormFields4rSet = false;
220 
221     public final java.util.List getAllFormFields()
222     {
223         java.util.List getAllFormFields4r = this.__getAllFormFields4r;
224         if (!this.__getAllFormFields4rSet)
225         {
226             handleGetAllFormFields4rPreCondition();
227             Object result = this.shieldedElements(handleGetAllFormFields());
228             try
229             {
230                 getAllFormFields4r = (java.util.List)result;
231             }
232             catch (ClassCastException ex)
233             {
234                 // ignore since the metafacade shouldn't
235                 // be set if its not of the correct type
236             }
237             handleGetAllFormFields4rPostCondition();
238             this.__getAllFormFields4r = getAllFormFields4r;
239             if (isMetafacadePropertyCachingEnabled())
240             {
241                 this.__getAllFormFields4rSet = true;
242             }
243         }
244         return getAllFormFields4r;
245     }
246 
247     protected abstract java.util.List handleGetAllFormFields();
248 
249     private void handleGetAllActionParameters7rPreCondition()
250     {
251     }
252 
253     private void handleGetAllActionParameters7rPostCondition()
254     {
255     }
256 
257     private java.util.List __getAllActionParameters7r;
258     private boolean __getAllActionParameters7rSet = false;
259 
260     public final java.util.List getAllActionParameters()
261     {
262         java.util.List getAllActionParameters7r = this.__getAllActionParameters7r;
263         if (!this.__getAllActionParameters7rSet)
264         {
265             handleGetAllActionParameters7rPreCondition();
266             Object result = this.shieldedElements(handleGetAllActionParameters());
267             try
268             {
269                 getAllActionParameters7r = (java.util.List)result;
270             }
271             catch (ClassCastException ex)
272             {
273                 // ignore since the metafacade shouldn't
274                 // be set if its not of the correct type
275             }
276             handleGetAllActionParameters7rPostCondition();
277             this.__getAllActionParameters7r = getAllActionParameters7r;
278             if (isMetafacadePropertyCachingEnabled())
279             {
280                 this.__getAllActionParameters7rSet = true;
281             }
282         }
283         return getAllActionParameters7r;
284     }
285 
286     protected abstract java.util.List handleGetAllActionParameters();
287 
288     /***
289      * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(java.util.Collection)
290      */
291     public void validateInvariants(java.util.Collection validationMessages)
292     {
293         super.validateInvariants(validationMessages);
294         {
295             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure(org.andromda.translation.ocl.validation.OCLCollections.isUnique(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"useCase.views"),new org.apache.commons.collections.Transformer(){public Object transform(java.lang.Object object){return org.andromda.translation.ocl.validation.OCLIntrospector.invoke(object,"name");}})); 
296             if (!constraintValid)
297                 validationMessages.add(
298                     new org.andromda.core.metafacade.ModelValidationMessage(
299                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
300                         "org::andromda::metafacades::uml::FrontEndView::unique view name per usecase",
301                         "Each name of a view action state must be unique in the namespace of a front-end use-case."));
302         }
303         {
304             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure(org.andromda.translation.ocl.validation.OCLCollections.isUnique(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"variables"),new org.apache.commons.collections.Transformer(){public Object transform(java.lang.Object object){return org.andromda.translation.ocl.validation.OCLIntrospector.invoke(object,"name");}})); 
305             if (!constraintValid)
306                 validationMessages.add(
307                     new org.andromda.core.metafacade.ModelValidationMessage(
308                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
309                         "org::andromda::metafacades::uml::FrontEndView::view variables must have unique names",
310                         "Each view-variable should have a unique name within the context of a view."));
311         }
312         {
313             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure(org.andromda.translation.ocl.validation.OCLExpressions.equal(org.andromda.translation.ocl.validation.OCLCollections.size(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"controllerCalls")),0)); 
314             if (!constraintValid)
315                 validationMessages.add(
316                     new org.andromda.core.metafacade.ModelValidationMessage(
317                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
318                         "org::andromda::metafacades::uml::FrontEndView::front-end views cannot defer operations",
319                         "Views cannot defer to operations. All deferrable events modeled on a front-end view will be ignored."));
320         }
321         {
322             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure(org.andromda.translation.ocl.validation.OCLCollections.isUnique(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"actions"),new org.apache.commons.collections.Transformer(){public Object transform(java.lang.Object object){return org.andromda.translation.ocl.validation.OCLIntrospector.invoke(object,"name");}})); 
323             if (!constraintValid)
324                 validationMessages.add(
325                     new org.andromda.core.metafacade.ModelValidationMessage(
326                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
327                         "org::andromda::metafacades::uml::FrontEndView::each action going out of a front-end view must be unique",
328                         "Each view must contain actions which each have a unique name, this view has actions with duplicate names."));
329         }
330     }
331     
332     /***
333      * The property that stores the name of the metafacade.
334      */
335     private static final String NAME_PROPERTY = "name";
336     
337     /***
338      * @see java.lang.Object#toString()
339      */
340     public String toString()
341     {
342         final StringBuffer toString = new StringBuffer(this.getClass().getName());
343         toString.append("[");
344         try
345         {
346             toString.append(org.andromda.core.common.Introspector.instance().getProperty(this, NAME_PROPERTY));
347         }
348         catch (final Throwable throwable)
349         {
350             // - just ignore when the metafacade doesn't have a name property
351         }
352         toString.append("]");
353         return toString.toString();
354     }
355 }