You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by do...@apache.org on 2008/08/25 23:47:16 UTC

svn commit: r688893 - in /incubator/shindig/trunk: features/opensocial-current/ java/social-api/src/main/java/org/apache/shindig/social/core/model/ java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ java/social-api/src/test/java/...

Author: doll
Date: Mon Aug 25 14:47:15 2008
New Revision: 688893

URL: http://svn.apache.org/viewvc?rev=688893&view=rev
Log:
0.8.1 change
the poBox and extendedAddress fields on the address object have been removed. containers should now put that information into streetAddress which can be multiline. 

the address.unstructuredAddress field is now address.formatted. 



Modified:
    incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/AddressImpl.java
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Address.java
    incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java
    incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonConverterTest.java
    incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverterTest.java
    incubator/shindig/trunk/javascript/sampledata/canonicaldb.json

Modified: incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js?rev=688893&r1=688892&r2=688893&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js (original)
+++ incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js Mon Aug 25 14:47:15 2008
@@ -285,6 +285,12 @@
     serverJson.timeZone = serverJson.utcOffset;
   }
 
+  if (serverJson.addresses) {
+    for (var j = 0; j < serverJson.addresses.length; j++) {
+      serverJson.addresses[j].unstructuredAddress = serverJson.addresses[j].formatted;
+    }    
+  }
+
   return new JsonPerson(serverJson);
 };
 

Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/AddressImpl.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/AddressImpl.java?rev=688893&r1=688892&r2=688893&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/AddressImpl.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/AddressImpl.java Mon Aug 25 14:47:15 2008
@@ -22,22 +22,19 @@
 public class AddressImpl implements Address {
 
   private String country;
-  private String extendedAddress;
   private Float latitude;
   private Float longitude;
   private String locality;
-  private String poBox;
   private String postalCode;
   private String region;
   private String streetAddress;
   private String type;
-  private String unstructuredAddress;
+  private String formatted;
 
-  public AddressImpl() {
-  }
+  public AddressImpl() { }
 
-  public AddressImpl(String unstructuredAddress) {
-    this.unstructuredAddress = unstructuredAddress;
+  public AddressImpl(String formatted) {
+    this.formatted = formatted;
   }
 
   public String getCountry() {
@@ -48,14 +45,6 @@
     this.country = country;
   }
 
-  public String getExtendedAddress() {
-    return extendedAddress;
-  }
-
-  public void setExtendedAddress(String extendedAddress) {
-    this.extendedAddress = extendedAddress;
-  }
-
   public Float getLatitude() {
     return latitude;
   }
@@ -80,14 +69,6 @@
     this.longitude = longitude;
   }
 
-  public String getPoBox() {
-    return poBox;
-  }
-
-  public void setPoBox(String poBox) {
-    this.poBox = poBox;
-  }
-
   public String getPostalCode() {
     return postalCode;
   }
@@ -120,12 +101,12 @@
     this.type = type;
   }
 
-  public String getUnstructuredAddress() {
-    return unstructuredAddress;
+  public String getFormatted() {
+    return formatted;
   }
 
-  public void setUnstructuredAddress(String unstructuredAddress) {
-    this.unstructuredAddress = unstructuredAddress;
+  public void setFormatted(String formatted) {
+    this.formatted = formatted;
   }
 
 }

Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Address.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Address.java?rev=688893&r1=688892&r2=688893&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Address.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Address.java Mon Aug 25 14:47:15 2008
@@ -24,7 +24,7 @@
 /**
  * Base interface for all address objects
  * see http://code.google.com/apis/opensocial/docs/0.7/reference/opensocial.Address.Field.html.
- * 
+ *
  */
 @ImplementedBy(AddressImpl.class)
 public interface Address {
@@ -33,28 +33,16 @@
    * The fields that represent the address object ion json form.
    */
   public static enum Field {
-    /** the json field for country. */
     COUNTRY("country"),
-    /** the json field for extendedAddress. */
-    EXTENDED_ADDRESS("extendedAddress"),
-    /** the json field for latitude. */
     LATITUDE("latitude"),
-    /** the json field for locality. */
     LOCALITY("locality"),
-    /** the json field for longitude. */
     LONGITUDE("longitude"),
-    /** the json field for poBox. */
-    PO_BOX("poBox"),
-    /** the json field for postalCode. */
     POSTAL_CODE("postalCode"),
-    /** the json field for region. */
     REGION("region"),
-    /** the json field for streetAddress. */
+    /** this field may be multiple lines */
     STREET_ADDRESS("streetAddress"),
-    /** the json field for type. */
     TYPE("type"),
-    /** the json field for unstructuredAddress. */
-    UNSTRUCTURED_ADDRESS("unstructuredAddress");
+    FORMATTED("formatted");
 
     /**
      * The json field that the instance represents.
@@ -82,160 +70,128 @@
   }
 
   /**
-   * Get the country. Container support for this field is REQUIRED.
+   * Get the country.
    *
    * @return the country
    */
   String getCountry();
 
   /**
-   * Set the country. Container support for this field is REQUIRED.
+   * Set the country.
    *
    * @param country the country
    */
   void setCountry(String country);
 
   /**
-   * Get the extended street address. Container support for this field is REQUIRED.
-   *
-   * @return the extended street address
-   */
-  String getExtendedAddress();
-
-  /**
-   * Set the extended street address. Container support for this field is REQUIRED.
-   *
-   * @param extendedAddress the extended street address
-   */
-  void setExtendedAddress(String extendedAddress);
-
-  /**
-   * Get the latitude. Container support for this field is REQUIRED.
+   * Get the latitude.
    *
    * @return latitude
    */
   Float getLatitude();
 
   /**
-   * Set the latitude. Container support for this field is REQUIRED.
+   * Set the latitude.
    *
    * @param latitude latitude
    */
   void setLatitude(Float latitude);
 
   /**
-   * Get the locality. Container support for this field is REQUIRED.
+   * Get the locality.
    *
    * @return the locality
    */
   String getLocality();
 
   /**
-   * Set the locality. Container support for this field is REQUIRED.
+   * Set the locality.
    *
    * @param locality the locality
    */
   void setLocality(String locality);
 
   /**
-   * Get the longitude of the address in degrees. Container support for this field is REQUIRED.
+   * Get the longitude of the address in degrees.
    *
    * @return the longitude of the address in degrees
    */
   Float getLongitude();
 
   /**
-   * Set the longitude of the address in degrees. Container support for this field is REQUIRED.
+   * Set the longitude of the address in degrees.
    *
    * @param longitude the longitude of the address in degrees.
    */
   void setLongitude(Float longitude);
 
   /**
-   * Get the P O box. Container support for this field is REQUIRED.
-   *
-   * @return the PO box
-   */
-  String getPoBox();
-
-  /**
-   * Set the PO box. Container support for this field is REQUIRED.
-   *
-   * @param poBox the PO box
-   */
-  void setPoBox(String poBox);
-
-  /**
-   * Get the Postal code for the address. Container support for this field is REQUIRED.
+   * Get the Postal code for the address.
    *
    * @return the postal code for the address
    */
   String getPostalCode();
 
   /**
-   * Set the postal code for the address. Container support for this field is REQUIRED.
+   * Set the postal code for the address.
    *
    * @param postalCode the postal code
    */
   void setPostalCode(String postalCode);
 
   /**
-   * Get the region. Container support for this field is REQUIRED.
+   * Get the region.
    *
    * @return the region
    */
   String getRegion();
 
   /**
-   * Set the region. Container support for this field is REQUIRED.
+   * Set the region.
    *
    * @param region the region
    */
   void setRegion(String region);
 
   /**
-   * Get the street address. Container support for this field is REQUIRED.
+   * Get the street address.
    *
    * @return the street address
    */
   String getStreetAddress();
 
   /**
-   * Set the street address. Container support for this field is REQUIRED.
+   * Set the street address.
    *
    * @param streetAddress the street address
    */
   void setStreetAddress(String streetAddress);
 
   /**
-   * Get the type of label of the address. Container support for this field is REQUIRED.
+   * Get the type of label of the address.
    *
    * @return the type or label of the address
    */
   String getType();
 
   /**
-   * Get the type of label of the address. Container support for this field is REQUIRED.
+   * Get the type of label of the address.
    *
    * @param type the type of label of the address.
    */
   void setType(String type);
 
   /**
-   * Get the unstructured address. If the container does not have structured addresses in its data
-   * store, this field contains the unstructured address that the user entered, specified as a
-   * string. Container support for this field is REQUIRED.
+   * Get the formatted address.
    *
-   * @return
+   * @return the formatted address
    */
-  String getUnstructuredAddress();
+  String getFormatted();
 
   /**
-   * Set the unstructured address. If the container does not have structured addresses in its data
-   * store, this field contains the unstructured address that the user entered, specified as a
-   * string. Container support for this field is REQUIRED.
+   * Set the formatted address.
    *
-   * @param unstructuredAddress the unstructured address
+   * @param formatted the formatted address
    */
-  void setUnstructuredAddress(String unstructuredAddress);
+  void setFormatted(String formatted);
 }

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=688893&r1=688892&r2=688893&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:47:15 2008
@@ -66,15 +66,14 @@
 
     Address address = new AddressImpl("PoBox 3565, 1 OpenStandards Way, Apache, CA");
     address.setCountry("US");
-    address.setExtendedAddress("Next door");
     address.setLatitude(28.3043F);
     address.setLongitude(143.0859F);
     address.setLocality("who knows");
-    address.setPoBox("3653");
     address.setPostalCode("12345");
     address.setRegion("Apache, CA");
     address.setStreetAddress("1 OpenStandards Way");
     address.setType("home");
+    address.setFormatted("PoBox 3565, 1 OpenStandards Way, Apache, CA");
     canonical.setAddresses(Lists.newArrayList(address));
 
     canonical.setAge(33);
@@ -365,20 +364,17 @@
       throws JSONException {
     assertStringField(actual, expected.getCountry(),
         Address.Field.COUNTRY);
-    assertStringField(actual, expected.getExtendedAddress(),
-        Address.Field.EXTENDED_ADDRESS);
     assertFloatField(actual, expected.getLatitude(), Address.Field.LATITUDE);
     assertStringField(actual, expected.getLocality(), Address.Field.LOCALITY);
     assertFloatField(actual, expected.getLongitude(), Address.Field.LONGITUDE);
-    assertStringField(actual, expected.getPoBox(), Address.Field.PO_BOX);
     assertStringField(actual, expected.getPostalCode(),
         Address.Field.POSTAL_CODE);
     assertStringField(actual, expected.getRegion(), Address.Field.REGION);
     assertStringField(actual, expected.getStreetAddress(),
         Address.Field.STREET_ADDRESS);
     assertStringField(actual, expected.getType(), Address.Field.TYPE);
-    assertStringField(actual, expected.getUnstructuredAddress(),
-        Address.Field.UNSTRUCTURED_ADDRESS);
+    assertStringField(actual, expected.getFormatted(),
+        Address.Field.FORMATTED);
   }
 
   private void assertUrlField(Url expected, JSONObject actual)
@@ -391,7 +387,7 @@
   private void assertOrganizationField(Organization expected, JSONObject actual)
       throws JSONException {
     assertStringField(actual.getJSONObject(Organization.Field.ADDRESS.toString()),
-        expected.getAddress().getUnstructuredAddress(), Address.Field.UNSTRUCTURED_ADDRESS);
+        expected.getAddress().getFormatted(), Address.Field.FORMATTED);
     assertStringField(actual, expected.getDescription(),
         Organization.Field.DESCRIPTION);
 //    assertDateField(actual, expected.getEndDate(), Organization.Field.END_DATE);

Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonConverterTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonConverterTest.java?rev=688893&r1=688892&r2=688893&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonConverterTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonConverterTest.java Mon Aug 25 14:47:15 2008
@@ -101,9 +101,9 @@
     assertEquals(johnDoe.getName().getUnstructured(),
         result.getJSONObject("name").getString("unstructured"));
 
-    assertEquals(johnDoe.getAddresses().get(0).getUnstructuredAddress(),
+    assertEquals(johnDoe.getAddresses().get(0).getFormatted(),
         result.getJSONArray("addresses").getJSONObject(0)
-            .getString("unstructuredAddress"));
+            .getString("formatted"));
 
     JSONArray phoneArray = result.getJSONArray("phoneNumbers");
     assertEquals(3, phoneArray.length());

Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverterTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverterTest.java?rev=688893&r1=688892&r2=688893&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverterTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverterTest.java Mon Aug 25 14:47:15 2008
@@ -211,11 +211,11 @@
 
     assertEquals(1, addresses.size());
     Address address = addresses.get(0);
-    String unstructured = address.getUnstructuredAddress();
+    String unstructured = address.getFormatted();
 
     assertNotNull(unstructured);
-    assertEquals(johnDoe.getAddresses().get(0).getUnstructuredAddress(), parsedPerson
-        .getAddresses().get(0).getUnstructuredAddress());
+    assertEquals(johnDoe.getAddresses().get(0).getFormatted(), parsedPerson
+        .getAddresses().get(0).getFormatted());
 
     assertEquals(3, parsedPerson.getPhoneNumbers().size());
 

Modified: incubator/shindig/trunk/javascript/sampledata/canonicaldb.json
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/sampledata/canonicaldb.json?rev=688893&r1=688892&r2=688893&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/sampledata/canonicaldb.json (original)
+++ incubator/shindig/trunk/javascript/sampledata/canonicaldb.json Mon Aug 25 14:47:15 2008
@@ -28,16 +28,14 @@
 "activities" : ["Coding Shindig"],
 "addresses" : [{
 "country" : "US",
-"extendedAddress" : "Next door",
 "latitude" : "28.3043",
 "longitude" : "143.0859",
 "locality" : "who knows",
-"poBox" : "3653",
 "postalCode" : "12345",
 "region" : "Apache, CA",
 "streetAddress" : "1 OpenStandards Way",
 "type" : "home",
-"unstructuredAddress" : "PoBox 3565, 1 OpenStandards Way, Apache, CA"
+"formatted" : "PoBox 3565, 1 OpenStandards Way, Apache, CA"
 }],
 "age" : 33,
 "bodyType" : {
@@ -54,7 +52,7 @@
 "latitude" : "48.858193",
 "longitude" : "2.29419"
 },
-"dateOfBirth" : "1975-01-01",
+"birthday" : "1975-01-01",
 "drinker" : {
 "key" : "SOCIALLY",
 "displayValue" : "Socially"
@@ -78,7 +76,7 @@
 "jobInterests" : "will work for beer",
 "jobs" : [{
 "address" : {
-"unstructuredAddress" : "1 Shindig Drive"
+"formatted" : "1 Shindig Drive"
 },
 "description" : "lots of coding",
 "endDate" : "2010-10-10",
@@ -91,7 +89,7 @@
 "webpage" : "http://incubator.apache.org/projects/shindig.html"
 },{
 "address" : {
-"unstructuredAddress" : "1 Skid Row"
+"formatted" : "1 Skid Row"
 },
 "description" : "",
 "endDate" : "1995-01-01",
@@ -152,7 +150,7 @@
 "scaredOf" : "COBOL",
 "schools" : [{
 "address" : {
-"unstructuredAddress" : "1 Edu St."
+"formatted" : "1 Edu St."
 },
 "description" : "High School",
 "endDate" : "1991-01-01",
@@ -173,7 +171,7 @@
 "status" : "happy",
 "tags" : ["C#","JSON","template"],
 "thumbnailUrl" : "http://www.example.org/pic/?id=1",
-"timeZone" : "-8",
+"utcOffset" : "-8",
 "turnOffs" : ["lack of unit tests","cabbage"],
 "turnOns" : ["well document code"],
 "tvShows" : ["House","Battlestar Galactica"],