svn commit: r17552 - trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/XmiReaderEUMLImpl.java

Thomas Neustupny <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2009-11-25 13:27:41-0800
New Revision: 17552

Modified:
   trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/XmiReaderEUMLImpl.java

Log:
UML2: avoid user depending full paths in model
PLEASE REVIEW!

Modified: trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/XmiReaderEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/XmiReaderEUMLImpl.java?view=diff&pathrev=17552&r1=17551&r2=17552
==============================================================================
--- trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/XmiReaderEUMLImpl.java	(original)
+++ trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/XmiReaderEUMLImpl.java	2009-11-25 13:27:41-0800
@@ -143,6 +143,19 @@
         if (id == null) {
             id = inputSource.getPublicId();
         }
+        // The id contains the whole path, which is not what we want in models
+        // (it's a tradeoff, but collisions will be unlikely with the xmi.id)
+        if (id != null) {
+            // for ArgoUML internal profiles, id will start with "org/argouml"
+            int ix = id.indexOf("org/argouml/");
+            if (ix != -1) {
+                id = id.substring(ix);
+            } else if ((ix = id.lastIndexOf('/')) != -1) {
+                // for user profiles, use the filename only
+                id = id.substring(ix + 1);
+            }
+        }
+
         Resource r = UMLUtil.getResource(modelImpl, 
                 URI.createURI(id), readOnly);

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

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.