Bug 137564

Summary: Artifacts of a component diagram are wrongly placed in Deployment View folder
Product: [Applications] umbrello Reporter: johnny
Component: generalAssignee: Oliver Kellogg <okellogg>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description johnny 2006-11-19 12:36:48 UTC
Version:           1.5.5 (using KDE KDE 3.5.5)
Installed from:    Compiled From Sources
Compiler:          doesn't apply doesn't apply
OS:                Linux

The environment is quite simple: I was working on a component diagram, at from a certain point on, saving the diagram would fail reloading it later.

Let me explain better:

- I've got my architecture.xmi of about 50kb, with a single component diagram.
- I open it, hit "save as" without any action, and save it as arch2.xmi, and it turns out  it is about 30kb.
- If I open back arch2.xmi the diagram is gone, but there are still the classes and interface I created, on the left pane.

I really would need to go on with this diagram, I hope it will be recoverable after the bug is fixed.
If you need the offending file drop me an email address, I will send it only privately to umbrello developers, not in the bugzilla system.

Thank you in advance.
Comment 1 johnny 2006-11-19 14:04:57 UTC
Now i'm using umbrello 1.5.52 - current svn kde 3.5 branch.

It can save and open the component diagram, BUT it has some *serious* problems about handling artifacts objects - they simply disappear causing inconsistancy in the xmi file.

If you manage to fix this bug I can verify it with svn.

Thank you, regards
Comment 2 Oliver Kellogg 2006-11-19 16:07:26 UTC
SVN commit 606168 by okellogg:

createUMLObject(): Use Model_Utils::convert_OT_MT() when parentPkg is NULL.
BUG:137564


 M  +4 -0      ChangeLog  
 M  +1 -1      VERSION  
 M  +1 -19     umbrello/object_factory.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #606167:606168
@@ -1,3 +1,7 @@
+Version 1.5.6
+* Bugs/wishes from http://bugs.kde.org:
+* Artifacts of a component diagram are wrongly placed in Deployment View folder (137564)
+
 Version 1.5.52
 
 * Fixed segfault in UMLClassifier::checkOperationSignature()
--- branches/KDE/3.5/kdesdk/umbrello/VERSION #606167:606168
@@ -1 +1 @@
-1.5.52
+1.5.6
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/object_factory.cpp #606167:606168
@@ -124,25 +124,7 @@
                            bool solicitNewName /* = true */) {
     UMLDoc *doc = UMLApp::app()->getDocument();
     if (parentPkg == NULL) {
-        Uml::Model_Type mt = Uml::mt_Logical;
-        switch (type) {
-            case Uml::ot_Actor:
-            case Uml::ot_UseCase:
-                mt = Uml::mt_UseCase;
-                break;
-            case Uml::ot_Component:
-                mt = Uml::mt_Component;
-                break;
-            case Uml::ot_Artifact:
-            case Uml::ot_Node:
-                mt = Uml::mt_Deployment;
-                break;
-            case Uml::ot_Entity:
-                mt = Uml::mt_EntityRelationship;
-                break;
-            default:
-                break;
-        }
+        Uml::Model_Type mt = Model_Utils::convert_OT_MT(type);
         kDebug() << "Object_Factory::createUMLObject(" << n << "): "
             << "parentPkg is not set, assuming Model_Type " << mt << endl;
         parentPkg = doc->getRootFolder(mt);
Comment 3 johnny 2006-11-19 17:02:35 UTC
I applied the patch and recompiled - the problem persists.

I opened my diagram and dragged the disappeared artifacts inside the diagram. After save and reload they are still gone.

But wait.. if I create new artifacts they seem to resist after save/reload.

I think that newer versions of umbrello should try to fix errors introduced by previous versions. I don't expect it to recover a broken .xmi file, but if I open a partly corrupted .xmi and fix the things by hand, then save, it should clean up the .xmi file for later usage.

Thanks regards
Comment 4 Oliver Kellogg 2006-11-19 19:07:01 UTC
SVN commit 606237 by okellogg:

acceptDrag(): Accept srcType=lvt_{Artifact,Component_Diagram} also if dstType
 is lvt_Deployment_Folder.
How to use this fix: Drag the artifacts from the Deployment View folder to the
 Component View folder in the list view.
BUG:137564


 M  +2 -1      umllistview.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umllistview.cpp #606236:606237
@@ -1199,7 +1199,8 @@
             break;
         case Uml::lvt_Artifact:
         case Uml::lvt_Component_Diagram:
-            accept = (dstType == Uml::lvt_Component_Folder);
+            accept = (dstType == Uml::lvt_Component_Folder ||
+                      dstType == Uml::lvt_Component_View);
             break;
         case Uml::lvt_Node:
         case Uml::lvt_Deployment_Diagram: