View Javadoc
1   package org.andromda.metafacades.uml14;
2   
3   import java.util.ArrayList;
4   import java.util.Collection;
5   import java.util.Iterator;
6   import java.util.List;
7   import org.andromda.metafacades.uml.ActorFacade;
8   import org.andromda.metafacades.uml.GeneralizableElementFacade;
9   import org.omg.uml.behavioralelements.usecases.Actor;
10  
11  /**
12   * Metaclass facade implementation.
13   * @author Bob Fields
14   */
15  public class ActorFacadeLogicImpl
16      extends ActorFacadeLogic
17  {
18      private static final long serialVersionUID = 34L;
19      /**
20       * @param metaObject
21       * @param context
22       */
23      public ActorFacadeLogicImpl(
24          Actor metaObject,
25          String context)
26      {
27          super(metaObject, context);
28      }
29  
30      /**
31       * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner()
32       */
33      public Object getValidationOwner()
34      {
35          return this.getPackage();
36      }
37  
38      /**
39       * @see org.andromda.metafacades.uml.ActorFacade#getGeneralizedActors()
40       */
41      @Override
42      protected List<ActorFacade> handleGetGeneralizedActors()
43      {
44          final List<ActorFacade> generalizedActors = new ArrayList<ActorFacade>();
45  
46          final Collection<GeneralizableElementFacade> parentActors = this.getGeneralizations();
47          for (final Iterator<GeneralizableElementFacade> iterator = parentActors.iterator(); iterator.hasNext();)
48          {
49              final Object object = iterator.next();
50              if (object instanceof ActorFacade)
51              {
52                  generalizedActors.add((ActorFacade) object);
53              }
54          }
55          return generalizedActors;
56      }
57  
58      /**
59       *
60       * @see org.andromda.metafacades.uml.ActorFacade#getGeneralizedByActors()
61       */
62      @Override
63      protected List<ActorFacade> handleGetGeneralizedByActors()
64      {
65          final List<ActorFacade> generalizedByActors = new ArrayList<ActorFacade>();
66  
67          final Collection<GeneralizableElementFacade> specializedActors = this.getSpecializations();
68          for (final Iterator<GeneralizableElementFacade> iterator = specializedActors.iterator(); iterator.hasNext();)
69          {
70              final Object object = iterator.next();
71              if (object instanceof ActorFacade)
72              {
73                  generalizedByActors.add((ActorFacade) object);
74              }
75          }
76          return generalizedByActors;
77      }
78  }