svn commit: r17124 - 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

Thomas Neustupny <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2009-04-24 00:23:51-0700
New Revision: 17124

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: raised exceptions and some other needed stuff for UML2 operations

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=17124&r1=17123&r2=17124
==============================================================================
--- 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	2009-04-24 00:23:51-0700
@@ -489,7 +489,10 @@
     }
 
     public Object getConcurrency(Object handle) {
-        throw new NotYetImplementedException();
+        if (!(handle instanceof BehavioralFeature)) {
+            throw new IllegalArgumentException("handle must be a BehavioralFeature!");
+        }
+        return ((BehavioralFeature)handle).getConcurrency();
     }
 
     public Object getCondition(Object handle) {
@@ -772,7 +775,14 @@
     }
 
     public Collection getInteractions(Object handle) {
-        throw new NotYetImplementedException();
+        
+        // Comment by A- Rueckert: I don't think it makes much sense to query interactions
+        // from a Collaboration in UML2, since this diagram does no longer exist and 
+        // an Interaction means something different in UML2.
+        if (!(handle instanceof Collaboration)) {
+            throw new IllegalArgumentException("handle has to be a Collaboration!");
+        }
+        return ((Collaboration)handle).getCollaborationRoles();
     }
 
     public Collection getInternalTransitions(Object handle) {
@@ -819,6 +829,10 @@
     }
 
     public Collection getMethods(Object handle) {
+        if (handle instanceof BehavioralFeature) {
+            return ((BehavioralFeature)handle).getMethods();
+        }
+        // there's more to be handled, which still need to be implemented:
         throw new NotYetImplementedException();
     }
 
@@ -1075,6 +1089,13 @@
     public Collection getRaisedSignals(Object handle) {
         throw new NotYetImplementedException();
     }
+    
+    public Collection getRaisedExceptions( Object handle) {
+        if (handle instanceof Operation) {
+            return ((Operation)handle).getRaisedExceptions();
+        }
+        return null;
+    }
 
     public Collection getReceivedMessages(Object handle) {
         throw new NotYetImplementedException();
@@ -1107,11 +1128,26 @@
     }
 
     public Object getRepresentedClassifier(Object handle) {
-        throw new NotYetImplementedException();
+        
+        // Comment by A. Rueckert <[email protected]> :
+        // I think, the handle holding the collaboration implementation, should
+        // rather be a CollaborationUse in UML2. 
+        // But as a workaround for now, I'll try to get a Collaboration representation
+        // (CollaborationUse) and then try to get the owning Classifier from there...
+        if (!(handle instanceof Collaboration)) {
+            throw new IllegalArgumentException("handle should be a Collaboration!"); //$NON-NLS-<n>$ 
+        }
+        CollaborationUse collabUse = ((Collaboration)handle).getRepresentation();
+        
+        return collabUse == null ? null : collabUse.getOwner();
     }
 
     public Object getRepresentedOperation(Object handle) {
-        throw new NotYetImplementedException();
+        
+        if (!(handle instanceof Collaboration)) {
+            throw new IllegalArgumentException("handle should be a Collaboration!"); //$NON-NLS-<n>$
+        }
+        return ((Collaboration)handle).getOperation(null,null,null);
     }
 
     public Object getResident(Object handle) {
@@ -1175,8 +1211,16 @@
     }
 
     public String getSpecification(Object handle) {
+        // TODO: The UML2 spec provides a specification for Behavior, which
+        // is a BehavioralFeature, but ArgoUML calls this for an Operation
+        // instance, so we must check what this method is intended for (bug?).
+        if( handle instanceof Behavior) {
+            return ((Behavior)handle).getSpecification().getName();
+        }
+        if( handle instanceof Operation) {
+            return null;
+        }
         throw new NotYetImplementedException();
-
     }
 
     public Collection getSpecifications(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=17124&r1=17123&r2=17124
==============================================================================
--- 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	2009-04-24 00:23:51-0700
@@ -45,6 +45,7 @@
 import org.argouml.model.CoreFactory;
 import org.argouml.model.Facade;
 import org.argouml.model.InvalidElementException;
+import org.argouml.model.NotImplementedException;
 import org.omg.uml.behavioralelements.activitygraphs.ActionState;
 import org.omg.uml.behavioralelements.activitygraphs.ActivityGraph;
 import org.omg.uml.behavioralelements.activitygraphs.CallState;
@@ -2983,6 +2984,17 @@
         }
         return illegalArgumentCollection(handle);
     }
+    
+    /**
+     * Dummy method for UML 1.x 
+     * 
+     * @author Andreas Rueckert <[email protected]>
+     * 
+     * @see org.argouml.model.Facade#getRaisedExceptions(java.lang.Object)
+     */
+    public Collection getRaisedExceptions(Object handle) {
+        throw new NotImplementedException("There are no exceptions in UML 1.x operations");
+    }
 
 
     public Collection getReceptions(Object handle) {

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=17124&r1=17123&r2=17124
==============================================================================
--- trunk/src/argouml-core-model/src/org/argouml/model/Facade.java	(original)
+++ trunk/src/argouml-core-model/src/org/argouml/model/Facade.java	2009-04-24 00:23:51-0700
@@ -2432,6 +2432,14 @@
      * @return raised signals
      */
     Collection getRaisedSignals(Object handle);
+    
+    /**
+     *  Return the raised exceptions of an operation (UML 2 only).
+     *  
+     *  @param handle the operation
+     *  @return raised exceptions
+     */
+    Collection getRaisedExceptions(Object handle);
 
     /**
      * Return the receptions of a signal.

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

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.