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.ActorFacade; 011import org.apache.log4j.Logger; 012import org.omg.uml.behavioralelements.usecases.Actor; 013 014/** 015 * An actor specifies a role played by a user or any other system that interacts with the subject. 016 * MetafacadeLogic for ActorFacade 017 * 018 * @see ActorFacade 019 */ 020public abstract class ActorFacadeLogic 021 extends ClassifierFacadeLogicImpl 022 implements ActorFacade 023{ 024 /** 025 * The underlying UML object 026 * @see Actor 027 */ 028 protected Actor metaObject; 029 030 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 031 * @param metaObjectIn 032 * @param context 033 */ 034 protected ActorFacadeLogic(Actor metaObjectIn, String context) 035 { 036 super(metaObjectIn, getContext(context)); 037 this.metaObject = metaObjectIn; 038 } 039 040 /** 041 * The logger instance. 042 */ 043 private static final Logger logger = Logger.getLogger(ActorFacadeLogic.class); 044 045 /** 046 * Gets the context for this metafacade logic instance. 047 * @param context String. Set to ActorFacade if null 048 * @return context String 049 */ 050 private static String getContext(String context) 051 { 052 if (context == null) 053 { 054 context = "org.andromda.metafacades.uml.ActorFacade"; 055 } 056 return context; 057 } 058 059 /** Reset context only for non-root metafacades 060 * @param context 061 */ 062 @Override 063 public void resetMetafacadeContext(String context) 064 { 065 if (!this.contextRoot) // reset context only for non-root metafacades 066 { 067 context = getContext(context); // to have same value as in original constructor call 068 setMetafacadeContext (context); 069 } 070 } 071 072 /** 073 * @return boolean true always 074 * @see ActorFacade 075 */ 076 public boolean isActorFacadeMetaType() 077 { 078 return true; 079 } 080 081 // ------------- associations ------------------ 082 083 private List<ActorFacade> __getGeneralizedByActors1r; 084 private boolean __getGeneralizedByActors1rSet = false; 085 086 /** 087 * All actors generalized by this actor. 088 * @return (List<ActorFacade>)handleGetGeneralizedByActors() 089 */ 090 public final List<ActorFacade> getGeneralizedByActors() 091 { 092 List<ActorFacade> getGeneralizedByActors1r = this.__getGeneralizedByActors1r; 093 if (!this.__getGeneralizedByActors1rSet) 094 { 095 // generalizedActors has no pre constraints 096 List result = handleGetGeneralizedByActors(); 097 List shieldedResult = this.shieldedElements(result); 098 try 099 { 100 getGeneralizedByActors1r = (List<ActorFacade>)shieldedResult; 101 } 102 catch (ClassCastException ex) 103 { 104 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 105 ActorFacadeLogic.logger.warn("incorrect metafacade cast for ActorFacadeLogic.getGeneralizedByActors List<ActorFacade> " + result + ": " + shieldedResult); 106 } 107 // generalizedActors has no post constraints 108 this.__getGeneralizedByActors1r = getGeneralizedByActors1r; 109 if (isMetafacadePropertyCachingEnabled()) 110 { 111 this.__getGeneralizedByActors1rSet = true; 112 } 113 } 114 return getGeneralizedByActors1r; 115 } 116 117 /** 118 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 119 * @return List 120 */ 121 protected abstract List handleGetGeneralizedByActors(); 122 123 private List<ActorFacade> __getGeneralizedActors2r; 124 private boolean __getGeneralizedActors2rSet = false; 125 126 /** 127 * The set of actors that generalize this actor. 128 * @return (List<ActorFacade>)handleGetGeneralizedActors() 129 */ 130 public final List<ActorFacade> getGeneralizedActors() 131 { 132 List<ActorFacade> getGeneralizedActors2r = this.__getGeneralizedActors2r; 133 if (!this.__getGeneralizedActors2rSet) 134 { 135 // generalizedByActors has no pre constraints 136 List result = handleGetGeneralizedActors(); 137 List shieldedResult = this.shieldedElements(result); 138 try 139 { 140 getGeneralizedActors2r = (List<ActorFacade>)shieldedResult; 141 } 142 catch (ClassCastException ex) 143 { 144 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 145 ActorFacadeLogic.logger.warn("incorrect metafacade cast for ActorFacadeLogic.getGeneralizedActors List<ActorFacade> " + result + ": " + shieldedResult); 146 } 147 // generalizedByActors has no post constraints 148 this.__getGeneralizedActors2r = getGeneralizedActors2r; 149 if (isMetafacadePropertyCachingEnabled()) 150 { 151 this.__getGeneralizedActors2rSet = true; 152 } 153 } 154 return getGeneralizedActors2r; 155 } 156 157 /** 158 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 159 * @return List 160 */ 161 protected abstract List handleGetGeneralizedActors(); 162 163 /** 164 * @param validationMessages Collection<ModelValidationMessage> 165 * @see ClassifierFacadeLogicImpl#validateInvariants(Collection validationMessages) 166 */ 167 @Override 168 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 169 { 170 super.validateInvariants(validationMessages); 171 } 172}