001package org.andromda.metafacades.uml14; 002 003import java.util.Collection; 004import org.andromda.core.metafacade.MetafacadeFactory; 005import org.andromda.metafacades.uml.FilteredCollection; 006import org.andromda.metafacades.uml.ModelElementFacade; 007import org.andromda.metafacades.uml.UMLMetafacadeProperties; 008import org.apache.commons.lang.ObjectUtils; 009import org.omg.uml.UmlPackage; 010import org.omg.uml.foundation.core.ModelElement; 011import org.omg.uml.foundation.core.UmlClass; 012 013/** 014 * Metaclass facade implementation. 015 * @author Bob Fields 016 */ 017public class PackageFacadeLogicImpl 018 extends PackageFacadeLogic 019{ 020 private static final long serialVersionUID = 34L; 021 /** 022 * @param metaObject 023 * @param context 024 */ 025 public PackageFacadeLogicImpl( 026 org.omg.uml.modelmanagement.UmlPackage metaObject, 027 String context) 028 { 029 super(metaObject, context); 030 } 031 032 /** 033 * @see org.andromda.metafacades.uml.PackageFacade#getClasses() 034 */ 035 @Override 036 public Collection<UmlClass> handleGetClasses() 037 { 038 return new FilteredCollection(metaObject.getOwnedElement()) 039 { 040 private static final long serialVersionUID = 34L; 041 public boolean evaluate(Object object) 042 { 043 return object instanceof UmlClass; 044 } 045 }; 046 } 047 048 /** 049 * @see org.andromda.metafacades.uml.PackageFacade#getSubPackages() 050 */ 051 @Override 052 protected Collection<org.omg.uml.modelmanagement.UmlPackage> handleGetSubPackages() 053 { 054 return new FilteredCollection(metaObject.getOwnedElement()) 055 { 056 private static final long serialVersionUID = 34L; 057 public boolean evaluate(Object object) 058 { 059 return object instanceof org.omg.uml.modelmanagement.UmlPackage; 060 } 061 }; 062 } 063 064 /** 065 * @see org.andromda.metafacades.uml.PackageFacade#getModelElements() 066 */ 067 @Override 068 protected Collection<ModelElement> handleGetModelElements() 069 { 070 return ((UmlPackage)MetafacadeFactory.getInstance().getModel().getModel()).getCore().getModelElement() 071 .refAllOfType(); 072 } 073 074 /** 075 * @see org.andromda.metafacades.uml.PackageFacade#findModelElement(String) 076 */ 077 @Override 078 public ModelElementFacade handleFindModelElement(final String fullyQualifiedName) 079 { 080 return (ModelElementFacade)this.shieldedElement( 081 UML14MetafacadeUtils.findByFullyQualifiedName( 082 fullyQualifiedName, 083 ObjectUtils.toString(this.getConfiguredProperty(UMLMetafacadeProperties.NAMESPACE_SEPARATOR)), 084 true)); 085 } 086 087 /** 088 * @see org.andromda.metafacades.uml.PackageFacade#getOwnedElements() 089 */ 090 @Override 091 protected Collection handleGetOwnedElements() 092 { 093 return metaObject.getOwnedElement(); 094 } 095 096 /** 097 * return "" 098 * @see org.andromda.metafacades.uml14.PackageFacadeLogic#handleGetTablePrefix() 099 */ 100 @Override 101 protected String handleGetTablePrefix() 102 { 103 // TODO Auto-generated method stub 104 return ""; 105 } 106}