abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r432767 - in /incubator/abdera/java/trunk: core/src/main/java/org/apache/abdera/model/Feed.java parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
Date Fri, 18 Aug 2006 22:59:17 GMT
Author: jmsnell
Date: Fri Aug 18 15:59:16 2006
New Revision: 432767

URL: http://svn.apache.org/viewvc?rev=432767&view=rev
Log:
Adding Feed.getEntry(String id) as suggested by Danny Ayers.

Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java?rev=432767&r1=432766&r2=432767&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java Fri Aug
18 15:59:16 2006
@@ -17,6 +17,7 @@
 */
 package org.apache.abdera.model;
 
+import java.net.URISyntaxException;
 import java.util.Comparator;
 import java.util.List;
 
@@ -137,4 +138,11 @@
    * Sorts entries using the given comparator
    */
   void sortEntries(Comparator<Entry> comparator);
+  
+  /**
+   * Retrieves the first entry in the feed with the given atom:id value
+   * @throws URISyntaxException 
+   */
+  Entry getEntry(String id) throws URISyntaxException;
+  
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java?rev=432767&r1=432766&r2=432767&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
Fri Aug 18 15:59:16 2006
@@ -17,6 +17,8 @@
 */
 package org.apache.abdera.parser.stax;
 
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.Date;
@@ -170,4 +172,13 @@
     }
   };
 
+  public Entry getEntry(String id) throws URISyntaxException {
+    if (id == null) return null;
+    List<Entry> l = getEntries();
+    for (Entry e : l) {
+      URI eid = e.getId();
+      if (eid != null && eid.equals(new URI(id))) return e;
+    }
+    return null;
+  }
 }



Mime
View raw message