001package org.andromda.metafacades.uml14; 002 003import java.util.ArrayList; 004import java.util.Collection; 005import java.util.Iterator; 006import java.util.List; 007import org.andromda.metafacades.uml.ActorFacade; 008import org.andromda.metafacades.uml.GeneralizableElementFacade; 009import org.omg.uml.behavioralelements.usecases.Actor; 010 011/** 012 * Metaclass facade implementation. 013 * @author Bob Fields 014 */ 015public class ActorFacadeLogicImpl 016 extends ActorFacadeLogic 017{ 018 private static final long serialVersionUID = 34L; 019 /** 020 * @param metaObject 021 * @param context 022 */ 023 public ActorFacadeLogicImpl( 024 Actor metaObject, 025 String context) 026 { 027 super(metaObject, context); 028 } 029 030 /** 031 * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner() 032 */ 033 public Object getValidationOwner() 034 { 035 return this.getPackage(); 036 } 037 038 /** 039 * @see org.andromda.metafacades.uml.ActorFacade#getGeneralizedActors() 040 */ 041 @Override 042 protected List<ActorFacade> handleGetGeneralizedActors() 043 { 044 final List<ActorFacade> generalizedActors = new ArrayList<ActorFacade>(); 045 046 final Collection<GeneralizableElementFacade> parentActors = this.getGeneralizations(); 047 for (final Iterator<GeneralizableElementFacade> iterator = parentActors.iterator(); iterator.hasNext();) 048 { 049 final Object object = iterator.next(); 050 if (object instanceof ActorFacade) 051 { 052 generalizedActors.add((ActorFacade) object); 053 } 054 } 055 return generalizedActors; 056 } 057 058 /** 059 * 060 * @see org.andromda.metafacades.uml.ActorFacade#getGeneralizedByActors() 061 */ 062 @Override 063 protected List<ActorFacade> handleGetGeneralizedByActors() 064 { 065 final List<ActorFacade> generalizedByActors = new ArrayList<ActorFacade>(); 066 067 final Collection<GeneralizableElementFacade> specializedActors = this.getSpecializations(); 068 for (final Iterator<GeneralizableElementFacade> iterator = specializedActors.iterator(); iterator.hasNext();) 069 { 070 final Object object = iterator.next(); 071 if (object instanceof ActorFacade) 072 { 073 generalizedByActors.add((ActorFacade) object); 074 } 075 } 076 return generalizedByActors; 077 } 078}