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.ExtensionPointFacade; 011import org.andromda.metafacades.uml.UseCaseFacade; 012import org.apache.log4j.Logger; 013import org.omg.uml.behavioralelements.usecases.ExtensionPoint; 014 015/** 016 * Identifies a point in the behavior of a use case where that behavior can be extended by the 017 * behavior of some other (extending) use case, as specified by an extend relationship. 018 * MetafacadeLogic for ExtensionPointFacade 019 * 020 * @see ExtensionPointFacade 021 */ 022public abstract class ExtensionPointFacadeLogic 023 extends ModelElementFacadeLogicImpl 024 implements ExtensionPointFacade 025{ 026 /** 027 * The underlying UML object 028 * @see ExtensionPoint 029 */ 030 protected ExtensionPoint metaObject; 031 032 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 033 * @param metaObjectIn 034 * @param context 035 */ 036 protected ExtensionPointFacadeLogic(ExtensionPoint metaObjectIn, String context) 037 { 038 super(metaObjectIn, getContext(context)); 039 this.metaObject = metaObjectIn; 040 } 041 042 /** 043 * The logger instance. 044 */ 045 private static final Logger logger = Logger.getLogger(ExtensionPointFacadeLogic.class); 046 047 /** 048 * Gets the context for this metafacade logic instance. 049 * @param context String. Set to ExtensionPointFacade if null 050 * @return context String 051 */ 052 private static String getContext(String context) 053 { 054 if (context == null) 055 { 056 context = "org.andromda.metafacades.uml.ExtensionPointFacade"; 057 } 058 return context; 059 } 060 061 /** Reset context only for non-root metafacades 062 * @param context 063 */ 064 @Override 065 public void resetMetafacadeContext(String context) 066 { 067 if (!this.contextRoot) // reset context only for non-root metafacades 068 { 069 context = getContext(context); // to have same value as in original constructor call 070 setMetafacadeContext (context); 071 } 072 } 073 074 /** 075 * @return boolean true always 076 * @see ExtensionPointFacade 077 */ 078 public boolean isExtensionPointFacadeMetaType() 079 { 080 return true; 081 } 082 083 // ------------- associations ------------------ 084 085 private UseCaseFacade __getUseCase1r; 086 private boolean __getUseCase1rSet = false; 087 088 /** 089 * The extension points related to this use-case. 090 * @return (UseCaseFacade)handleGetUseCase() 091 */ 092 public final UseCaseFacade getUseCase() 093 { 094 UseCaseFacade getUseCase1r = this.__getUseCase1r; 095 if (!this.__getUseCase1rSet) 096 { 097 // extensionPoints has no pre constraints 098 Object result = handleGetUseCase(); 099 MetafacadeBase shieldedResult = this.shieldedElement(result); 100 try 101 { 102 getUseCase1r = (UseCaseFacade)shieldedResult; 103 } 104 catch (ClassCastException ex) 105 { 106 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 107 ExtensionPointFacadeLogic.logger.warn("incorrect metafacade cast for ExtensionPointFacadeLogic.getUseCase UseCaseFacade " + result + ": " + shieldedResult); 108 } 109 // extensionPoints has no post constraints 110 this.__getUseCase1r = getUseCase1r; 111 if (isMetafacadePropertyCachingEnabled()) 112 { 113 this.__getUseCase1rSet = true; 114 } 115 } 116 return getUseCase1r; 117 } 118 119 /** 120 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 121 * @return Object 122 */ 123 protected abstract Object handleGetUseCase(); 124 125 /** 126 * @param validationMessages Collection<ModelValidationMessage> 127 * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages) 128 */ 129 @Override 130 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 131 { 132 super.validateInvariants(validationMessages); 133 } 134}