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 org.andromda.core.metafacade.MetafacadeBase; 009import org.andromda.core.metafacade.ModelValidationMessage; 010import org.andromda.metafacades.uml.ClassifierFacade; 011import org.andromda.metafacades.uml.ObjectFlowStateFacade; 012import org.apache.log4j.Logger; 013import org.omg.uml.behavioralelements.activitygraphs.ObjectFlowState; 014 015/** 016 * A representation of the model object 'Object Flow'. An object flow is an activity edge that can 017 * have objects or data passing along it. Object flows have support for multicast/receive, token 018 * selection from object nodes, and transformation of tokens. Not implemented in UML2. 019 * MetafacadeLogic for ObjectFlowStateFacade 020 * 021 * @see ObjectFlowStateFacade 022 */ 023public abstract class ObjectFlowStateFacadeLogic 024 extends StateFacadeLogicImpl 025 implements ObjectFlowStateFacade 026{ 027 /** 028 * The underlying UML object 029 * @see ObjectFlowState 030 */ 031 protected ObjectFlowState metaObject; 032 033 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 034 * @param metaObjectIn 035 * @param context 036 */ 037 protected ObjectFlowStateFacadeLogic(ObjectFlowState metaObjectIn, String context) 038 { 039 super(metaObjectIn, getContext(context)); 040 this.metaObject = metaObjectIn; 041 } 042 043 /** 044 * The logger instance. 045 */ 046 private static final Logger logger = Logger.getLogger(ObjectFlowStateFacadeLogic.class); 047 048 /** 049 * Gets the context for this metafacade logic instance. 050 * @param context String. Set to ObjectFlowStateFacade if null 051 * @return context String 052 */ 053 private static String getContext(String context) 054 { 055 if (context == null) 056 { 057 context = "org.andromda.metafacades.uml.ObjectFlowStateFacade"; 058 } 059 return context; 060 } 061 062 /** Reset context only for non-root metafacades 063 * @param context 064 */ 065 @Override 066 public void resetMetafacadeContext(String context) 067 { 068 if (!this.contextRoot) // reset context only for non-root metafacades 069 { 070 context = getContext(context); // to have same value as in original constructor call 071 setMetafacadeContext (context); 072 } 073 } 074 075 /** 076 * @return boolean true always 077 * @see ObjectFlowStateFacade 078 */ 079 public boolean isObjectFlowStateFacadeMetaType() 080 { 081 return true; 082 } 083 084 // ------------- associations ------------------ 085 086 /** 087 * A representation of the model object 'Object Flow'. An object flow is an activity edge that 088 * can have 089 * objects or data passing along it. Object flows have support for multicast/receive, token 090 * selection 091 * from object nodes, and transformation of tokens. Not implemented in UML2. 092 * @return (ClassifierFacade)handleGetType() 093 */ 094 public final ClassifierFacade getType() 095 { 096 ClassifierFacade getType1r = null; 097 // objectFlowStateFacade has no pre constraints 098 Object result = handleGetType(); 099 MetafacadeBase shieldedResult = this.shieldedElement(result); 100 try 101 { 102 getType1r = (ClassifierFacade)shieldedResult; 103 } 104 catch (ClassCastException ex) 105 { 106 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 107 ObjectFlowStateFacadeLogic.logger.warn("incorrect metafacade cast for ObjectFlowStateFacadeLogic.getType ClassifierFacade " + result + ": " + shieldedResult); 108 } 109 // objectFlowStateFacade has no post constraints 110 return getType1r; 111 } 112 113 /** 114 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 115 * @return Object 116 */ 117 protected abstract Object handleGetType(); 118 119 /** 120 * @param validationMessages Collection<ModelValidationMessage> 121 * @see StateFacadeLogicImpl#validateInvariants(Collection validationMessages) 122 */ 123 @Override 124 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 125 { 126 super.validateInvariants(validationMessages); 127 } 128}