Author: doll
Date: Mon Aug 25 14:28:39 2008
New Revision: 688889

URL: http://svn.apache.org/viewvc?rev=688889&view=rev
Log:
0.8.1 change
person.dateOfBirth is now birthday
person.timeZone is now utcOffset


Modified:
    incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js
    
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
    
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
    
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java

Modified: 
incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js?rev=688889&r1=688888&r2=688889&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js 
(original)
+++ incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js Mon 
Aug 25 14:28:39 2008
@@ -218,6 +218,7 @@
   var rpc = { method : "people.get" };
   rpc.params = this.translateIdSpec(idSpec);
   if (opt_params['profileDetail']) {
+    this.translateProfileDetails(opt_params['profileDetail']);
     rpc.params.fields = opt_params['profileDetail'];
   }
   if (opt_params['first']) {
@@ -257,6 +258,16 @@
       });
 };
 
+JsonRpcContainer.prototype.translateProfileDetails = function(profileDetails) {
+  for (var i = 0; i < profileDetails.length; i++) {
+    if (profileDetails[i] == 'dateOfBirth') {
+      profileDetails[i] = 'birthday';
+    } else if (profileDetails[i] == 'timeZone') {
+      profileDetails[i] = 'utcOffset';
+    }
+  }
+}
+
 JsonRpcContainer.prototype.createPersonFromJson = function(serverJson) {
   // We need to translate from the new person fields to the old ones
   // TODO(doll): Pull this out into a separate file
@@ -266,6 +277,14 @@
     }
   }
 
+  if (serverJson.birthday) {
+    serverJson.dateOfBirth = serverJson.birthday;
+  }
+
+  if (serverJson.utcOffset) {
+    serverJson.timeZone = serverJson.utcOffset;
+  }
+
   return new JsonPerson(serverJson);
 };
 

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java?rev=688889&r1=688888&r2=688889&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
 Mon Aug 25 14:28:39 2008
@@ -47,7 +47,7 @@
   private List<String> cars;
   private String children;
   private Address currentLocation;
-  private Date dateOfBirth;
+  private Date birthday;
   private Enum<Enum.Drinker> drinker;
   private List<ListField> emails;
   private String ethnicity;
@@ -89,7 +89,7 @@
   private List<String> sports;
   private String status;
   private List<String> tags;
-  private Long timeZone;
+  private Long utcOffset;
   private List<String> turnOffs;
   private List<String> turnOns;
   private List<String> tvShows;
@@ -187,12 +187,12 @@
     this.currentLocation = currentLocation;
   }
 
-  public Date getDateOfBirth() {
-    return dateOfBirth;
+  public Date getBirthday() {
+    return birthday;
   }
 
-  public void setDateOfBirth(Date dateOfBirth) {
-    this.dateOfBirth = dateOfBirth;
+  public void setBirthday(Date birthday) {
+    this.birthday = birthday;
   }
 
   public Enum<Enum.Drinker> getDrinker() {
@@ -523,12 +523,12 @@
     this.tags = tags;
   }
 
-  public Long getTimeZone() {
-    return timeZone;
+  public Long getUtcOffset() {
+    return utcOffset;
   }
 
-  public void setTimeZone(Long timeZone) {
-    this.timeZone = timeZone;
+  public void setUtcOffset(Long utcOffset) {
+    this.utcOffset = utcOffset;
   }
 
   public List<String> getTurnOffs() {

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java?rev=688889&r1=688888&r2=688889&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
 Mon Aug 25 14:28:39 2008
@@ -61,8 +61,7 @@
     CHILDREN("children"),
     /** the json field for currentLocation. */
     CURRENT_LOCATION("currentLocation"),
-    /** the json field for dateOfBirth. */
-    DATE_OF_BIRTH("dateOfBirth"),
+    BIRTHDAY("birthday"),
     /** the json field for drinker. */
     DRINKER("drinker"),
     /** the json field for emails. */
@@ -147,8 +146,7 @@
     TAGS("tags"),
     /** the json field for thumbnailUrl. */
     THUMBNAIL_URL("thumbnailUrl"),
-    /** the json field for timeZone. */
-    TIME_ZONE("timeZone"),
+    UTC_OFFSET("utcOffset"),
     /** the json field for turnOffs. */
     TURN_OFFS("turnOffs"),
     /** the json field for turnOns. */
@@ -364,15 +362,15 @@
    *
    * @return the person's data of birth
    */
-  Date getDateOfBirth();
+  Date getBirthday();
 
   /**
    * Set the person's date of birth, specified as a [EMAIL PROTECTED] Date} 
object. Container support for this
    * field is OPTIONAL.
    *
-   * @param dateOfBirth the person's data of birth
+   * @param birthday the person's data of birth
    */
-  void setDateOfBirth(Date dateOfBirth);
+  void setBirthday(Date birthday);
 
   /**
    * Get the person's drinking status, specified as an [EMAIL PROTECTED] Enum} 
with the enum's key referencing
@@ -980,15 +978,15 @@
    *
    * @return the Person's time zone
    */
-  Long getTimeZone();
+  Long getUtcOffset();
 
   /**
    * Set the Person's time zone, specified as the difference in minutes 
between Greenwich Mean Time
    * (GMT) and the user's local time. Container support for this field is 
OPTIONAL.
    *
-   * @param timeZone the Person's time zone
+   * @param utcOffset the Person's time zone
    */
-  void setTimeZone(Long timeZone);
+  void setUtcOffset(Long utcOffset);
 
   /**
    * Get the person's turn offs. Container support for this field is OPTIONAL.

Modified: 
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java?rev=688889&r1=688888&r2=688889&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java
 Mon Aug 25 14:28:39 2008
@@ -94,7 +94,7 @@
     location.setLongitude(2.29419F);
     canonical.setCurrentLocation(location);
 
-    canonical.setDateOfBirth(new Date());
+    canonical.setBirthday(new Date());
     canonical.setDrinker(new EnumImpl<Enum.Drinker>(Enum.Drinker.SOCIALLY));
     ListField email = new ListFieldImpl("work", "[EMAIL PROTECTED]");
     canonical.setEmails(Lists.newArrayList(email));
@@ -183,7 +183,7 @@
     canonical.setStatus("happy");
     canonical.setTags(Lists.newArrayList("C#", "JSON", "template"));
     canonical.setThumbnailUrl("http://www.example.org/pic/?id=1";);
-    canonical.setTimeZone(-8L);
+    canonical.setUtcOffset(-8L);
     canonical.setTurnOffs(Lists.newArrayList("lack of unit tests", "cabbage"));
     canonical.setTurnOns(Lists.newArrayList("well document code"));
     canonical.setTvShows(Lists.newArrayList("House", "Battlestar Galactica"));
@@ -261,8 +261,8 @@
     assertFloatField(currentLocation, 
canonical.getCurrentLocation().getLongitude(),
         Address.Field.LONGITUDE);
 
-//    assertLongField(result, canonical.getDateOfBirth().getTime(),
-//        Person.Field.DATE_OF_BIRTH);
+//    assertLongField(result, canonical.getBirthday().getTime(),
+//        Person.Field.BIRTHDAY);
 //    assertEnumField(result, canonical.getDrinker(), Person.Field.DRINKER);
 
     JSONArray emailArray = result.getJSONArray(Person.Field.EMAILS.toString());


Reply via email to