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.ActivityGraphFacade; 012import org.andromda.metafacades.uml.ExtendFacade; 013import org.andromda.metafacades.uml.ExtensionPointFacade; 014import org.andromda.metafacades.uml.IncludeFacade; 015import org.andromda.metafacades.uml.UseCaseFacade; 016import org.apache.log4j.Logger; 017import org.omg.uml.behavioralelements.usecases.UseCase; 018 019/** 020 * The specification of a set of actions performed by a system, which yields an observable result 021 * that is, typically, of value for one or more actors or other stakeholders of the system. 022 * MetafacadeLogic for UseCaseFacade 023 * 024 * @see UseCaseFacade 025 */ 026public abstract class UseCaseFacadeLogic 027 extends NamespaceFacadeLogicImpl 028 implements UseCaseFacade 029{ 030 /** 031 * The underlying UML object 032 * @see UseCase 033 */ 034 protected UseCase metaObject; 035 036 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 037 * @param metaObjectIn 038 * @param context 039 */ 040 protected UseCaseFacadeLogic(UseCase metaObjectIn, String context) 041 { 042 super(metaObjectIn, getContext(context)); 043 this.metaObject = metaObjectIn; 044 } 045 046 /** 047 * The logger instance. 048 */ 049 private static final Logger logger = Logger.getLogger(UseCaseFacadeLogic.class); 050 051 /** 052 * Gets the context for this metafacade logic instance. 053 * @param context String. Set to UseCaseFacade if null 054 * @return context String 055 */ 056 private static String getContext(String context) 057 { 058 if (context == null) 059 { 060 context = "org.andromda.metafacades.uml.UseCaseFacade"; 061 } 062 return context; 063 } 064 065 /** Reset context only for non-root metafacades 066 * @param context 067 */ 068 @Override 069 public void resetMetafacadeContext(String context) 070 { 071 if (!this.contextRoot) // reset context only for non-root metafacades 072 { 073 context = getContext(context); // to have same value as in original constructor call 074 setMetafacadeContext (context); 075 } 076 } 077 078 /** 079 * @return boolean true always 080 * @see UseCaseFacade 081 */ 082 public boolean isUseCaseFacadeMetaType() 083 { 084 return true; 085 } 086 087 // ------------- associations ------------------ 088 089 private Collection<ExtendFacade> __getExtends1r; 090 private boolean __getExtends1rSet = false; 091 092 /** 093 * The base use-case. 094 * @return (Collection<ExtendFacade>)handleGetExtends() 095 */ 096 public final Collection<ExtendFacade> getExtends() 097 { 098 Collection<ExtendFacade> getExtends1r = this.__getExtends1r; 099 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}