svn commit: r19044 - trunk/src: argouml-core-model-euml/src/org/argouml/model/euml argouml-core-model-mdr/src/org/argouml/model/mdr argouml-core-model/src/org/argouml/model

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2011-02-21 14:27:14-0800
New Revision: 19044

Modified:
   trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java
   trunk/src/argouml-core-model/src/org/argouml/model/Facade.java

Log:
UML2: new method getValueOfTag (needs another parameter)

Modified: trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java?view=diff&pathrev=19044&r1=19043&r2=19044
==============================================================================
--- trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java	(original)
+++ trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java	2011-02-21 14:27:14-0800
@@ -1522,16 +1522,19 @@
         Element elem = (Element) handle;
         List result = new ArrayList();
         
-        for (EObject sta : elem.getStereotypeApplications()) {
-            Iterator<EObject> iter = sta.eAllContents();
-            while (iter.hasNext()) {
-                EObject o = iter.next();
-                if (o instanceof EStructuralFeature) {
-                    result.add(o);
+        for (Stereotype st : elem.getAppliedStereotypes()) {
+            for (Property p : st.getAttributes()) {
+                Object v = UMLUtil.getTaggedValue(elem, st.getQualifiedName(), p.getName());
+                if (v != null && v != handle) {
+                    if (v instanceof Collection) {
+                        for (Object o : (Collection) v) {
+                            result.add(p);
+                        }
+                    } else {
+                        result.add(p);
+                    }
                 }
             }
-            //elem.isStereotypeApplied(stereotype);
-            //elem.setValue(stereotype, propertyName, newValue);
         }
         return result;
     }
@@ -1646,7 +1649,21 @@
     }
 
     public String getValueOfTag(Object handle) {
-        return null;
+        throw new NotYetImplementedException();
+    }
+
+    public Object getValueOfTag(Object handle, Object property) {
+        if (!(handle instanceof Element)) {
+            return null;
+        }
+        if (!(property instanceof Property)) {
+            return null;
+        }
+        Element elem = (Element) handle;
+        Property prop = (Property) property;
+        Stereotype stereotype = (Stereotype) prop.eContainer();
+        return UMLUtil.getTaggedValue(elem, stereotype.getQualifiedName(),
+                prop.getName());
     }
 
     public VisibilityKind getVisibility(Object handle) {

Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java?view=diff&pathrev=19044&r1=19043&r2=19044
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java	(original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java	2011-02-21 14:27:14-0800
@@ -4124,7 +4124,10 @@
         }
         return illegalArgumentString(handle);
     }
-    
+
+    public Object getValueOfTag(Object handle, Object property) {
+        throw new NotImplementedException();
+    }
 
     public Collection getReferenceValue(Object taggedValue) {
         try {

Modified: trunk/src/argouml-core-model/src/org/argouml/model/Facade.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/src/org/argouml/model/Facade.java?view=diff&pathrev=19044&r1=19043&r2=19044
==============================================================================
--- trunk/src/argouml-core-model/src/org/argouml/model/Facade.java	(original)
+++ trunk/src/argouml-core-model/src/org/argouml/model/Facade.java	2011-02-21 14:27:14-0800
@@ -3157,7 +3157,7 @@
     Object getValue(Object handle);
 
     /**
-     * Return the value of some tagged value.
+     * Return the value of some tagged value. UML1 only.
      *
      * @param handle The tagged value.
      * @return The found value as String.
@@ -3165,6 +3165,16 @@
     String getValueOfTag(Object handle);
 
     /**
+     * Return the value of some tagged value. The value can be an object or a
+     * List, depending on the multiplicity of the property.
+     *
+     * @param handle The owning element.
+     * @param property The property (tagged value).
+     * @return The found value as Object or List.
+     */
+    Object getValueOfTag(Object handle, Object property);
+
+    /**
      * Return the referenceValue collection for a taggedValue.
      * 
      * @param taggedValue the tagged value to read from

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2706346

To unsubscribe from this discussion, e-mail: [[email protected]].
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.