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.FrontEndControllerOperation
8    *
9    * @see org.andromda.metafacades.uml.FrontEndControllerOperation
10   */
11  public abstract class FrontEndControllerOperationLogic
12      extends org.andromda.metafacades.uml14.OperationFacadeLogicImpl
13      implements org.andromda.metafacades.uml.FrontEndControllerOperation
14  {
15  
16      protected Object metaObject;
17  
18      public FrontEndControllerOperationLogic(Object metaObject, String context)
19      {
20          super((org.omg.uml.foundation.core.Operation)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.FrontEndControllerOperation";
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.FrontEndControllerOperation
50       */
51      public boolean isFrontEndControllerOperationMetaType()
52      {
53          return true;
54      }
55      
56      // --------------- attributes ---------------------
57  
58     /***
59      * @see org.andromda.metafacades.uml.FrontEndControllerOperation#isOwnerIsController()
60      */
61      protected abstract boolean handleIsOwnerIsController();
62  
63      private void handleIsOwnerIsController1aPreCondition()
64      {
65      }
66  
67      private void handleIsOwnerIsController1aPostCondition()
68      {
69      }
70  
71      private boolean __ownerIsController1a;
72      private boolean __ownerIsController1aSet = false;
73  
74      public final boolean isOwnerIsController()
75      {
76          boolean ownerIsController1a = this.__ownerIsController1a;
77          if (!this.__ownerIsController1aSet)
78          {
79              handleIsOwnerIsController1aPreCondition();
80              ownerIsController1a = handleIsOwnerIsController();
81              handleIsOwnerIsController1aPostCondition();
82              this.__ownerIsController1a = ownerIsController1a;
83              if (isMetafacadePropertyCachingEnabled())
84              {
85                  this.__ownerIsController1aSet = true;
86              }
87          }
88          return ownerIsController1a;
89      }
90  
91     /***
92      * @see org.andromda.metafacades.uml.FrontEndControllerOperation#isAllArgumentsHaveFormFields()
93      */
94      protected abstract boolean handleIsAllArgumentsHaveFormFields();
95  
96      private void handleIsAllArgumentsHaveFormFields2aPreCondition()
97      {
98      }
99  
100     private void handleIsAllArgumentsHaveFormFields2aPostCondition()
101     {
102     }
103 
104     private boolean __allArgumentsHaveFormFields2a;
105     private boolean __allArgumentsHaveFormFields2aSet = false;
106 
107     public final boolean isAllArgumentsHaveFormFields()
108     {
109         boolean allArgumentsHaveFormFields2a = this.__allArgumentsHaveFormFields2a;
110         if (!this.__allArgumentsHaveFormFields2aSet)
111         {
112             handleIsAllArgumentsHaveFormFields2aPreCondition();
113             allArgumentsHaveFormFields2a = handleIsAllArgumentsHaveFormFields();
114             handleIsAllArgumentsHaveFormFields2aPostCondition();
115             this.__allArgumentsHaveFormFields2a = allArgumentsHaveFormFields2a;
116             if (isMetafacadePropertyCachingEnabled())
117             {
118                 this.__allArgumentsHaveFormFields2aSet = true;
119             }
120         }
121         return allArgumentsHaveFormFields2a;
122     }
123 
124     // ------------- associations ------------------
125 
126     private void handleGetFormFields2rPreCondition()
127     {
128     }
129 
130     private void handleGetFormFields2rPostCondition()
131     {
132     }
133 
134     private java.util.List __getFormFields2r;
135     private boolean __getFormFields2rSet = false;
136 
137     public final java.util.List getFormFields()
138     {
139         java.util.List getFormFields2r = this.__getFormFields2r;
140         if (!this.__getFormFields2rSet)
141         {
142             handleGetFormFields2rPreCondition();
143             Object result = this.shieldedElements(handleGetFormFields());
144             try
145             {
146                 getFormFields2r = (java.util.List)result;
147             }
148             catch (ClassCastException ex)
149             {
150                 // ignore since the metafacade shouldn't
151                 // be set if its not of the correct type
152             }
153             handleGetFormFields2rPostCondition();
154             this.__getFormFields2r = getFormFields2r;
155             if (isMetafacadePropertyCachingEnabled())
156             {
157                 this.__getFormFields2rSet = true;
158             }
159         }
160         return getFormFields2r;
161     }
162 
163     protected abstract java.util.List handleGetFormFields();
164 
165     private void handleGetDeferringActions3rPreCondition()
166     {
167     }
168 
169     private void handleGetDeferringActions3rPostCondition()
170     {
171     }
172 
173     private java.util.List __getDeferringActions3r;
174     private boolean __getDeferringActions3rSet = false;
175 
176     public final java.util.List getDeferringActions()
177     {
178         java.util.List getDeferringActions3r = this.__getDeferringActions3r;
179         if (!this.__getDeferringActions3rSet)
180         {
181             handleGetDeferringActions3rPreCondition();
182             Object result = this.shieldedElements(handleGetDeferringActions());
183             try
184             {
185                 getDeferringActions3r = (java.util.List)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             handleGetDeferringActions3rPostCondition();
193             this.__getDeferringActions3r = getDeferringActions3r;
194             if (isMetafacadePropertyCachingEnabled())
195             {
196                 this.__getDeferringActions3rSet = true;
197             }
198         }
199         return getDeferringActions3r;
200     }
201 
202     protected abstract java.util.List handleGetDeferringActions();
203 
204     private void handleGetActivityGraph4rPreCondition()
205     {
206     }
207 
208     private void handleGetActivityGraph4rPostCondition()
209     {
210     }
211 
212     private org.andromda.metafacades.uml.FrontEndActivityGraph __getActivityGraph4r;
213     private boolean __getActivityGraph4rSet = false;
214 
215     public final org.andromda.metafacades.uml.FrontEndActivityGraph getActivityGraph()
216     {
217         org.andromda.metafacades.uml.FrontEndActivityGraph getActivityGraph4r = this.__getActivityGraph4r;
218         if (!this.__getActivityGraph4rSet)
219         {
220             handleGetActivityGraph4rPreCondition();
221             Object result = this.shieldedElement(handleGetActivityGraph());
222             try
223             {
224                 getActivityGraph4r = (org.andromda.metafacades.uml.FrontEndActivityGraph)result;
225             }
226             catch (ClassCastException ex)
227             {
228                 // ignore since the metafacade shouldn't
229                 // be set if its not of the correct type
230             }
231             handleGetActivityGraph4rPostCondition();
232             this.__getActivityGraph4r = getActivityGraph4r;
233             if (isMetafacadePropertyCachingEnabled())
234             {
235                 this.__getActivityGraph4rSet = true;
236             }
237         }
238         return getActivityGraph4r;
239     }
240 
241     protected abstract java.lang.Object handleGetActivityGraph();
242 
243     /***
244      * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(java.util.Collection)
245      */
246     public void validateInvariants(java.util.Collection validationMessages)
247     {
248         super.validateInvariants(validationMessages);
249         {
250             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"allArgumentsHaveFormFields")); 
251             if (!constraintValid)
252                 validationMessages.add(
253                     new org.andromda.core.metafacade.ModelValidationMessage(
254                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
255                         "org::andromda::metafacades::uml::FrontEndControllerOperation::all arguments need an event parameter",
256                         "For each controller operation argument there must exist a parameter for each action deferring to that operation. This parameter must carry the same name and must be of the same type."));
257         }
258         {
259             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure(org.andromda.translation.ocl.validation.OCLExpressions.notEqual(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"name"),org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"owner.useCase.name"))); 
260             if (!constraintValid)
261                 validationMessages.add(
262                     new org.andromda.core.metafacade.ModelValidationMessage(
263                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
264                         "org::andromda::metafacades::uml::FrontEndControllerOperation::the operation name may not be the same as the use-case name",
265                         "It is not allowed to give a controller operation the same name as the use-case for which it is defined, please either rename your operation or your use-case."));
266         }
267     }
268     
269     /***
270      * The property that stores the name of the metafacade.
271      */
272     private static final String NAME_PROPERTY = "name";
273     
274     /***
275      * @see java.lang.Object#toString()
276      */
277     public String toString()
278     {
279         final StringBuffer toString = new StringBuffer(this.getClass().getName());
280         toString.append("[");
281         try
282         {
283             toString.append(org.andromda.core.common.Introspector.instance().getProperty(this, NAME_PROPERTY));
284         }
285         catch (final Throwable throwable)
286         {
287             // - just ignore when the metafacade doesn't have a name property
288         }
289         toString.append("]");
290         return toString.toString();
291     }
292 }