View Javadoc
1   // license-header java merge-point
2   //
3   // Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
4   //
5   package org.andromda.metafacades.uml14;
6   
7   import java.util.Collection;
8   import java.util.List;
9   import org.andromda.core.metafacade.MetafacadeBase;
10  import org.andromda.core.metafacade.ModelValidationMessage;
11  import org.andromda.metafacades.uml.ActivityGraphFacade;
12  import org.andromda.metafacades.uml.ExtendFacade;
13  import org.andromda.metafacades.uml.ExtensionPointFacade;
14  import org.andromda.metafacades.uml.IncludeFacade;
15  import org.andromda.metafacades.uml.UseCaseFacade;
16  import org.apache.log4j.Logger;
17  import org.omg.uml.behavioralelements.usecases.UseCase;
18  
19  /**
20   * The specification of a set of actions performed by a system, which yields an observable result
21   * that is, typically, of value for one or more actors or other stakeholders of the system.
22   * MetafacadeLogic for UseCaseFacade
23   *
24   * @see UseCaseFacade
25   */
26  public abstract class UseCaseFacadeLogic
27      extends NamespaceFacadeLogicImpl
28      implements UseCaseFacade
29  {
30      /**
31       * The underlying UML object
32       * @see UseCase
33       */
34      protected UseCase metaObject;
35  
36      /** Create Metafacade implementation instance using the MetafacadeFactory from the context
37       * @param metaObjectIn
38       * @param context
39       */
40      protected UseCaseFacadeLogic(UseCase metaObjectIn, String context)
41      {
42          super(metaObjectIn, getContext(context));
43          this.metaObject = metaObjectIn;
44      }
45  
46      /**
47       * The logger instance.
48       */
49      private static final Logger logger = Logger.getLogger(UseCaseFacadeLogic.class);
50  
51      /**
52       * Gets the context for this metafacade logic instance.
53       * @param context String. Set to UseCaseFacade if null
54       * @return context String
55       */
56      private static String getContext(String context)
57      {
58          if (context == null)
59          {
60              context = "org.andromda.metafacades.uml.UseCaseFacade";
61          }
62          return context;
63      }
64  
65      /** Reset context only for non-root metafacades
66       * @param context
67       */
68      @Override
69      public void resetMetafacadeContext(String context)
70      {
71          if (!this.contextRoot) // reset context only for non-root metafacades
72          {
73              context = getContext(context);  // to have same value as in original constructor call
74              setMetafacadeContext (context);
75          }
76      }
77  
78      /**
79       * @return boolean true always
80       * @see UseCaseFacade
81       */
82      public boolean isUseCaseFacadeMetaType()
83      {
84          return true;
85      }
86  
87      // ------------- associations ------------------
88  
89      private Collection<ExtendFacade> __getExtends1r;
90      private boolean __getExtends1rSet = false;
91  
92      /**
93       * The base use-case.
94       * @return (Collection<ExtendFacade>)handleGetExtends()
95       */
96      public final Collection<ExtendFacade> getExtends()
97      {
98          Collection<ExtendFacade> getExtends1r = this.__getExtends1r;
99          if (!this.__getExtends1rSet)
100         {
101             // base has no pre constraints
102             Collection result = handleGetExtends();
103             List shieldedResult = this.shieldedElements(result);
104             try
105             {
106                 getExtends1r = (Collection<ExtendFacade>)shieldedResult;
107             }
108             catch (ClassCastException ex)
109             {
110                 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
111                 UseCaseFacadeLogic.logger.warn("incorrect metafacade cast for UseCaseFacadeLogic.getExtends Collection<ExtendFacade> " + result + ": " + shieldedResult);
112             }
113             // base has no post constraints
114             this.__getExtends1r = getExtends1r;
115             if (isMetafacadePropertyCachingEnabled())
116             {
117                 this.__getExtends1rSet = true;
118             }
119         }
120         return getExtends1r;
121     }
122 
123     /**
124      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
125      * @return  Collection
126      */
127     protected abstract Collection handleGetExtends();
128 
129     /**
130      * The specification of a set of actions performed by a system, which yields an observable
131      * result that
132      * is, typically, of value for one or more actors or other stakeholders of the system.
133      * @return (Collection<IncludeFacade>)handleGetIncludes()
134      */
135     public final Collection<IncludeFacade> getIncludes()
136     {
137         Collection<IncludeFacade> getIncludes2r = null;
138         // base has no pre constraints
139         Collection result = handleGetIncludes();
140         List shieldedResult = this.shieldedElements(result);
141         try
142         {
143             getIncludes2r = (Collection<IncludeFacade>)shieldedResult;
144         }
145         catch (ClassCastException ex)
146         {
147             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
148             UseCaseFacadeLogic.logger.warn("incorrect metafacade cast for UseCaseFacadeLogic.getIncludes Collection<IncludeFacade> " + result + ": " + shieldedResult);
149         }
150         // base has no post constraints
151         return getIncludes2r;
152     }
153 
154     /**
155      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
156      * @return  Collection
157      */
158     protected abstract Collection handleGetIncludes();
159 
160     private Collection<ExtensionPointFacade> __getExtensionPoints3r;
161     private boolean __getExtensionPoints3rSet = false;
162 
163     /**
164      * The specification of a set of actions performed by a system, which yields an observable
165      * result that
166      * is, typically, of value for one or more actors or other stakeholders of the system.
167      * @return (Collection<ExtensionPointFacade>)handleGetExtensionPoints()
168      */
169     public final Collection<ExtensionPointFacade> getExtensionPoints()
170     {
171         Collection<ExtensionPointFacade> getExtensionPoints3r = this.__getExtensionPoints3r;
172         if (!this.__getExtensionPoints3rSet)
173         {
174             // useCase has no pre constraints
175             Collection result = handleGetExtensionPoints();
176             List shieldedResult = this.shieldedElements(result);
177             try
178             {
179                 getExtensionPoints3r = (Collection<ExtensionPointFacade>)shieldedResult;
180             }
181             catch (ClassCastException ex)
182             {
183                 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
184                 UseCaseFacadeLogic.logger.warn("incorrect metafacade cast for UseCaseFacadeLogic.getExtensionPoints Collection<ExtensionPointFacade> " + result + ": " + shieldedResult);
185             }
186             // useCase has no post constraints
187             this.__getExtensionPoints3r = getExtensionPoints3r;
188             if (isMetafacadePropertyCachingEnabled())
189             {
190                 this.__getExtensionPoints3rSet = true;
191             }
192         }
193         return getExtensionPoints3r;
194     }
195 
196     /**
197      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
198      * @return  Collection
199      */
200     protected abstract Collection handleGetExtensionPoints();
201 
202     /**
203      * The use-case owning this activity graph.
204      * @return (ActivityGraphFacade)handleGetFirstActivityGraph()
205      */
206     public final ActivityGraphFacade getFirstActivityGraph()
207     {
208         ActivityGraphFacade getFirstActivityGraph4r = null;
209         // useCase has no pre constraints
210         Object result = handleGetFirstActivityGraph();
211         MetafacadeBase shieldedResult = this.shieldedElement(result);
212         try
213         {
214             getFirstActivityGraph4r = (ActivityGraphFacade)shieldedResult;
215         }
216         catch (ClassCastException ex)
217         {
218             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
219             UseCaseFacadeLogic.logger.warn("incorrect metafacade cast for UseCaseFacadeLogic.getFirstActivityGraph ActivityGraphFacade " + result + ": " + shieldedResult);
220         }
221         // useCase has no post constraints
222         return getFirstActivityGraph4r;
223     }
224 
225     /**
226      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
227      * @return Object
228      */
229     protected abstract Object handleGetFirstActivityGraph();
230 
231     /**
232      * @param validationMessages Collection<ModelValidationMessage>
233      * @see NamespaceFacadeLogicImpl#validateInvariants(Collection validationMessages)
234      */
235     @Override
236     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
237     {
238         super.validateInvariants(validationMessages);
239     }
240 }