001// license-header java merge-point 002// 003// Attention: generated code (by MetafacadeLogic.vsl) - do not modify! 004// 005package org.andromda.metafacades.uml14; 006 007import java.util.Collection; 008import java.util.List; 009import org.andromda.core.metafacade.MetafacadeBase; 010import org.andromda.core.metafacade.ModelValidationMessage; 011import org.andromda.metafacades.uml.GeneralizableElementFacade; 012import org.andromda.metafacades.uml.GeneralizationFacade; 013import org.apache.log4j.Logger; 014import org.omg.uml.foundation.core.GeneralizableElement; 015 016/** 017 * The model element that represents an element that can be generalized or specialized. 018 * MetafacadeLogic for GeneralizableElementFacade 019 * 020 * @see GeneralizableElementFacade 021 */ 022public abstract class GeneralizableElementFacadeLogic 023 extends ModelElementFacadeLogicImpl 024 implements GeneralizableElementFacade 025{ 026 /** 027 * The underlying UML object 028 * @see GeneralizableElement 029 */ 030 protected GeneralizableElement metaObject; 031 032 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 033 * @param metaObjectIn 034 * @param context 035 */ 036 protected GeneralizableElementFacadeLogic(GeneralizableElement metaObjectIn, String context) 037 { 038 super(metaObjectIn, getContext(context)); 039 this.metaObject = metaObjectIn; 040 } 041 042 /** 043 * The logger instance. 044 */ 045 private static final Logger logger = Logger.getLogger(GeneralizableElementFacadeLogic.class); 046 047 /** 048 * Gets the context for this metafacade logic instance. 049 * @param context String. Set to GeneralizableElementFacade if null 050 * @return context String 051 */ 052 private static String getContext(String context) 053 { 054 if (context == null) 055 { 056 context = "org.andromda.metafacades.uml.GeneralizableElementFacade"; 057 } 058 return context; 059 } 060 061 /** Reset context only for non-root metafacades 062 * @param context 063 */ 064 @Override 065 public void resetMetafacadeContext(String context) 066 { 067 if (!this.contextRoot) // reset context only for non-root metafacades 068 { 069 context = getContext(context); // to have same value as in original constructor call 070 setMetafacadeContext (context); 071 } 072 } 073 074 /** 075 * @return boolean true always 076 * @see GeneralizableElementFacade 077 */ 078 public boolean isGeneralizableElementFacadeMetaType() 079 { 080 return true; 081 } 082 083 // --------------- attributes --------------------- 084 085 /** 086 * @see GeneralizableElementFacade#getGeneralizationList() 087 * @return String 088 */ 089 protected abstract String handleGetGeneralizationList(); 090 091 private String __generalizationList1a; 092 private boolean __generalizationList1aSet = false; 093 094 /** 095 * A comma separated list of the fully qualified names of all generalizations. 096 * @return (String)handleGetGeneralizationList() 097 */ 098 public final String getGeneralizationList() 099 { 100 String generalizationList1a = this.__generalizationList1a; 101 if (!this.__generalizationList1aSet) 102 { 103 // generalizationList has no pre constraints 104 generalizationList1a = handleGetGeneralizationList(); 105 // generalizationList has no post constraints 106 this.__generalizationList1a = generalizationList1a; 107 if (isMetafacadePropertyCachingEnabled()) 108 { 109 this.__generalizationList1aSet = true; 110 } 111 } 112 return generalizationList1a; 113 } 114 115 // ---------------- business methods ---------------------- 116 117 /** 118 * Method to be implemented in descendants 119 * Finds the tagged value optional searching the entire inheritance hierarchy if 'follow' is set 120 * to true. 121 * @param tagName 122 * @param follow 123 * @return Object 124 */ 125 protected abstract Object handleFindTaggedValue(String tagName, boolean follow); 126 127 /** 128 * Finds the tagged value optional searching the entire inheritance hierarchy if 'follow' is set 129 * to true. 130 * @param tagName String 131 * The name of the tag of the tagged value to find. 132 * @param follow boolean 133 * Whether or not to 'follow' the inheritance hierarchy when searching for the tagged value. 134 * @return handleFindTaggedValue(tagName, follow) 135 */ 136 public Object findTaggedValue(String tagName, boolean follow) 137 { 138 // findTaggedValue has no pre constraints 139 Object returnValue = handleFindTaggedValue(tagName, follow); 140 // findTaggedValue has no post constraints 141 return returnValue; 142 } 143 144 // ------------- associations ------------------ 145 146 /** 147 * The model element that represents an element that can be generalized or specialized. 148 * @return (Collection<GeneralizationFacade>)handleGetGeneralizationLinks() 149 */ 150 public final Collection<GeneralizationFacade> getGeneralizationLinks() 151 { 152 Collection<GeneralizationFacade> getGeneralizationLinks1r = null; 153 // generalizableElementFacade has no pre constraints 154 Collection result = handleGetGeneralizationLinks(); 155 List shieldedResult = this.shieldedElements(result); 156 try 157 { 158 getGeneralizationLinks1r = (Collection<GeneralizationFacade>)shieldedResult; 159 } 160 catch (ClassCastException ex) 161 { 162 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 163 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getGeneralizationLinks Collection<GeneralizationFacade> " + result + ": " + shieldedResult); 164 } 165 // generalizableElementFacade has no post constraints 166 return getGeneralizationLinks1r; 167 } 168 169 /** 170 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 171 * @return Collection 172 */ 173 protected abstract Collection handleGetGeneralizationLinks(); 174 175 /** 176 * The model element that represents an element that can be generalized or specialized. 177 * @return (Collection<GeneralizableElementFacade>)handleGetAllGeneralizations() 178 */ 179 public final Collection<GeneralizableElementFacade> getAllGeneralizations() 180 { 181 Collection<GeneralizableElementFacade> getAllGeneralizations2r = null; 182 // generalizableElementFacade has no pre constraints 183 Collection result = handleGetAllGeneralizations(); 184 List shieldedResult = this.shieldedElements(result); 185 try 186 { 187 getAllGeneralizations2r = (Collection<GeneralizableElementFacade>)shieldedResult; 188 } 189 catch (ClassCastException ex) 190 { 191 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 192 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getAllGeneralizations Collection<GeneralizableElementFacade> " + result + ": " + shieldedResult); 193 } 194 // generalizableElementFacade has no post constraints 195 return getAllGeneralizations2r; 196 } 197 198 /** 199 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 200 * @return Collection 201 */ 202 protected abstract Collection handleGetAllGeneralizations(); 203 204 /** 205 * The model element that represents an element that can be generalized or specialized. 206 * @return (Collection<GeneralizableElementFacade>)handleGetGeneralizations() 207 */ 208 public final Collection<GeneralizableElementFacade> getGeneralizations() 209 { 210 Collection<GeneralizableElementFacade> getGeneralizations3r = null; 211 // generalizableElementFacade has no pre constraints 212 Collection result = handleGetGeneralizations(); 213 List shieldedResult = this.shieldedElements(result); 214 try 215 { 216 getGeneralizations3r = (Collection<GeneralizableElementFacade>)shieldedResult; 217 } 218 catch (ClassCastException ex) 219 { 220 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 221 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getGeneralizations Collection<GeneralizableElementFacade> " + result + ": " + shieldedResult); 222 } 223 // generalizableElementFacade has no post constraints 224 return getGeneralizations3r; 225 } 226 227 /** 228 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 229 * @return Collection 230 */ 231 protected abstract Collection handleGetGeneralizations(); 232 233 private Collection<GeneralizableElementFacade> __getSpecializations4r; 234 private boolean __getSpecializations4rSet = false; 235 236 /** 237 * The model element that represents an element that can be generalized or specialized. 238 * @return (Collection<GeneralizableElementFacade>)handleGetSpecializations() 239 */ 240 public final Collection<GeneralizableElementFacade> getSpecializations() 241 { 242 Collection<GeneralizableElementFacade> getSpecializations4r = this.__getSpecializations4r; 243 if (!this.__getSpecializations4rSet) 244 { 245 // generalizableElementFacade has no pre constraints 246 Collection result = handleGetSpecializations(); 247 List shieldedResult = this.shieldedElements(result); 248 try 249 { 250 getSpecializations4r = (Collection<GeneralizableElementFacade>)shieldedResult; 251 } 252 catch (ClassCastException ex) 253 { 254 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 255 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getSpecializations Collection<GeneralizableElementFacade> " + result + ": " + shieldedResult); 256 } 257 // generalizableElementFacade has no post constraints 258 this.__getSpecializations4r = getSpecializations4r; 259 if (isMetafacadePropertyCachingEnabled()) 260 { 261 this.__getSpecializations4rSet = true; 262 } 263 } 264 return getSpecializations4r; 265 } 266 267 /** 268 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 269 * @return Collection 270 */ 271 protected abstract Collection handleGetSpecializations(); 272 273 /** 274 * The model element that represents an element that can be generalized or specialized. 275 * @return (Collection<GeneralizableElementFacade>)handleGetAllSpecializations() 276 */ 277 public final Collection<GeneralizableElementFacade> getAllSpecializations() 278 { 279 Collection<GeneralizableElementFacade> getAllSpecializations5r = null; 280 // generalizableElementFacade has no pre constraints 281 Collection result = handleGetAllSpecializations(); 282 List shieldedResult = this.shieldedElements(result); 283 try 284 { 285 getAllSpecializations5r = (Collection<GeneralizableElementFacade>)shieldedResult; 286 } 287 catch (ClassCastException ex) 288 { 289 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 290 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getAllSpecializations Collection<GeneralizableElementFacade> " + result + ": " + shieldedResult); 291 } 292 // generalizableElementFacade has no post constraints 293 return getAllSpecializations5r; 294 } 295 296 /** 297 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 298 * @return Collection 299 */ 300 protected abstract Collection handleGetAllSpecializations(); 301 302 /** 303 * The model element that represents an element that can be generalized or specialized. 304 * @return (GeneralizableElementFacade)handleGetGeneralization() 305 */ 306 public final GeneralizableElementFacade getGeneralization() 307 { 308 GeneralizableElementFacade getGeneralization6r = null; 309 // generalizableElementFacade has no pre constraints 310 Object result = handleGetGeneralization(); 311 MetafacadeBase shieldedResult = this.shieldedElement(result); 312 try 313 { 314 getGeneralization6r = (GeneralizableElementFacade)shieldedResult; 315 } 316 catch (ClassCastException ex) 317 { 318 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 319 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getGeneralization GeneralizableElementFacade " + result + ": " + shieldedResult); 320 } 321 // generalizableElementFacade has no post constraints 322 return getGeneralization6r; 323 } 324 325 /** 326 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 327 * @return Object 328 */ 329 protected abstract Object handleGetGeneralization(); 330 331 private GeneralizableElementFacade __getGeneralizationRoot7r; 332 private boolean __getGeneralizationRoot7rSet = false; 333 334 /** 335 * The model element that represents an element that can be generalized or specialized. 336 * @return (GeneralizableElementFacade)handleGetGeneralizationRoot() 337 */ 338 public final GeneralizableElementFacade getGeneralizationRoot() 339 { 340 GeneralizableElementFacade getGeneralizationRoot7r = this.__getGeneralizationRoot7r; 341 if (!this.__getGeneralizationRoot7rSet) 342 { 343 // generalizableElementFacade has no pre constraints 344 Object result = handleGetGeneralizationRoot(); 345 MetafacadeBase shieldedResult = this.shieldedElement(result); 346 try 347 { 348 getGeneralizationRoot7r = (GeneralizableElementFacade)shieldedResult; 349 } 350 catch (ClassCastException ex) 351 { 352 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 353 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getGeneralizationRoot GeneralizableElementFacade " + result + ": " + shieldedResult); 354 } 355 // generalizableElementFacade has no post constraints 356 this.__getGeneralizationRoot7r = getGeneralizationRoot7r; 357 if (isMetafacadePropertyCachingEnabled()) 358 { 359 this.__getGeneralizationRoot7rSet = true; 360 } 361 } 362 return getGeneralizationRoot7r; 363 } 364 365 /** 366 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 367 * @return Object 368 */ 369 protected abstract Object handleGetGeneralizationRoot(); 370 371 /** 372 * @param validationMessages Collection<ModelValidationMessage> 373 * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages) 374 */ 375 @Override 376 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 377 { 378 super.validateInvariants(validationMessages); 379 } 380}