[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Tue Jan 3 09:31:07 UTC 2006


SVN commit 493938 by okellogg:

Support loading of <UML:Abstraction> as demonstrated in
http://bugs.kde.org/attachment.cgi?id=14121&action=view
CCBUG:56184


 M  +7 -12     association.cpp  
 M  +5 -0      umldoc.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/association.cpp #493937:493938
@@ -192,7 +192,8 @@
     UMLDoc * doc = UMLApp::app()->getDocument();
     UMLObject * obj[2] = { NULL, NULL };
     if (m_AssocType == Uml::at_Generalization ||
-            m_AssocType == Uml::at_Dependency) {
+        m_AssocType == Uml::at_Realization ||
+        m_AssocType == Uml::at_Dependency) {
         for (unsigned r = Uml::A; r <= Uml::B; r++) {
             const QString fetch = (m_AssocType == Uml::at_Generalization ?
                                    r == Uml::A ? "child" : "parent"
@@ -221,15 +222,9 @@
                 QString tag = tempElement.tagName();
                 if (Model_Utils::isCommonXMIAttribute(tag))
                     continue;
-                bool isGeneralization = (m_AssocType == Uml::at_Generalization &&
-                                         (tagEq(tag, "child") || tagEq(tag, "parent") ||
-                                          tagEq(tag, "subtype") || tagEq(tag, "supertype")));
-                bool isDependency = (m_AssocType == Uml::at_Dependency &&
-                                     (tagEq(tag, "client") || tagEq(tag, "supplier")));
-                if (!isGeneralization && !isDependency) {
-                    kdDebug() << "UMLAssociation::load: cannot load " << tag << endl;
-                    continue;
-                }
+                // Permitted tag names:
+                //  roleA: "child" "subtype" "client"
+                //  roleB: "parent" "supertype" "supplier"
                 QString idStr = tempElement.attribute( "xmi.id", "" );
                 if (idStr.isEmpty())
                     idStr = tempElement.attribute( "xmi.idref", "" );
@@ -242,8 +237,8 @@
                 }
                 if (idStr.isEmpty()) {
                     kdError() << "UMLAssociation::load (type " << m_AssocType
-                    << ", id " << ID2STR(getID()) << "): "
-                    << "xmi id not given for " << tag << endl;
+                        << ", id " << ID2STR(getID()) << "): "
+                        << "xmi id not given for " << tag << endl;
                     continue;
                 }
                 // Since we know for sure that we're dealing with a non
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #493937:493938
@@ -2146,6 +2146,8 @@
         if (tagEq(type, "Association") ||
                 tagEq(type, "AssociationClass") ||
                 tagEq(type, "Generalization") ||
+                tagEq(type, "Realization") ||
+                tagEq(type, "Abstraction") ||
                 tagEq(type, "Dependency")) {
             if ( !status ) {
                 // Some interim umbrello versions saved empty UML:Associations,
@@ -2279,6 +2281,9 @@
         pObject = new UMLAssociation();
     } else if (tagEq(type, "Generalization")) {
         pObject = new UMLAssociation(Uml::at_Generalization);
+    } else if (tagEq(type, "Realization") ||
+               tagEq(type, "Abstraction")) {
+        pObject = new UMLAssociation(Uml::at_Realization);
     } else if (tagEq(type, "Dependency")) {
         pObject = new UMLAssociation(Uml::at_Dependency);
     }




More information about the umbrello-devel mailing list