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.FrontEndPackage
8    *
9    * @see org.andromda.metafacades.uml.FrontEndPackage
10   */
11  public abstract class FrontEndPackageLogic
12      extends org.andromda.metafacades.uml14.PackageFacadeLogicImpl
13      implements org.andromda.metafacades.uml.FrontEndPackage
14  {
15  
16      protected Object metaObject;
17  
18      public FrontEndPackageLogic(Object metaObject, String context)
19      {
20          super((org.omg.uml.modelmanagement.UmlPackage)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.FrontEndPackage";
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.FrontEndPackage
50       */
51      public boolean isFrontEndPackageMetaType()
52      {
53          return true;
54      }
55      
56      // ------------- associations ------------------
57  
58      private void handleGetFrontEndControllers1rPreCondition()
59      {
60      }
61  
62      private void handleGetFrontEndControllers1rPostCondition()
63      {
64      }
65  
66      private java.util.List __getFrontEndControllers1r;
67      private boolean __getFrontEndControllers1rSet = false;
68  
69      public final java.util.List getFrontEndControllers()
70      {
71          java.util.List getFrontEndControllers1r = this.__getFrontEndControllers1r;
72          if (!this.__getFrontEndControllers1rSet)
73          {
74              handleGetFrontEndControllers1rPreCondition();
75              Object result = this.shieldedElements(handleGetFrontEndControllers());
76              try
77              {
78                  getFrontEndControllers1r = (java.util.List)result;
79              }
80              catch (ClassCastException ex)
81              {
82                  // ignore since the metafacade shouldn't
83                  // be set if its not of the correct type
84              }
85              handleGetFrontEndControllers1rPostCondition();
86              this.__getFrontEndControllers1r = getFrontEndControllers1r;
87              if (isMetafacadePropertyCachingEnabled())
88              {
89                  this.__getFrontEndControllers1rSet = true;
90              }
91          }
92          return getFrontEndControllers1r;
93      }
94  
95      protected abstract java.util.List handleGetFrontEndControllers();
96  
97      private void handleGetFrontEndUseCases2rPreCondition()
98      {
99      }
100 
101     private void handleGetFrontEndUseCases2rPostCondition()
102     {
103     }
104 
105     private java.util.List __getFrontEndUseCases2r;
106     private boolean __getFrontEndUseCases2rSet = false;
107 
108     public final java.util.List getFrontEndUseCases()
109     {
110         java.util.List getFrontEndUseCases2r = this.__getFrontEndUseCases2r;
111         if (!this.__getFrontEndUseCases2rSet)
112         {
113             handleGetFrontEndUseCases2rPreCondition();
114             Object result = this.shieldedElements(handleGetFrontEndUseCases());
115             try
116             {
117                 getFrontEndUseCases2r = (java.util.List)result;
118             }
119             catch (ClassCastException ex)
120             {
121                 // ignore since the metafacade shouldn't
122                 // be set if its not of the correct type
123             }
124             handleGetFrontEndUseCases2rPostCondition();
125             this.__getFrontEndUseCases2r = getFrontEndUseCases2r;
126             if (isMetafacadePropertyCachingEnabled())
127             {
128                 this.__getFrontEndUseCases2rSet = true;
129             }
130         }
131         return getFrontEndUseCases2r;
132     }
133 
134     protected abstract java.util.List handleGetFrontEndUseCases();
135 
136     /***
137      * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(java.util.Collection)
138      */
139     public void validateInvariants(java.util.Collection validationMessages)
140     {
141         super.validateInvariants(validationMessages);
142         {
143             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure(org.andromda.translation.ocl.validation.OCLExpressions.less(org.andromda.translation.ocl.validation.OCLCollections.size(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"frontEndControllers")),2)); 
144             if (!constraintValid)
145                 validationMessages.add(
146                     new org.andromda.core.metafacade.ModelValidationMessage(
147                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
148                         "org::andromda::metafacades::uml::FrontEndPackage::no more than one controller per package",
149                         "In order to avoid possible naming collisions at most one controller per package is allowed. It is recommended to refactor your model."));
150         }
151         {
152             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure(org.andromda.translation.ocl.validation.OCLExpressions.less(org.andromda.translation.ocl.validation.OCLCollections.size(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"frontEndUseCases")),2)); 
153             if (!constraintValid)
154                 validationMessages.add(
155                     new org.andromda.core.metafacade.ModelValidationMessage(
156                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
157                         "org::andromda::metafacades::uml::FrontEndPackage::no more than one usecase per package",
158                         "In order to avoid possible naming collisions at most one FrontEndUseCase per package is allowed. It is recommended to refactor your model."));
159         }
160     }
161     
162     /***
163      * The property that stores the name of the metafacade.
164      */
165     private static final String NAME_PROPERTY = "name";
166     
167     /***
168      * @see java.lang.Object#toString()
169      */
170     public String toString()
171     {
172         final StringBuffer toString = new StringBuffer(this.getClass().getName());
173         toString.append("[");
174         try
175         {
176             toString.append(org.andromda.core.common.Introspector.instance().getProperty(this, NAME_PROPERTY));
177         }
178         catch (final Throwable throwable)
179         {
180             // - just ignore when the metafacade doesn't have a name property
181         }
182         toString.append("]");
183         return toString.toString();
184     }
185 }