svn commit: r15258 - trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: tfmorris
Date: 2008-07-13 12:23:15-0700
New Revision: 15258
Modified:
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java
Log:
Issue 5227: Implemented workaround for MDR bug which causes Guard to not be deleted with owning Transition
Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java?view=diff&rev=15258&p1=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java&p2=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java&r1=15257&r2=15258
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java (original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/StateMachinesFactoryMDRImpl.java 2008-07-13 12:23:15-0700
@@ -605,8 +605,11 @@
}
StateMachine stateMachine = (StateMachine) elem;
- // This code is probably unnecessary since the top is
- // associated by composition
+ // This shouldn't be required since it's a composite, but there's
+ // a bug in the version of MDR that we use (20050711) that causes
+ // it to fail to delete aggregate elements which are single valued
+ // and where the aggregate end is listed second in the association
+ // defined in the metamodel. - tfm 20080713
State top = stateMachine.getTop();
if (top != null) {
modelImpl.getUmlFactory().delete(top);
@@ -685,6 +688,19 @@
if (!(elem instanceof Transition)) {
throw new IllegalArgumentException();
}
+
+ final Transition transition = (Transition) elem;
+ final Guard guard = transition.getGuard();
+ if (guard != null) {
+ // This shouldn't be required since it's a composite, but there's
+ // a bug in the version of MDR that we use (20050711) that causes
+ // it to fail to delete aggregate elements which are single valued
+ // and where the aggregate end is listed second in the association
+ // defined in the metamodel. - tfm 20080713
+ modelImpl.getUmlFactory().delete(guard);
+ }
+
+ // The effect will get deleted automatically by MDR, unlike the Guard.
}
}
Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java?view=diff&rev=15258&p1=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java&p2=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java&r1=15257&r2=15258
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java (original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java 2008-07-13 12:23:15-0700
@@ -960,11 +960,18 @@
Object container = ((RefObject) elem).refImmediateComposite();
if (container == null
|| !elementsToBeDeleted.contains(container)
- // For some reason StateMachine.top doesn't get deleted
- // even though it should because it's a composite
- // see issue 4948
+ // There is a bug in the version of MDR (20050711) that
+ // we use that causes it to fail to delete aggregate
+ // elements which are single valued and where the
+ // aggregate end is listed second in the association
+ // defined in the metamodel. For the UML 1.4 metamodel,
+ // this affects a StateMachine's top StateVertex and
+ // a Transition's Guard. See issue 4948 & 5227 - tfm
+ // 20080713
|| (container instanceof StateMachine
- && elem instanceof StateVertex)) {
+ && elem instanceof StateVertex)
+ || (container instanceof Transition
+ && elem instanceof Guard)) {
elementsInDeletionOrder.add((RefObject) elem);
}
} catch (InvalidObjectException e) {