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.Destination; 012import org.andromda.metafacades.uml.Role; 013import org.andromda.metafacades.uml.Service; 014import org.andromda.metafacades.uml.ServiceOperation; 015import org.apache.log4j.Logger; 016import org.omg.uml.foundation.core.Operation; 017 018/** 019 * Reprsents an operation of a service. 020 * MetafacadeLogic for ServiceOperation 021 * 022 * @see ServiceOperation 023 */ 024public abstract class ServiceOperationLogic 025 extends OperationFacadeLogicImpl 026 implements ServiceOperation 027{ 028 /** 029 * The underlying UML object 030 * @see Object 031 */ 032 protected Object metaObject; 033 034 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 035 * @param metaObjectIn 036 * @param context 037 */ 038 protected ServiceOperationLogic(Object metaObjectIn, String context) 039 { 040 super((Operation)metaObjectIn, getContext(context)); 041 this.metaObject = metaObjectIn; 042 } 043 044 /** 045 * The logger instance. 046 */ 047 private static final Logger logger = Logger.getLogger(ServiceOperationLogic.class); 048 049 /** 050 * Gets the context for this metafacade logic instance. 051 * @param context String. Set to ServiceOperation if null 052 * @return context String 053 */ 054 private static String getContext(String context) 055 { 056 if (context == null) 057 { 058 context = "org.andromda.metafacades.uml.ServiceOperation"; 059 } 060 return context; 061 } 062 063 /** Reset context only for non-root metafacades 064 * @param context 065 */ 066 @Override 067 public void resetMetafacadeContext(String context) 068 { 069 if (!this.contextRoot) // reset context only for non-root metafacades 070 { 071 context = getContext(context); // to have same value as in original constructor call 072 setMetafacadeContext (context); 073 } 074 } 075 076 /** 077 * @return boolean true always 078 * @see ServiceOperation 079 */ 080 public boolean isServiceOperationMetaType() 081 { 082 return true; 083 } 084 085 // --------------- attributes --------------------- 086 087 /** 088 * @see ServiceOperation#isIncomingMessageOperation() 089 * @return boolean 090 */ 091 protected abstract boolean handleIsIncomingMessageOperation(); 092 093 private boolean __incomingMessageOperation1a; 094 private boolean __incomingMessageOperation1aSet = false; 095 096 /** 097 * Whether or not this operation represents an "incoming" message operation (i.e. it receives 098 * messages from Queues or Topics). 099 * @return (boolean)handleIsIncomingMessageOperation() 100 */ 101 public final boolean isIncomingMessageOperation() 102 { 103 boolean incomingMessageOperation1a = this.__incomingMessageOperation1a; 104 if (!this.__incomingMessageOperation1aSet) 105 { 106 // incomingMessageOperation has no pre constraints 107 incomingMessageOperation1a = handleIsIncomingMessageOperation(); 108 // incomingMessageOperation has no post constraints 109 this.__incomingMessageOperation1a = incomingMessageOperation1a; 110 if (isMetafacadePropertyCachingEnabled()) 111 { 112 this.__incomingMessageOperation1aSet = true; 113 } 114 } 115 return incomingMessageOperation1a; 116 } 117 118 /** 119 * @see ServiceOperation#isOutgoingMessageOperation() 120 * @return boolean 121 */ 122 protected abstract boolean handleIsOutgoingMessageOperation(); 123 124 private boolean __outgoingMessageOperation2a; 125 private boolean __outgoingMessageOperation2aSet = false; 126 127 /** 128 * Whether or not this service operation represents an "outgoing" messaging operation (i.e. it 129 * sends messages to Queues or Topics). 130 * @return (boolean)handleIsOutgoingMessageOperation() 131 */ 132 public final boolean isOutgoingMessageOperation() 133 { 134 boolean outgoingMessageOperation2a = this.__outgoingMessageOperation2a; 135 if (!this.__outgoingMessageOperation2aSet) 136 { 137 // outgoingMessageOperation has no pre constraints 138 outgoingMessageOperation2a = handleIsOutgoingMessageOperation(); 139 // outgoingMessageOperation has no post constraints 140 this.__outgoingMessageOperation2a = outgoingMessageOperation2a; 141 if (isMetafacadePropertyCachingEnabled()) 142 { 143 this.__outgoingMessageOperation2aSet = true; 144 } 145 } 146 return outgoingMessageOperation2a; 147 } 148 149 /** 150 * @see ServiceOperation#isMessageOperation() 151 * @return boolean 152 */ 153 protected abstract boolean handleIsMessageOperation(); 154 155 private boolean __messageOperation3a; 156 private boolean __messageOperation3aSet = false; 157 158 /** 159 * Whether or not this is operation accepts incoming or outgoing messages. 160 * @return (boolean)handleIsMessageOperation() 161 */ 162 public final boolean isMessageOperation() 163 { 164 boolean messageOperation3a = this.__messageOperation3a; 165 if (!this.__messageOperation3aSet) 166 { 167 // messageOperation has no pre constraints 168 messageOperation3a = handleIsMessageOperation(); 169 // messageOperation has no post constraints 170 this.__messageOperation3a = messageOperation3a; 171 if (isMetafacadePropertyCachingEnabled()) 172 { 173 this.__messageOperation3aSet = true; 174 } 175 } 176 return messageOperation3a; 177 } 178 179 // ------------- associations ------------------ 180 181 /** 182 * Reprsents an operation of a service. 183 * @return (Collection<Role>)handleGetRoles() 184 */ 185 public final Collection<Role> getRoles() 186 { 187 Collection<Role> getRoles1r = null; 188 // serviceOperation has no pre constraints 189 Collection result = handleGetRoles(); 190 List shieldedResult = this.shieldedElements(result); 191 try 192 { 193 getRoles1r = (Collection<Role>)shieldedResult; 194 } 195 catch (ClassCastException ex) 196 { 197 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 198 ServiceOperationLogic.logger.warn("incorrect metafacade cast for ServiceOperationLogic.getRoles Collection<Role> " + result + ": " + shieldedResult); 199 } 200 // serviceOperation has no post constraints 201 return getRoles1r; 202 } 203 204 /** 205 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 206 * @return Collection 207 */ 208 protected abstract Collection handleGetRoles(); 209 210 /** 211 * Reprsents an operation of a service. 212 * @return (Service)handleGetService() 213 */ 214 public final Service getService() 215 { 216 Service getService2r = null; 217 // serviceOperation has no pre constraints 218 Object result = handleGetService(); 219 MetafacadeBase shieldedResult = this.shieldedElement(result); 220 try 221 { 222 getService2r = (Service)shieldedResult; 223 } 224 catch (ClassCastException ex) 225 { 226 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 227 ServiceOperationLogic.logger.warn("incorrect metafacade cast for ServiceOperationLogic.getService Service " + result + ": " + shieldedResult); 228 } 229 // serviceOperation has no post constraints 230 return getService2r; 231 } 232 233 /** 234 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 235 * @return Object 236 */ 237 protected abstract Object handleGetService(); 238 239 /** 240 * Reprsents an operation of a service. 241 * @return (Destination)handleGetOutgoingDestination() 242 */ 243 public final Destination getOutgoingDestination() 244 { 245 Destination getOutgoingDestination3r = null; 246 // serviceOperation has no pre constraints 247 Object result = handleGetOutgoingDestination(); 248 MetafacadeBase shieldedResult = this.shieldedElement(result); 249 try 250 { 251 getOutgoingDestination3r = (Destination)shieldedResult; 252 } 253 catch (ClassCastException ex) 254 { 255 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 256 ServiceOperationLogic.logger.warn("incorrect metafacade cast for ServiceOperationLogic.getOutgoingDestination Destination " + result + ": " + shieldedResult); 257 } 258 // serviceOperation has no post constraints 259 return getOutgoingDestination3r; 260 } 261 262 /** 263 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 264 * @return Object 265 */ 266 protected abstract Object handleGetOutgoingDestination(); 267 268 /** 269 * Reprsents an operation of a service. 270 * @return (Destination)handleGetIncomingDestination() 271 */ 272 public final Destination getIncomingDestination() 273 { 274 Destination getIncomingDestination4r = null; 275 // serviceOperation has no pre constraints 276 Object result = handleGetIncomingDestination(); 277 MetafacadeBase shieldedResult = this.shieldedElement(result); 278 try 279 { 280 getIncomingDestination4r = (Destination)shieldedResult; 281 } 282 catch (ClassCastException ex) 283 { 284 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 285 ServiceOperationLogic.logger.warn("incorrect metafacade cast for ServiceOperationLogic.getIncomingDestination Destination " + result + ": " + shieldedResult); 286 } 287 // serviceOperation has no post constraints 288 return getIncomingDestination4r; 289 } 290 291 /** 292 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 293 * @return Object 294 */ 295 protected abstract Object handleGetIncomingDestination(); 296 297 /** 298 * @param validationMessages Collection<ModelValidationMessage> 299 * @see OperationFacadeLogicImpl#validateInvariants(Collection validationMessages) 300 */ 301 @Override 302 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 303 { 304 super.validateInvariants(validationMessages); 305 } 306}