| Summary: | navigable associations aren't deleted properly | ||
|---|---|---|---|
| Product: | [Modeling] MDT.UML2 | Reporter: | Christian Waniek <chris.waniek> |
| Component: | Core | Assignee: | UML2 Inbox <mdt-uml2-inbox> |
| Status: | CLOSED WORKSFORME | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | Kenn.Hussey |
| Version: | unspecified | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 320244 | ||
#101607 might also be influenced by this (or vice versa) to have the link cliackable: bug #101607 This isn't so much a bug as it is missing functionality, i.e., the convenience method for creating an association doesn't have an analog to delete one. Whether bug or not, I think this is something that should be fixed. IMHO it doesn't have to be the job of the user to find and delete Properties which are part of an Association. Although I'm still of another opinion (I think when there's a convenience method, Which works one way, there sould be another one, working the other way), I'll resolve this issue, because I can live with the status quo. Closing for Indigo release. |
Build Identifier: If you create a navigable association between two classes, the source class holds an ownedAttribute, pointing to the target class of the association. So far, everything is correct (in my opinion). But when you delete the association, this ownedAttribute remains in its class. From an EMF-view this is correct, because the metaclass Association has no controll over features of the metaclass Class. But from an UML-view this is a bug. As far as I see the source for this bug is, that an association is created via the Type.createAssociation(...). This calls some custom code which writes the ownedAttribute to the source class. But theres is no equivalent to delete an association, which checks whether one of the associations memeberEnds has an ownedAttribute which refers to this association. I found this bug while fixing some bugs for the UML2 Tools. Reproducible: Always Steps to Reproduce: To reproduce, use the following code-snippet and look at the created file. After this uncomment the commented line, execute again and look at the created uml-file. You'll see, that 'class ONE' still holds an ownedAttribute, which should have been deleted by deleting the association. public static void main(String[] args) { // TODO Auto-generated method stub Package p = UMLFactory.eINSTANCE.createPackage(); p.setName("myPackage"); Class c1 = UMLFactory.eINSTANCE.createClass(); c1.setPackage(p); c1.setName("class ONE"); Class c2 = UMLFactory.eINSTANCE.createClass(); c2.setPackage(p); c2.setName("class TWO"); Association a = c1.createAssociation(true, AggregationKind.NONE_LITERAL, "end1", 0, 1, c1, false, AggregationKind.NONE_LITERAL, "end2", 0, 1); a.setPackage(p); // a.destroy(); ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() .put("uml", new XMLResourceFactoryImpl()); URI fileURI = URI .createFileURI(new File("myUML.uml").getAbsolutePath()); Resource resource = resourceSet.createResource(fileURI); resource.getContents().add(p); try { resource.save(null); } catch (IOException e) { System.out.println("IOException while saving model-instance."); e.printStackTrace(); } }