01: package org.andromda.metafacades.uml14;
02:
03: import java.util.Collection;
04:
05: import org.andromda.core.metafacade.MetafacadeFactory;
06: import org.andromda.metafacades.uml.FilteredCollection;
07: import org.andromda.metafacades.uml.ModelElementFacade;
08: import org.andromda.metafacades.uml.UMLMetafacadeProperties;
09: import org.apache.commons.lang.ObjectUtils;
10: import org.omg.uml.UmlPackage;
11: import org.omg.uml.foundation.core.UmlClass;
12:
13: /**
14: * Metaclass facade implementation.
15: */
16: public class PackageFacadeLogicImpl extends PackageFacadeLogic {
17: public PackageFacadeLogicImpl(
18: org.omg.uml.modelmanagement.UmlPackage metaObject,
19: String context) {
20: super (metaObject, context);
21: }
22:
23: /**
24: * @see org.andromda.metafacades.uml.PackageFacade#getClasses()
25: */
26: public java.util.Collection handleGetClasses() {
27: return new FilteredCollection(metaObject.getOwnedElement()) {
28: public boolean evaluate(Object object) {
29: return object instanceof UmlClass;
30: }
31: };
32: }
33:
34: /**
35: * @see org.andromda.metafacades.uml.PackageFacade#getSubPackages()
36: */
37: protected Collection handleGetSubPackages() {
38: return new FilteredCollection(metaObject.getOwnedElement()) {
39: public boolean evaluate(Object object) {
40: return object instanceof org.omg.uml.modelmanagement.UmlPackage;
41: }
42: };
43: }
44:
45: /**
46: * @see org.andromda.metafacades.uml.PackageFacade#getModelElements()
47: */
48: protected Collection handleGetModelElements() {
49: return ((UmlPackage) MetafacadeFactory.getInstance().getModel()
50: .getModel()).getCore().getModelElement().refAllOfType();
51: }
52:
53: /**
54: * @see org.andromda.metafacades.uml.PackageFacade#findModelElement(java.lang.String)
55: */
56: public ModelElementFacade handleFindModelElement(
57: final String fullyQualifiedName) {
58: return (ModelElementFacade) this
59: .shieldedElement(UML14MetafacadeUtils
60: .findByFullyQualifiedName(
61: fullyQualifiedName,
62: ObjectUtils
63: .toString(this
64: .getConfiguredProperty(UMLMetafacadeProperties.NAMESPACE_SEPARATOR)),
65: true));
66: }
67:
68: /**
69: * @see org.andromda.metafacades.uml.PackageFacade#getOwnedElements()
70: */
71: protected Collection handleGetOwnedElements() {
72: return metaObject.getOwnedElement();
73: }
74: }
|