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.ExtendFacade; 012import org.andromda.metafacades.uml.ExtensionPointFacade; 013import org.andromda.metafacades.uml.UseCaseFacade; 014import org.apache.log4j.Logger; 015import org.omg.uml.behavioralelements.usecases.Extend; 016 017/** 018 * A relationship from an extending use case to an extended use case that specifies how and when the 019 * behavior defined in the extending use case can be inserted into the behavior defined in the 020 * extended use case. 021 * MetafacadeLogic for ExtendFacade 022 * 023 * @see ExtendFacade 024 */ 025public abstract class ExtendFacadeLogic 026 extends ModelElementFacadeLogicImpl 027 implements ExtendFacade 028{ 029 /** 030 * The underlying UML object 031 * @see Extend 032 */ 033 protected Extend metaObject; 034 035 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 036 * @param metaObjectIn 037 * @param context 038 */ 039 protected ExtendFacadeLogic(Extend metaObjectIn, String context) 040 { 041 super(metaObjectIn, getContext(context)); 042 this.metaObject = metaObjectIn; 043 } 044 045 /** 046 * The logger instance. 047 */ 048 private static final Logger logger = Logger.getLogger(ExtendFacadeLogic.class); 049 050 /** 051 * Gets the context for this metafacade logic instance. 052 * @param context String. Set to ExtendFacade if null 053 * @return context String 054 */ 055 private static String getContext(String context) 056 { 057 if (context == null) 058 { 059 context = "org.andromda.metafacades.uml.ExtendFacade"; 060 } 061 return context; 062 } 063 064 /** Reset context only for non-root metafacades 065 * @param context 066 */ 067 @Override 068 public void resetMetafacadeContext(String context) 069 { 070 if (!this.contextRoot) // reset context only for non-root metafacades 071 { 072 context = getContext(context); // to have same value as in original constructor call 073 setMetafacadeContext (context); 074 } 075 } 076 077 /** 078 * @return boolean true always 079 * @see ExtendFacade 080 */ 081 public boolean isExtendFacadeMetaType() 082 { 083 return true; 084 } 085 086 // ------------- associations ------------------ 087 088 private List<ExtensionPointFacade> __getExtensionPoints1r; 089 private boolean __getExtensionPoints1rSet = false; 090 091 /** 092 * A relationship from an extending use case to an extended use case that specifies how and when 093 * the 094 * behavior defined in the extending use case can be inserted into the behavior defined in the 095 * extended 096 * use case. 097 * @return (List<ExtensionPointFacade>)handleGetExtensionPoints() 098 */ 099 public final List<ExtensionPointFacade> getExtensionPoints() 100 { 101 List<ExtensionPointFacade> getExtensionPoints1r = this.__getExtensionPoints1r; 102 if (!this.__getExtensionPoints1rSet) 103 { 104 // extendFacade has no pre constraints 105 List result = handleGetExtensionPoints(); 106 List shieldedResult = this.shieldedElements(result); 107 try 108 { 109 getExtensionPoints1r = (List<ExtensionPointFacade>)shieldedResult; 110 } 111 catch (ClassCastException ex) 112 { 113 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 114 ExtendFacadeLogic.logger.warn("incorrect metafacade cast for ExtendFacadeLogic.getExtensionPoints List<ExtensionPointFacade> " + result + ": " + shieldedResult); 115 } 116 // extendFacade has no post constraints 117 this.__getExtensionPoints1r = getExtensionPoints1r; 118 if (isMetafacadePropertyCachingEnabled()) 119 { 120 this.__getExtensionPoints1rSet = true; 121 } 122 } 123 return getExtensionPoints1r; 124 } 125 126 /** 127 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 128 * @return List 129 */ 130 protected abstract List handleGetExtensionPoints(); 131 132 private UseCaseFacade __getBase2r; 133 private boolean __getBase2rSet = false; 134 135 /** 136 * The extend instances related to this use-case. 137 * @return (UseCaseFacade)handleGetBase() 138 */ 139 public final UseCaseFacade getBase() 140 { 141 UseCaseFacade getBase2r = this.__getBase2r; 142 if (!this.__getBase2rSet) 143 { 144 // extends has no pre constraints 145 Object result = handleGetBase(); 146 MetafacadeBase shieldedResult = this.shieldedElement(result); 147 try 148 { 149 getBase2r = (UseCaseFacade)shieldedResult; 150 } 151 catch (ClassCastException ex) 152 { 153 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 154 ExtendFacadeLogic.logger.warn("incorrect metafacade cast for ExtendFacadeLogic.getBase UseCaseFacade " + result + ": " + shieldedResult); 155 } 156 // extends has no post constraints 157 this.__getBase2r = getBase2r; 158 if (isMetafacadePropertyCachingEnabled()) 159 { 160 this.__getBase2rSet = true; 161 } 162 } 163 return getBase2r; 164 } 165 166 /** 167 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 168 * @return Object 169 */ 170 protected abstract Object handleGetBase(); 171 172 private UseCaseFacade __getExtension3r; 173 private boolean __getExtension3rSet = false; 174 175 /** 176 * A relationship from an extending use case to an extended use case that specifies how and when 177 * the 178 * behavior defined in the extending use case can be inserted into the behavior defined in the 179 * extended 180 * use case. 181 * @return (UseCaseFacade)handleGetExtension() 182 */ 183 public final UseCaseFacade getExtension() 184 { 185 UseCaseFacade getExtension3r = this.__getExtension3r; 186 if (!this.__getExtension3rSet) 187 { 188 // extendFacade has no pre constraints 189 Object result = handleGetExtension(); 190 MetafacadeBase shieldedResult = this.shieldedElement(result); 191 try 192 { 193 getExtension3r = (UseCaseFacade)shieldedResult; 194 } 195 catch (ClassCastException ex) 196 { 197 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 198 ExtendFacadeLogic.logger.warn("incorrect metafacade cast for ExtendFacadeLogic.getExtension UseCaseFacade " + result + ": " + shieldedResult); 199 } 200 // extendFacade has no post constraints 201 this.__getExtension3r = getExtension3r; 202 if (isMetafacadePropertyCachingEnabled()) 203 { 204 this.__getExtension3rSet = true; 205 } 206 } 207 return getExtension3r; 208 } 209 210 /** 211 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 212 * @return Object 213 */ 214 protected abstract Object handleGetExtension(); 215 216 /** 217 * @param validationMessages Collection<ModelValidationMessage> 218 * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages) 219 */ 220 @Override 221 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 222 { 223 super.validateInvariants(validationMessages); 224 } 225}