2006/unicorn/org/w3c/unicorn/tasklist Task.java,1.3,1.4

Update of /sources/public/2006/unicorn/org/w3c/unicorn/tasklist
In directory hutz:/tmp/cvs-serv10640/org/w3c/unicorn/tasklist

Modified Files:
	Task.java 
Log Message:
MimeTypes work again for DirectInput

Index: Task.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/tasklist/Task.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Task.java	2 Sep 2008 13:22:15 -0000	1.3
+++ Task.java	19 Sep 2008 18:57:12 -0000	1.4
@@ -8,6 +8,7 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import javax.activation.MimeType;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -17,6 +18,7 @@
 import org.w3c.unicorn.tasklisttree.TLTIf;
 import org.w3c.unicorn.tasklisttree.TLTNode;
 import org.w3c.unicorn.util.LocalizedString;
+import org.w3c.unicorn.contract.Observer;
 
 /**
  * Task<br />
@@ -283,6 +285,30 @@
 		return this.listOfReference;
 	}
 
+    public List<Observer> getAllObservers() {
+        if(this.getTree() != null) {
+            return this.getTree().getAllObservers();
+        }
+        return new ArrayList<Observer>();
+    }
+
+    // MimeType's equals() doesn't work as expected
+    // so it's easier to store the String representation
+    // of mime types :-/
+    public List<String> getSupportedMimeTypes() {
+        List<String> res = new ArrayList<String>();
+        List<Observer> observers = getAllObservers();
+        for(Observer o : observers) {
+            List<MimeType> mimes = o.getSupportedMimeTypes();
+            for(MimeType m : mimes) {
+                if(!res.contains(m.toString())) {
+                    res.add(m.toString());
+                }
+            }
+        }
+        return res;
+    }
+
 	/**
 	 * Recursively expands this task and referenced ones and merges observations
 	 * and parameters.<br/> If a task A includes a task B that includes a task

Received on Friday, 19 September 2008 18:57:49 UTC