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.ActionFacade; 011import org.andromda.metafacades.uml.ActionStateFacade; 012import org.apache.log4j.Logger; 013import org.omg.uml.behavioralelements.activitygraphs.ActionState; 014 015/** 016 * A state models a situation during which some (usually implicit) invariant condition holds. The 017 * states of protocol state machines are exposed to the users of their context classifiers. A 018 * protocol state represents an exposed stable situation of its context classifier: when an instance 019 * of the classifier is not processing any operation, users of this instance can always know its 020 * state configuration. 021 * MetafacadeLogic for ActionStateFacade 022 * 023 * @see ActionStateFacade 024 */ 025public abstract class ActionStateFacadeLogic 026 extends StateFacadeLogicImpl 027 implements ActionStateFacade 028{ 029 /** 030 * The underlying UML object 031 * @see ActionState 032 */ 033 protected ActionState metaObject; 034 035 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 036 * @param metaObjectIn 037 * @param context 038 */ 039 protected ActionStateFacadeLogic(ActionState 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(ActionStateFacadeLogic.class); 049 050 /** 051 * Gets the context for this metafacade logic instance. 052 * @param context String. Set to ActionStateFacade 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.ActionStateFacade"; 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 ActionStateFacade 080 */ 081 public boolean isActionStateFacadeMetaType() 082 { 083 return true; 084 } 085 086 // ------------- associations ------------------ 087 088 private ActionFacade __getEntry1r; 089 private boolean __getEntry1rSet = false; 090 091 /** 092 * If this action is located on an action state, this will represent that state. 093 * @return (ActionFacade)handleGetEntry() 094 */ 095 public final ActionFacade getEntry() 096 { 097 ActionFacade getEntry1r = this.__getEntry1r; 098 if (!this.__getEntry1rSet) 099 { 100 // actionState has no pre constraints 101 Object result = handleGetEntry(); 102 MetafacadeBase shieldedResult = this.shieldedElement(result); 103 try 104 { 105 getEntry1r = (ActionFacade)shieldedResult; 106 } 107 catch (ClassCastException ex) 108 { 109 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 110 ActionStateFacadeLogic.logger.warn("incorrect metafacade cast for ActionStateFacadeLogic.getEntry ActionFacade " + result + ": " + shieldedResult); 111 } 112 // actionState has no post constraints 113 this.__getEntry1r = getEntry1r; 114 if (isMetafacadePropertyCachingEnabled()) 115 { 116 this.__getEntry1rSet = true; 117 } 118 } 119 return getEntry1r; 120 } 121 122 /** 123 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 124 * @return Object 125 */ 126 protected abstract Object handleGetEntry(); 127 128 /** 129 * @param validationMessages Collection<ModelValidationMessage> 130 * @see StateFacadeLogicImpl#validateInvariants(Collection validationMessages) 131 */ 132 @Override 133 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 134 { 135 super.validateInvariants(validationMessages); 136 } 137}