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.ModelValidationMessage; 010import org.andromda.metafacades.uml.LinkEndFacade; 011import org.andromda.metafacades.uml.LinkFacade; 012import org.apache.log4j.Logger; 013import org.omg.uml.behavioralelements.commonbehavior.Link; 014 015/** 016 * A representation of the model object 'Instance Specification'. Represents an instance in a 017 * modeled system. Has the capability of being a deployment target in a deployment relationship, in 018 * the case that it is an instance of a node. Has the capability of being a deployed artifact, if it 019 * is an instance of an artifact. 020 * MetafacadeLogic for LinkFacade 021 * 022 * @see LinkFacade 023 */ 024public abstract class LinkFacadeLogic 025 extends ModelElementFacadeLogicImpl 026 implements LinkFacade 027{ 028 /** 029 * The underlying UML object 030 * @see Link 031 */ 032 protected Link metaObject; 033 034 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 035 * @param metaObjectIn 036 * @param context 037 */ 038 protected LinkFacadeLogic(Link metaObjectIn, String context) 039 { 040 super(metaObjectIn, getContext(context)); 041 this.metaObject = metaObjectIn; 042 } 043 044 /** 045 * The logger instance. 046 */ 047 private static final Logger logger = Logger.getLogger(LinkFacadeLogic.class); 048 049 /** 050 * Gets the context for this metafacade logic instance. 051 * @param context String. Set to LinkFacade 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.LinkFacade"; 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 LinkFacade 079 */ 080 public boolean isLinkFacadeMetaType() 081 { 082 return true; 083 } 084 085 // ------------- associations ------------------ 086 087 private Collection<LinkEndFacade> __getLinkEnds1r; 088 private boolean __getLinkEnds1rSet = false; 089 090 /** 091 * The link owning this link end. 092 * @return (Collection<LinkEndFacade>)handleGetLinkEnds() 093 */ 094 public final Collection<LinkEndFacade> getLinkEnds() 095 { 096 Collection<LinkEndFacade> getLinkEnds1r = this.__getLinkEnds1r; 097 if (!this.__getLinkEnds1rSet) 098 { 099 // link has no pre constraints 100 Collection result = handleGetLinkEnds(); 101 List shieldedResult = this.shieldedElements(result); 102 try 103 { 104 getLinkEnds1r = (Collection<LinkEndFacade>)shieldedResult; 105 } 106 catch (ClassCastException ex) 107 { 108 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 109 LinkFacadeLogic.logger.warn("incorrect metafacade cast for LinkFacadeLogic.getLinkEnds Collection<LinkEndFacade> " + result + ": " + shieldedResult); 110 } 111 // link has no post constraints 112 this.__getLinkEnds1r = getLinkEnds1r; 113 if (isMetafacadePropertyCachingEnabled()) 114 { 115 this.__getLinkEnds1rSet = true; 116 } 117 } 118 return getLinkEnds1r; 119 } 120 121 /** 122 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 123 * @return Collection 124 */ 125 protected abstract Collection handleGetLinkEnds(); 126 127 /** 128 * @param validationMessages Collection<ModelValidationMessage> 129 * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages) 130 */ 131 @Override 132 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 133 { 134 super.validateInvariants(validationMessages); 135 } 136}