Author: lindner
Date: Tue Nov 18 14:26:27 2008
New Revision: 718744

URL: http://svn.apache.org/viewvc?rev=718744&view=rev
Log:
SHINDIG-559 | Add updatedSince support to CollectionOptions

Modified:
    
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java
    
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java
    
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/CollectionOptions.java

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java?rev=718744&r1=718743&r2=718744&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java
 Tue Nov 18 14:26:27 2008
@@ -78,14 +78,7 @@
       throw new IllegalArgumentException("Cannot fetch personIds for multiple 
userIds");
     }
 
-    CollectionOptions options = new CollectionOptions();
-    options.setSortBy(request.getSortBy());
-    options.setSortOrder(request.getSortOrder());
-    options.setFilter(request.getFilterBy());
-    options.setFilterOperation(request.getFilterOperation());
-    options.setFilterValue(request.getFilterValue());
-    options.setFirst(request.getStartIndex());
-    options.setMax(request.getCount());
+    CollectionOptions options = new CollectionOptions(request);
 
     if (userIds.size() == 1) {
       if (optionalPersonId.isEmpty()) {

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java?rev=718744&r1=718743&r2=718744&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java
 Tue Nov 18 14:26:27 2008
@@ -24,11 +24,14 @@
 import org.apache.shindig.social.opensocial.spi.SocialSpiException;
 import org.apache.shindig.social.opensocial.spi.UserId;
 
+import org.joda.time.DateTime;
+
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 import java.util.List;
 import java.util.Set;
+import java.util.Date;
 
 /**
  * Abstract base type for social API requests.
@@ -87,6 +90,17 @@
     }
   }
 
+  public Date getUpdatedSince() {
+    String updatedSince = getParameter("updatedSince");
+    if (updatedSince == null)
+      return null;
+
+    DateTime date = new DateTime(updatedSince);
+    if (date == null) return null;
+
+    return date.toDate();
+  }
+
   public Set<UserId> getUsers() {
     List<String> ids = getListParameter(USER_ID);
     if (ids.isEmpty()) {

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/CollectionOptions.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/CollectionOptions.java?rev=718744&r1=718743&r2=718744&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/CollectionOptions.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/CollectionOptions.java
 Tue Nov 18 14:26:27 2008
@@ -17,7 +17,10 @@
  */
 package org.apache.shindig.social.opensocial.spi;
 
+import java.util.Date;
+
 import org.apache.commons.lang.StringUtils;
+import org.apache.shindig.social.opensocial.service.RequestItem;
 
 public class CollectionOptions {
   private String sortBy;
@@ -27,7 +30,20 @@
   private String filterValue;
   private int first;
   private int max;
+  private Date updatedSince;
+
+  public CollectionOptions() {}
 
+  public CollectionOptions(RequestItem request) {
+    this.sortBy = request.getSortBy();
+    this.sortOrder = request.getSortOrder();
+    this.setFilter(request.getFilterBy());
+    this.setFilterOperation(request.getFilterOperation());
+    this.setFilterValue(request.getFilterValue());
+    this.setFirst(request.getStartIndex());
+    this.setMax(request.getCount());
+    this.setUpdatedSince(request.getUpdatedSince());
+  }
   /**
    * This sortBy can be any field of the object being sorted or the special js 
sort of topFriends.
    * @return The field to sort by
@@ -128,6 +144,15 @@
     this.max = max;
   }
 
+  public Date getUpdatedSince() {
+    return updatedSince;
+  }
+
+  public void setUpdatedSince(Date updatedSince) {
+    this.updatedSince = updatedSince;
+  }
+
+
   // These are overriden so that EasyMock doesn't throw a fit
   @Override
   public boolean equals(Object o) {


Reply via email to