svn commit: r16423 - trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ModelManagementHelperMDRImpl.java

Tom Morris <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-12-22 14:50:20-0800
New Revision: 16423

Modified:
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ModelManagementHelperMDRImpl.java

Log:
Refactor to use new methods

Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ModelManagementHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ModelManagementHelperMDRImpl.java?view=diff&pathrev=16423&r1=16422&r2=16423
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ModelManagementHelperMDRImpl.java	(original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/ModelManagementHelperMDRImpl.java	2008-12-22 14:50:20-0800
@@ -32,7 +32,6 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.jmi.model.MofClass;
 import javax.jmi.reflect.InvalidObjectException;
 import javax.jmi.reflect.RefClass;
 import javax.jmi.reflect.RefObject;
@@ -195,29 +194,14 @@
             name = name.substring(3);
         }
 
-        Collection allOfType = Collections.EMPTY_LIST;
-        // Get all (UML) metaclasses and search for the requested one
-        Collection metaTypes = modelImpl.getModelPackage().getMofClass()
-                .refAllOfClass();
-        for (Iterator it = metaTypes.iterator(); it.hasNext();) {
-            MofClass elem = (MofClass) it.next();
-            // TODO: Generalize - assumes UML type names are unique
-            // without the qualifying package names - true for UML 1.4
-            if (name.equals(elem.getName())) {
-                List names = elem.getQualifiedName();
-                // Although this only handles one level of package, it is
-                // OK for UML 1.4 because of clustering
-                try {
-                    RefPackage pkg = ((RefObject) nsa).refOutermostPackage()
-                            .refPackage((String) names.get(0));
-                    // Get the metatype proxy and use it to find all instances
-                    RefClass classProxy = pkg.refClass((String) names.get(1));
-                    allOfType = classProxy.refAllOfType();
-                } catch (InvalidObjectException e) {
-                    throw new InvalidElementException(e);
-                }
-                break;
-            }
+        Collection allOfType = Collections.emptySet();
+        try {
+            RefPackage extent = ((RefObject) nsa).refOutermostPackage();
+            RefClass classProxy = ((FacadeMDRImpl) modelImpl.getFacade())
+                    .getProxy(name, extent);
+            allOfType = classProxy.refAllOfType();
+        } catch (InvalidObjectException e) {
+            throw new InvalidElementException(e);
         }
 
         // Remove any elements not in requested namespace

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=990135

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.