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.ModelValidationMessage; 010import org.andromda.metafacades.uml.AttributeLinkFacade; 011import org.andromda.metafacades.uml.ClassifierFacade; 012import org.andromda.metafacades.uml.InstanceFacade; 013import org.andromda.metafacades.uml.LinkEndFacade; 014import org.andromda.metafacades.uml.LinkFacade; 015import org.apache.log4j.Logger; 016import org.omg.uml.behavioralelements.commonbehavior.Instance; 017 018/** 019 * A representation of the model object 'Instance Specification'. Represents an instance in a 020 * modeled system. Has the capability of being a deployment target in a deployment relationship, in 021 * the case that it is an instance of a node. Has the capability of being a deployed artifact, if it 022 * is an instance of an artifact. 023 * MetafacadeLogic for InstanceFacade 024 * 025 * @see InstanceFacade 026 */ 027public abstract class InstanceFacadeLogic 028 extends ModelElementFacadeLogicImpl 029 implements InstanceFacade 030{ 031 /** 032 * The underlying UML object 033 * @see Instance 034 */ 035 protected Instance metaObject; 036 037 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 038 * @param metaObjectIn 039 * @param context 040 */ 041 protected InstanceFacadeLogic(Instance metaObjectIn, String context) 042 { 043 super(metaObjectIn, getContext(context)); 044 this.metaObject = metaObjectIn; 045 } 046 047 /** 048 * The logger instance. 049 */ 050 private static final Logger logger = Logger.getLogger(InstanceFacadeLogic.class); 051 052 /** 053 * Gets the context for this metafacade logic instance. 054 * @param context String. Set to InstanceFacade if null 055 * @return context String 056 */ 057 private static String getContext(String context) 058 { 059 if (context == null) 060 { 061 context = "org.andromda.metafacades.uml.InstanceFacade"; 062 } 063 return context; 064 } 065 066 /** Reset context only for non-root metafacades 067 * @param context 068 */ 069 @Override 070 public void resetMetafacadeContext(String context) 071 { 072 if (!this.contextRoot) // reset context only for non-root metafacades 073 { 074 context = getContext(context); // to have same value as in original constructor call 075 setMetafacadeContext (context); 076 } 077 } 078 079 /** 080 * @return boolean true always 081 * @see InstanceFacade 082 */ 083 public boolean isInstanceFacadeMetaType() 084 { 085 return true; 086 } 087 088 // ------------- associations ------------------ 089 090 private Collection<LinkFacade> __getOwnedLinks1r; 091 private boolean __getOwnedLinks1rSet = false; 092 093 /** 094 * A representation of the model object 'Instance Specification'. Represents an instance in a 095 * modeled 096 * system. Has the capability of being a deployment target in a deployment relationship, in the 097 * case 098 * that it is an instance of a node. Has the capability of being a deployed artifact, if it is 099 * an 100 * instance of an artifact. 101 * @return (Collection<LinkFacade>)handleGetOwnedLinks() 102 */ 103 public final Collection<LinkFacade> getOwnedLinks() 104 { 105 Collection<LinkFacade> getOwnedLinks1r = this.__getOwnedLinks1r; 106 if (!this.__getOwnedLinks1rSet) 107 { 108 // instanceFacade has no pre constraints 109 Collection result = handleGetOwnedLinks(); 110 List shieldedResult = this.shieldedElements(result); 111 try 112 { 113 getOwnedLinks1r = (Collection<LinkFacade>)shieldedResult; 114 } 115 catch (ClassCastException ex) 116 { 117 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 118 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getOwnedLinks Collection<LinkFacade> " + result + ": " + shieldedResult); 119 } 120 // instanceFacade has no post constraints 121 this.__getOwnedLinks1r = getOwnedLinks1r; 122 if (isMetafacadePropertyCachingEnabled()) 123 { 124 this.__getOwnedLinks1rSet = true; 125 } 126 } 127 return getOwnedLinks1r; 128 } 129 130 /** 131 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 132 * @return Collection 133 */ 134 protected abstract Collection handleGetOwnedLinks(); 135 136 private Collection<InstanceFacade> __getOwnedInstances2r; 137 private boolean __getOwnedInstances2rSet = false; 138 139 /** 140 * A representation of the model object 'Instance Specification'. Represents an instance in a 141 * modeled 142 * system. Has the capability of being a deployment target in a deployment relationship, in the 143 * case 144 * that it is an instance of a node. Has the capability of being a deployed artifact, if it is 145 * an 146 * instance of an artifact. 147 * @return (Collection<InstanceFacade>)handleGetOwnedInstances() 148 */ 149 public final Collection<InstanceFacade> getOwnedInstances() 150 { 151 Collection<InstanceFacade> getOwnedInstances2r = this.__getOwnedInstances2r; 152 if (!this.__getOwnedInstances2rSet) 153 { 154 // instanceFacade has no pre constraints 155 Collection result = handleGetOwnedInstances(); 156 List shieldedResult = this.shieldedElements(result); 157 try 158 { 159 getOwnedInstances2r = (Collection<InstanceFacade>)shieldedResult; 160 } 161 catch (ClassCastException ex) 162 { 163 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 164 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getOwnedInstances Collection<InstanceFacade> " + result + ": " + shieldedResult); 165 } 166 // instanceFacade has no post constraints 167 this.__getOwnedInstances2r = getOwnedInstances2r; 168 if (isMetafacadePropertyCachingEnabled()) 169 { 170 this.__getOwnedInstances2rSet = true; 171 } 172 } 173 return getOwnedInstances2r; 174 } 175 176 /** 177 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 178 * @return Collection 179 */ 180 protected abstract Collection handleGetOwnedInstances(); 181 182 /** 183 * The instances this attribute link is attached too. An attribute link can have many instance 184 * values when its defining feature is an attribute with a 'many' multiplicity. 185 * @return (Collection<AttributeLinkFacade>)handleGetSlots() 186 */ 187 public final Collection<AttributeLinkFacade> getSlots() 188 { 189 Collection<AttributeLinkFacade> getSlots3r = null; 190 // values has no pre constraints 191 Collection result = handleGetSlots(); 192 List shieldedResult = this.shieldedElements(result); 193 try 194 { 195 getSlots3r = (Collection<AttributeLinkFacade>)shieldedResult; 196 } 197 catch (ClassCastException ex) 198 { 199 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 200 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getSlots Collection<AttributeLinkFacade> " + result + ": " + shieldedResult); 201 } 202 // values has no post constraints 203 return getSlots3r; 204 } 205 206 /** 207 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 208 * @return Collection 209 */ 210 protected abstract Collection handleGetSlots(); 211 212 private Collection<LinkEndFacade> __getLinkEnds4r; 213 private boolean __getLinkEnds4rSet = false; 214 215 /** 216 * The first instance to which this link end is attached. 217 * @return (Collection<LinkEndFacade>)handleGetLinkEnds() 218 */ 219 public final Collection<LinkEndFacade> getLinkEnds() 220 { 221 Collection<LinkEndFacade> getLinkEnds4r = this.__getLinkEnds4r; 222 if (!this.__getLinkEnds4rSet) 223 { 224 // instance has no pre constraints 225 Collection result = handleGetLinkEnds(); 226 List shieldedResult = this.shieldedElements(result); 227 try 228 { 229 getLinkEnds4r = (Collection<LinkEndFacade>)shieldedResult; 230 } 231 catch (ClassCastException ex) 232 { 233 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 234 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getLinkEnds Collection<LinkEndFacade> " + result + ": " + shieldedResult); 235 } 236 // instance has no post constraints 237 this.__getLinkEnds4r = getLinkEnds4r; 238 if (isMetafacadePropertyCachingEnabled()) 239 { 240 this.__getLinkEnds4rSet = true; 241 } 242 } 243 return getLinkEnds4r; 244 } 245 246 /** 247 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 248 * @return Collection 249 */ 250 protected abstract Collection handleGetLinkEnds(); 251 252 private Collection<ClassifierFacade> __getClassifiers5r; 253 private boolean __getClassifiers5rSet = false; 254 255 /** 256 * A representation of the model object 'Instance Specification'. Represents an instance in a 257 * modeled 258 * system. Has the capability of being a deployment target in a deployment relationship, in the 259 * case 260 * that it is an instance of a node. Has the capability of being a deployed artifact, if it is 261 * an 262 * instance of an artifact. 263 * @return (Collection<ClassifierFacade>)handleGetClassifiers() 264 */ 265 public final Collection<ClassifierFacade> getClassifiers() 266 { 267 Collection<ClassifierFacade> getClassifiers5r = this.__getClassifiers5r; 268 if (!this.__getClassifiers5rSet) 269 { 270 // instanceFacade has no pre constraints 271 Collection result = handleGetClassifiers(); 272 List shieldedResult = this.shieldedElements(result); 273 try 274 { 275 getClassifiers5r = (Collection<ClassifierFacade>)shieldedResult; 276 } 277 catch (ClassCastException ex) 278 { 279 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 280 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getClassifiers Collection<ClassifierFacade> " + result + ": " + shieldedResult); 281 } 282 // instanceFacade has no post constraints 283 this.__getClassifiers5r = getClassifiers5r; 284 if (isMetafacadePropertyCachingEnabled()) 285 { 286 this.__getClassifiers5rSet = true; 287 } 288 } 289 return getClassifiers5r; 290 } 291 292 /** 293 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 294 * @return Collection 295 */ 296 protected abstract Collection handleGetClassifiers(); 297 298 private Collection<AttributeLinkFacade> __getAttributeLinks6r; 299 private boolean __getAttributeLinks6rSet = false; 300 301 /** 302 * The owning instance for this link. 303 * @return (Collection<AttributeLinkFacade>)handleGetAttributeLinks() 304 */ 305 public final Collection<AttributeLinkFacade> getAttributeLinks() 306 { 307 Collection<AttributeLinkFacade> getAttributeLinks6r = this.__getAttributeLinks6r; 308 if (!this.__getAttributeLinks6rSet) 309 { 310 // instance has no pre constraints 311 Collection result = handleGetAttributeLinks(); 312 List shieldedResult = this.shieldedElements(result); 313 try 314 { 315 getAttributeLinks6r = (Collection<AttributeLinkFacade>)shieldedResult; 316 } 317 catch (ClassCastException ex) 318 { 319 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 320 InstanceFacadeLogic.logger.warn("incorrect metafacade cast for InstanceFacadeLogic.getAttributeLinks Collection<AttributeLinkFacade> " + result + ": " + shieldedResult); 321 } 322 // instance has no post constraints 323 this.__getAttributeLinks6r = getAttributeLinks6r; 324 if (isMetafacadePropertyCachingEnabled()) 325 { 326 this.__getAttributeLinks6rSet = true; 327 } 328 } 329 return getAttributeLinks6r; 330 } 331 332 /** 333 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 334 * @return Collection 335 */ 336 protected abstract Collection handleGetAttributeLinks(); 337 338 /** 339 * @param validationMessages Collection<ModelValidationMessage> 340 * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages) 341 */ 342 @Override 343 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 344 { 345 super.validateInvariants(validationMessages); 346 } 347}