svn commit: r14732 - trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-05-14 10:02:21-0700
New Revision: 14732

Modified:
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java

Log:
Isse 5084: Enforce aggregation well-formedness - rule #2 

http://argouml.tigris.org/issues/show_bug.cgi?id=5084

Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java?view=diff&rev=14732&p1=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java&p2=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java&r1=14731&r2=14732
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java	(original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java	2008-05-14 10:02:21-0700
@@ -2518,6 +2518,17 @@
             } else {
                 ae.setAggregation(AggregationKindEnum.AK_NONE);
             }
+            // If we made something aggregate, make sure the other ends conform
+            // to UML 1.4 WFR 2.5.3.1 #2 - no more than one aggregate end
+            if (ak == AggregationKindEnum.AK_AGGREGATE
+                    || ak == AggregationKindEnum.AK_COMPOSITE) {
+                for (AssociationEnd end : ae.getAssociation().getConnection()) {
+                    if (!end.equals(ae)
+                            && end.getAggregation() != AggregationKindEnum.AK_NONE) {
+                        end.setAggregation(AggregationKindEnum.AK_NONE);
+                    }
+                }
+            }
             return;
         }
         throw new IllegalArgumentException("handle: " + handle
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.