View Javadoc
1   package org.andromda.metafacades.uml14;
2   
3   import java.util.Collection;
4   import org.andromda.core.metafacade.MetafacadeFactory;
5   import org.andromda.metafacades.uml.FilteredCollection;
6   import org.andromda.metafacades.uml.ModelElementFacade;
7   import org.andromda.metafacades.uml.UMLMetafacadeProperties;
8   import org.apache.commons.lang.ObjectUtils;
9   import org.omg.uml.UmlPackage;
10  import org.omg.uml.foundation.core.ModelElement;
11  import org.omg.uml.foundation.core.UmlClass;
12  
13  /**
14   * Metaclass facade implementation.
15   * @author Bob Fields
16   */
17  public class PackageFacadeLogicImpl
18      extends PackageFacadeLogic
19  {
20      private static final long serialVersionUID = 34L;
21      /**
22       * @param metaObject
23       * @param context
24       */
25      public PackageFacadeLogicImpl(
26          org.omg.uml.modelmanagement.UmlPackage metaObject,
27          String context)
28      {
29          super(metaObject, context);
30      }
31  
32      /**
33       * @see org.andromda.metafacades.uml.PackageFacade#getClasses()
34       */
35      @Override
36      public Collection<UmlClass> handleGetClasses()
37      {
38          return new FilteredCollection(metaObject.getOwnedElement())
39          {
40              private static final long serialVersionUID = 34L;
41              public boolean evaluate(Object object)
42              {
43                  return object instanceof UmlClass;
44              }
45          };
46      }
47  
48      /**
49       * @see org.andromda.metafacades.uml.PackageFacade#getSubPackages()
50       */
51      @Override
52      protected Collection<org.omg.uml.modelmanagement.UmlPackage> handleGetSubPackages()
53      {
54          return new FilteredCollection(metaObject.getOwnedElement())
55          {
56              private static final long serialVersionUID = 34L;
57              public boolean evaluate(Object object)
58              {
59                  return object instanceof org.omg.uml.modelmanagement.UmlPackage;
60              }
61          };
62      }
63  
64      /**
65       * @see org.andromda.metafacades.uml.PackageFacade#getModelElements()
66       */
67      @Override
68      protected Collection<ModelElement> handleGetModelElements()
69      {
70          return ((UmlPackage)MetafacadeFactory.getInstance().getModel().getModel()).getCore().getModelElement()
71                  .refAllOfType();
72      }
73  
74      /**
75       * @see org.andromda.metafacades.uml.PackageFacade#findModelElement(String)
76       */
77      @Override
78      public ModelElementFacade handleFindModelElement(final String fullyQualifiedName)
79      {
80          return (ModelElementFacade)this.shieldedElement(
81              UML14MetafacadeUtils.findByFullyQualifiedName(
82                  fullyQualifiedName,
83                  ObjectUtils.toString(this.getConfiguredProperty(UMLMetafacadeProperties.NAMESPACE_SEPARATOR)),
84                  true));
85      }
86  
87      /**
88       * @see org.andromda.metafacades.uml.PackageFacade#getOwnedElements()
89       */
90      @Override
91      protected Collection handleGetOwnedElements()
92      {
93          return metaObject.getOwnedElement();
94      }
95  
96      /**
97       * return ""
98       * @see org.andromda.metafacades.uml14.PackageFacadeLogic#handleGetTablePrefix()
99       */
100     @Override
101     protected String handleGetTablePrefix()
102     {
103         // TODO Auto-generated method stub
104         return "";
105     }
106 }