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

Oliver Kellogg okellogg at users.sourceforge.net
Fri Feb 16 18:36:41 UTC 2007


SVN commit 634263 by okellogg:

writeClass (aggregations, compositions): Do not generate code when `c´ is at role B.
 Generate code for the role B object.
BUG:135527


 M  +1 -0      ChangeLog  
 M  +10 -4     umbrello/codegenerators/jswriter.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #634262:634263
@@ -3,6 +3,7 @@
 * Bugs fixed from http://bugs.kde.org:
 * %date% and %time% not being parsed (96612)
 * Relationships for entities do not live outside of an entity relationship diagram (125146)
+* Javascript wrong Code Generation (135527)
 * Javascript Code Generation creates bad format methods (135540)
 * Crash when deleting the link between a package and a class (141602)
 * Ada95 Code Generation Errors for Aggregation (141644)
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/jswriter.cpp #634262:634263
@@ -155,8 +155,11 @@
         js << m_endl << m_indentation << "/**Aggregations: */" << m_endl;
         for (UMLAssociation* a = aggregations.first(); a; a = aggregations.next())
         {
-            QString nm(cleanName(a->getObject(Uml::A)->getName()));
-            if (a->getMulti(Uml::A).isEmpty())
+            UMLObject *b = a->getObject(Uml::B);
+            if (b == c)
+                continue;   // we need to be at the "A" side and the other guy at "B"
+            QString nm(cleanName(b->getName()));
+            if (a->getMulti(Uml::B).isEmpty())
                 js << m_indentation << "this.m_" << nm << " = new " << nm << " ();" << m_endl;
             else
                 js << m_indentation << "this.m_" << nm.lower() << " = new Array ();" << m_endl;
@@ -168,8 +171,11 @@
         js << m_endl << m_indentation << "/**Compositions: */" << m_endl;
         for (UMLAssociation *a = compositions.first(); a; a = compositions.next())
         {
-            QString nm(cleanName(a->getObject(Uml::A)->getName()));
-            if(a->getMulti(Uml::A).isEmpty())
+            UMLObject *b = a->getObject(Uml::B);
+            if (b == c)
+                continue;   // we need to be at the "A" side and the other guy at "B"
+            QString nm(cleanName(b->getName()));
+            if (a->getMulti(Uml::B).isEmpty())
                 js << m_indentation << "this.m_" << nm << " = new "<< nm << " ();" << m_endl;
             else
                 js << m_indentation << "this.m_" << nm.lower() << " = new Array ();" << m_endl;




More information about the umbrello-devel mailing list