[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sat Oct 30 14:02:12 UTC 2004


CVS commit by okellogg: 

loadFromXMI: Honor documentation TaggedValues produced by Unisys.JCR.1


  M +30 -1     umldoc.cpp   1.195


--- kdesdk/umbrello/umbrello/umldoc.cpp  #1.194:1.195
@@ -1942,4 +1942,5 @@ bool UMLDoc::loadFromXMI( QIODevice & fi
                         continue;
                 }
+                bool seen_UMLObjects = false;
                 //process content
                 for (QDomNode child = node.firstChild(); !child.isNull();
@@ -1955,4 +1956,5 @@ bool UMLDoc::loadFromXMI( QIODevice & fi
                                         return false;
                                 }
+                                seen_UMLObjects = true;
                         } else if (tagEq(tag, "Package") ||
                                    tagEq(tag, "Class") ||
@@ -1965,5 +1967,32 @@ bool UMLDoc::loadFromXMI( QIODevice & fi
                                         return false;
                                 }
-                                break;
+                                seen_UMLObjects = true;
+                        } else if (tagEq(tag, "TaggedValue")) {
+                                // This tag is produced here, i.e. outside of <UML:Model>,
+                                // by the Unisys.JCR.1 Rose-to-XMI tool.
+                                if (! seen_UMLObjects) {
+                                        kdDebug() << "skipping TaggedValue because not seen_UMLObjects"
+                                                  << endl;
+                                        continue;
+                                }
+                                tag = element.attribute("tag", "");
+                                if (tag != "documentation") {
+                                        continue;
+                                }
+                                QString modelElement = element.attribute("modelElement", "");
+                                if (modelElement.isEmpty()) {
+                                        kdDebug() << "skipping TaggedValue(documentation) because "
+                                                  << "modelElement.isEmpty()" << endl;
+                                        continue;
+                                }
+                                UMLObject *o = findObjectById(STR2ID(modelElement));
+                                if (o == NULL) {
+                                        kdDebug() << "TaggedValue(documentation): cannot find object"
+                                                  << " for modelElement " << modelElement << endl;
+                                        continue;
+                                }
+                                QString value = element.attribute("value", "");
+                                if (! value.isEmpty())
+                                        o->setDoc(value);
                         } else {
                                 // for backward compatibility






More information about the umbrello-devel mailing list