[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sat Jan 3 19:57:01 UTC 2004


CVS commit by okellogg: 

{loadFrom,saveTo}XMI: Align handling of at_Realization with the UML DTD.


  M +7 -28     association.cpp   1.32


--- kdesdk/umbrello/umbrello/association.cpp  #1.31:1.32
@@ -158,5 +158,6 @@ bool UMLAssociation::assocTypeHasUMLRepr
 
 bool UMLAssociation::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
-        if (m_AssocType == Uml::at_Generalization) {
+        if (m_AssocType == Uml::at_Generalization ||
+            m_AssocType == Uml::at_Realization) {
                 QDomElement assocElement = qDoc.createElement( "UML:Generalization" );
                 bool status = UMLObject::saveToXMI( qDoc, assocElement );
@@ -168,26 +169,4 @@ bool UMLAssociation::saveToXMI( QDomDocu
         QDomElement associationElement = qDoc.createElement( "UML:Association" );
         bool status = UMLObject::saveToXMI( qDoc, associationElement );
-        if (m_AssocType == Uml::at_Realization) {
-                kdDebug() << "UMLAssociation::saveToXMI: FIXME: saving of assoctype "
-                          << m_AssocType << "is not yet UML DTD compliant"
-                          << endl;
-                // Old style stuff - FIXME: Make UML DTD compliant.
-                associationElement.setAttribute( "assoctype", getAssocType() );
-                associationElement.setAttribute( "rolea", getRoleAId() );
-                associationElement.setAttribute( "roleb", getRoleBId() );
-                associationElement.setAttribute( "multia", getMultiA() );
-                associationElement.setAttribute( "multib", getMultiB() );
-                associationElement.setAttribute( "namea", getRoleNameA() );
-                associationElement.setAttribute( "nameb", getRoleNameB() );
-                associationElement.setAttribute( "doca", getRoleADoc() );
-                associationElement.setAttribute( "docb", getRoleBDoc() );
-                associationElement.setAttribute( "visibilitya", getVisibilityA() );
-                associationElement.setAttribute( "visibilityb", getVisibilityB() );
-                associationElement.setAttribute( "changeabilitya", getChangeabilityA() );
-                associationElement.setAttribute( "changeabilityb", getChangeabilityB() );
-                qElement.appendChild( associationElement );
-                return true;
-        }
-
         QDomElement connElement = qDoc.createElement("UML:Association.connection");
         getUMLRoleA()->saveToXMI (qDoc, connElement);
@@ -219,4 +197,7 @@ bool UMLAssociation::loadFromXMI( QDomEl
                         return false;
                 getUMLRoleB()->setObject(objB);
+                if (objA->getBaseType() == Uml::ot_Class &&
+                    objB->getBaseType() == Uml::ot_Interface)
+                        m_AssocType = Uml::at_Realization;
                 return true;
         }
@@ -242,6 +223,5 @@ bool UMLAssociation::loadFromXMI( QDomEl
                 tempElement = node.toElement();
                 if (tempElement.isNull()) {
-                        kdWarning() << "UML:AssociationEnd: "
-                                    << "element (A) is Null" << endl;
+                        kdWarning() << "UML:AssociationEnd: element (A) is Null" << endl;
                         return false;
                 }
@@ -258,6 +238,5 @@ bool UMLAssociation::loadFromXMI( QDomEl
                 tempElement = node.toElement();
                 if (tempElement.isNull()) {
-                        kdWarning() << "UML:AssociationEnd: "
-                                    << "element (B) is Null" << endl;
+                        kdWarning() << "UML:AssociationEnd: element (B) is Null" << endl;
                         return false;
                 }






More information about the umbrello-devel mailing list