This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 123073 - moving a class diagram and its classes don't move the associations between classes in generated .etd
Summary: moving a class diagram and its classes don't move the associations between cl...
Status: VERIFIED FIXED
Alias: None
Product: uml
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker with 1 vote (vote)
Assignee: Viktor Lapitski
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-29 16:33 UTC by tichadok
Modified: 2008-01-28 18:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
project for reproducing issue (65.12 KB, application/x-compressed)
2008-01-24 00:41 UTC, Peter Lam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tichadok 2007-11-29 16:33:13 UTC
To reproduce the problem, it's very simple:
Create a sample UML project with a sample UML class diagram. Create 2 classes with a association between the two.
Save the project.
Then create a package and move the diagram and its 2 classes into it (using shift select and drag'n'drop in the project
explorer).
Re-save the project.
When you look at the .etd generated you will see that the Associations are still at the root of the project and not in
the package, while the classes it links are in the package.
Comment 1 Sergey Petrov 2007-11-30 06:25:49 UTC
In my opinion it's not an issue, because we may not fully comply with any project persistence specification and use our
own model persistence realization. Did you see any information about uml module specifying format we are using?
Comment 2 tichadok 2007-11-30 09:20:22 UTC
Here is a worse case : if you first create a "package1" with inside a class diagram with 2 classes and an association;
then the associations are inside the package (in the generated .etd file).
When you move the classes and the diagram anywhere else (in another "package2", or at the root of the projet) the
association between classes don't move and stay in the initial "package1".
Because you moved everything away from "package1" you can think it's empty. Because you think it's empty you can delete
it, but then you loose all your links between classes : associations, compositions, navigable, aggregation ... and that
is a big bug.
Comment 3 George Vasick 2007-11-30 16:11:52 UTC
Good catch.  The second part is indeed a big bug.  We'll investigate.

Thanks,
George
Comment 4 George Vasick 2007-11-30 16:28:35 UTC
The UML spec is not completely clear on who the owner of an association should be.  Since an association is an ordered
list of n ends, we think the owner of the association should be the same as the owner of the first end.
Comment 5 Viktor Lapitski 2008-01-18 03:34:25 UTC
fixed. Now association is created in the package-owner 
of first end classifier and it is moved with it as well. 
Comment 6 Peter Lam 2008-01-24 00:40:31 UTC
still persists in the NB 6.1 M1 build.

I have 2 packages,  a class diagram and 2 elements with association in package1,  and I move them to package2.
However the etd file still showing that the association is within package1.  Please see attached project.

-Joanne 
Comment 7 Peter Lam 2008-01-24 00:41:20 UTC
Created attachment 55467 [details]
project for reproducing issue
Comment 8 Viktor Lapitski 2008-01-24 10:47:09 UTC
fixed.
Comment 9 Joanne Lau 2008-01-25 21:11:20 UTC
Fix verified in trunk 20080125143542
Comment 10 Viktor Lapitski 2008-01-25 21:50:57 UTC
integrated into release61-m1 branch
Comment 11 George Vasick 2008-01-26 00:16:22 UTC
Tag: release61-m1
User: lvv     
Date: 2008/01/25 13:50:29

Modified:
   uml/core/src/org/netbeans/modules/uml/core/metamodel/infrastructure/coreinfrastructure/Classifier.java
   uml/core/src/org/netbeans/modules/uml/core/metamodel/core/foundation/Namespace.java
   uml/core/src/org/netbeans/modules/uml/core/metamodel/core/foundation/NamedElement.java

Log:
 Fix for 123073 moving a class diagram and its classes don't move the associations between classes in generated .etd

File Changes:

Directory: /uml/core/src/org/netbeans/modules/uml/core/metamodel/infrastructure/coreinfrastructure/
===================================================================================================

File [changed]: Classifier.java
Url:
http://uml.netbeans.org/source/browse/uml/core/src/org/netbeans/modules/uml/core/metamodel/infrastructure/coreinfrastructure/Classifier.java?r1=1.8&r2=1.8.2.1
Delta lines:  +2 -5
-------------------
--- Classifier.java	18 Jan 2008 03:29:15 -0000	1.8
+++ Classifier.java	25 Jan 2008 21:50:26 -0000	1.8.2.1
@@ -2908,11 +2908,8 @@
 		return retStereo;
 	}
 
-        /**
-         * overrides NamedElement.setNamespace() 
-         * to move Associations as well
-         */
-	public void setNamespace(INamespace space) {
+
+	public void moveAssociatedElements(INamespace space) {
             super.setNamespace(space);
             if (space == null) {
                 return;

Directory: /uml/core/src/org/netbeans/modules/uml/core/metamodel/core/foundation/
=================================================================================

File [changed]: Namespace.java
Url:
http://uml.netbeans.org/source/browse/uml/core/src/org/netbeans/modules/uml/core/metamodel/core/foundation/Namespace.java?r1=1.7&r2=1.7.6.1
Delta lines:  +5 -0
-------------------
--- Namespace.java	15 Oct 2007 21:58:01 -0000	1.7
+++ Namespace.java	25 Jan 2008 21:50:27 -0000	1.7.6.1
@@ -137,6 +137,11 @@
 					}
 					addElement(elem);
 					helper.dispatchElementAddedToNamespace(this, elem);
+                                        
+                                        if (elem instanceof NamedElement) 
+                                        {
+                                            ((NamedElement)elem).moveAssociatedElements(this);
+                                        }
 				}
             
             retVal = true;

File [changed]: NamedElement.java
Url:
http://uml.netbeans.org/source/browse/uml/core/src/org/netbeans/modules/uml/core/metamodel/core/foundation/NamedElement.java?r1=1.5&r2=1.5.8.1
Delta lines:  +7 -0
-------------------
--- NamedElement.java	28 Sep 2007 08:51:08 -0000	1.5
+++ NamedElement.java	25 Jan 2008 21:50:27 -0000	1.5.8.1
@@ -571,6 +571,13 @@
             space.addOwnedElement(this);
 	}
 
+        /**
+         * if there some associated elements that should be 
+         * moved as well. 
+         */ 
+	public void moveAssociatedElements(INamespace space) {
+        }
+
 	/**
 	 *
 	 * Adds this element to the supplier end of a Dependency relationship.




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@uml.netbeans.org
For additional commands, e-mail: cvs-help@uml.netbeans.org

Comment 12 Joanne Lau 2008-01-28 18:47:46 UTC
Fix also verified in M1 build 200801280931