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.RedefinableTemplateSignatureFacade; 012import org.apache.log4j.Logger; 013import org.omg.uml.foundation.core.ModelElement; 014 015/** 016 * A signature containing the template parameters for the templated element (Class, operation, 017 * property, etc). A template signature bundles the set of formal template parameters for a 018 * templated element. 019 * MetafacadeLogic for RedefinableTemplateSignatureFacade 020 * 021 * @see RedefinableTemplateSignatureFacade 022 */ 023public abstract class RedefinableTemplateSignatureFacadeLogic 024 extends ModelElementFacadeLogicImpl 025 implements RedefinableTemplateSignatureFacade 026{ 027 /** 028 * The underlying UML object 029 * @see Object 030 */ 031 protected Object metaObject; 032 033 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 034 * @param metaObjectIn 035 * @param context 036 */ 037 protected RedefinableTemplateSignatureFacadeLogic(Object metaObjectIn, String context) 038 { 039 super((ModelElement)metaObjectIn, getContext(context)); 040 this.metaObject = metaObjectIn; 041 } 042 043 /** 044 * The logger instance. 045 */ 046 private static final Logger logger = Logger.getLogger(RedefinableTemplateSignatureFacadeLogic.class); 047 048 /** 049 * Gets the context for this metafacade logic instance. 050 * @param context String. Set to RedefinableTemplateSignatureFacade 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.RedefinableTemplateSignatureFacade"; 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 RedefinableTemplateSignatureFacade 078 */ 079 public boolean isRedefinableTemplateSignatureFacadeMetaType() 080 { 081 return true; 082 } 083 084 // ------------- associations ------------------ 085 086 /** 087 * A signature containing the template parameters for the templated element (Class, operation, 088 * property, etc). A template signature bundles the set of formal template parameters for a 089 * templated 090 * element. 091 * @return (ClassifierFacade)handleGetClassifier() 092 */ 093 public final ClassifierFacade getClassifier() 094 { 095 ClassifierFacade getClassifier1r = null; 096 // redefinableTemplateSignatureFacade has no pre constraints 097 Object result = handleGetClassifier(); 098 MetafacadeBase shieldedResult = this.shieldedElement(result); 099 try 100 { 101 getClassifier1r = (ClassifierFacade)shieldedResult; 102 } 103 catch (ClassCastException ex) 104 { 105 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 106 RedefinableTemplateSignatureFacadeLogic.logger.warn("incorrect metafacade cast for RedefinableTemplateSignatureFacadeLogic.getClassifier ClassifierFacade " + result + ": " + shieldedResult); 107 } 108 // redefinableTemplateSignatureFacade has no post constraints 109 return getClassifier1r; 110 } 111 112 /** 113 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 114 * @return Object 115 */ 116 protected abstract Object handleGetClassifier(); 117 118 /** 119 * @param validationMessages Collection<ModelValidationMessage> 120 * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages) 121 */ 122 @Override 123 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 124 { 125 super.validateInvariants(validationMessages); 126 } 127}