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/03/06 16:44:29 UTC

svn commit: r634312 - in /incubator/shindig/trunk: java/gadgets/src/main/java/org/apache/shindig/social/ java/gadgets/src/main/java/org/apache/shindig/social/file/ java/gadgets/src/test/java/org/apache/shindig/social/ javascript/samplecontainer/

Author: doll
Date: Thu Mar  6 07:44:28 2008
New Revision: 634312

URL: http://svn.apache.org/viewvc?rev=634312&view=rev
Log:
Patch from SHINDIG-79 created by Vincent Demay:

- Flushed out the person object and some of its fields, phone, address, name etc
- Added an AbstractSocialData class which converts a pojo to a json object automatically. 

- I also added a phone field in the basic state file to show entirely new objects working without modification.
 


Added:
    incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/AbstractSocialData.java
    incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Address.java
    incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/BodyType.java
    incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Mandatory.java
    incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Phone.java
    incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/social/
    incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/social/PersonTest.java
Modified:
    incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Name.java
    incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Person.java
    incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/file/BasicPeopleHandler.java
    incubator/shindig/trunk/javascript/samplecontainer/state-basicfriendlist.xml

Added: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/AbstractSocialData.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/AbstractSocialData.java?rev=634312&view=auto
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/AbstractSocialData.java (added)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/AbstractSocialData.java Thu Mar  6 07:44:28 2008
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.social;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Autoconvert a pojo in a JSONObject If a value is set to null will not be
+ * added in the JsonObject expect if the annotation {@link Mandatory} has been
+ *
+ * @author Vincent Demay
+ *
+ */
+public abstract class AbstractSocialData {
+
+  private static final Class[] EMPTY_PARAM = {};
+  private static final Object[] EMPTY_OBJECT = {};
+
+  /**
+   * Convert this object to {@link JSONObject} reading Pojo properties
+   *
+   * @return A JSONObject representing this pojo
+   */
+  public JSONObject toJson() {
+    JSONObject toReturn = new JSONObject();
+    Field[] fields = this.getClass().getDeclaredFields();
+    for (Field field : fields) {
+      String errorMessage = "Could not encode the " + field + " field.";
+      try {
+        putAttribute(toReturn, field,
+            field.getAnnotation(Mandatory.class) != null);
+      } catch (JSONException e) {
+        throw new RuntimeException(errorMessage, e);
+      } catch (IllegalAccessException e) {
+        throw new RuntimeException(errorMessage, e);
+      } catch (InvocationTargetException e) {
+        throw new RuntimeException(errorMessage, e);
+      } catch (NoSuchMethodException e) {
+        throw new RuntimeException(errorMessage, e);
+      }
+    }
+    return toReturn;
+  }
+
+  /**
+   * Convert java declared attritiue and its value to an entry in the given
+   * {@link JSONObject}
+   *
+   * @param object the json object to put the field value in
+   * @param field the field to encode
+   * @param mandatory true if the field is mandatory
+   * @throws IllegalArgumentException
+   * @throws JSONException
+   * @throws IllegalAccessException
+   * @throws NoSuchMethodException
+   * @throws InvocationTargetException
+   * @throws SecurityException
+   */
+  private void putAttribute(JSONObject object, Field field, boolean mandatory)
+      throws IllegalArgumentException, JSONException, IllegalAccessException,
+      SecurityException, InvocationTargetException, NoSuchMethodException {
+    String getterName = field.getName();
+    getterName = "get" + getterName.substring(0, 1).toUpperCase()
+        + getterName.substring(1, getterName.length());
+    Object val = this.getClass().getMethod(getterName, EMPTY_PARAM).invoke(
+        this, EMPTY_OBJECT);
+    String name = field.getName();
+    if (val != null) {
+      if (val instanceof AbstractSocialData[]) {
+        JSONArray array = new JSONArray();
+        for (AbstractSocialData asd : (AbstractSocialData[]) val) {
+          array.put(asd.toJson());
+        }
+        val = array;
+      } else if (val instanceof AbstractSocialData) {
+        // get json object
+        val = ((AbstractSocialData) val).toJson();
+      }
+      object.put(name, val);
+    } else {
+      if (mandatory) {
+        throw new RuntimeException(name
+            + " is a mandory value, it should not be null");
+      }
+    }
+  }
+}

Added: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Address.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Address.java?rev=634312&view=auto
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Address.java (added)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Address.java Thu Mar  6 07:44:28 2008
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.social;
+
+/**
+ * see
+ * http://code.google.com/apis/opensocial/docs/0.7/reference/opensocial.Address.Field.html
+ *
+ */
+public class Address extends AbstractSocialData {
+  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;
+
+  public Address(String unstructuredAddress) {
+    this.unstructuredAddress = unstructuredAddress;
+  }
+
+  public String getCountry() {
+    return country;
+  }
+
+  public void setCountry(String country) {
+    this.country = country;
+  }
+
+  public String getExtendedAddress() {
+    return extendedAddress;
+  }
+
+  public void setExtendedAddress(String extendedAddress) {
+    this.extendedAddress = extendedAddress;
+  }
+
+  public Float getLatitude() {
+    return latitude;
+  }
+
+  public void setLatitude(Float latitude) {
+    this.latitude = latitude;
+  }
+
+  public String getLocality() {
+    return locality;
+  }
+
+  public void setLocality(String locality) {
+    this.locality = locality;
+  }
+
+  public Float getLongitude() {
+    return longitude;
+  }
+
+  public void setLongitude(Float longitude) {
+    this.longitude = longitude;
+  }
+
+  public String getPoBox() {
+    return poBox;
+  }
+
+  public void setPoBox(String poBox) {
+    this.poBox = poBox;
+  }
+
+  public String getPostalCode() {
+    return postalCode;
+  }
+
+  public void setPostalCode(String postalCode) {
+    this.postalCode = postalCode;
+  }
+
+  public String getRegion() {
+    return region;
+  }
+
+  public void setRegion(String region) {
+    this.region = region;
+  }
+
+  public String getStreetAddress() {
+    return streetAddress;
+  }
+
+  public void setStreetAddress(String streetAddress) {
+    this.streetAddress = streetAddress;
+  }
+
+  public String getType() {
+    return type;
+  }
+
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  public String getUnstructuredAddress() {
+    return unstructuredAddress;
+  }
+
+  public void setUnstructuredAddress(String unstructuredAddress) {
+    this.unstructuredAddress = unstructuredAddress;
+  }
+
+}

Added: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/BodyType.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/BodyType.java?rev=634312&view=auto
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/BodyType.java (added)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/BodyType.java Thu Mar  6 07:44:28 2008
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.social;
+
+/**
+ * see
+ * http://code.google.com/apis/opensocial/docs/0.7/reference/opensocial.BodyType.Field.html
+ *
+ */
+public class BodyType extends AbstractSocialData {
+  private String build;
+  private String eyeColor;
+  private String hairColor;
+  private String height;
+  private String weight;
+
+  public String getBuild() {
+    return build;
+  }
+
+  public void setBuild(String build) {
+    this.build = build;
+  }
+
+  public String getEyeColor() {
+    return eyeColor;
+  }
+
+  public void setEyeColor(String eyeColor) {
+    this.eyeColor = eyeColor;
+  }
+
+  public String getHairColor() {
+    return hairColor;
+  }
+
+  public void setHairColor(String hairColor) {
+    this.hairColor = hairColor;
+  }
+
+  public String getHeight() {
+    return height;
+  }
+
+  public void setHeight(String height) {
+    this.height = height;
+  }
+
+  public String getWeight() {
+    return weight;
+  }
+
+  public void setWeight(String weight) {
+    this.weight = weight;
+  }
+}

Added: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Mandatory.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Mandatory.java?rev=634312&view=auto
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Mandatory.java (added)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Mandatory.java Thu Mar  6 07:44:28 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.social;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(value=RetentionPolicy.RUNTIME)
+public @interface Mandatory {
+}
+

Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Name.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Name.java?rev=634312&r1=634311&r2=634312&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Name.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Name.java Thu Mar  6 07:44:28 2008
@@ -17,25 +17,68 @@
  */
 package org.apache.shindig.social;
 
-public class Name {
-  String unstructured;
+/**
+ * see
+ * http://code.google.com/apis/opensocial/docs/0.7/reference/opensocial.Name.Field.html
+ *
+ */
+public class Name extends AbstractSocialData {
+  private String additionalName;
+  private String familyName;
+  private String givenName;
+  private String honorificPrefix;
+  private String honorificSuffix;
+  private String unstructured;
 
   public Name(String unstructured) {
     this.unstructured = unstructured;
   }
 
-  // TODO: Use an auto translator
-  public String toJson() {
-    return "{"
-        + "\"unstructured\" : \"" + unstructured + "\""
-        + "}";
-  }
-
   public String getUnstructured() {
     return unstructured;
   }
 
   public void setUnstructured(String unstructured) {
     this.unstructured = unstructured;
+  }
+
+  public String getAdditionalName() {
+    return additionalName;
+  }
+
+  public void setAdditionalName(String additionalName) {
+    this.additionalName = additionalName;
+  }
+
+  public String getFamilyName() {
+    return familyName;
+  }
+
+  public void setFamilyName(String familyName) {
+    this.familyName = familyName;
+  }
+
+  public String getGivenName() {
+    return givenName;
+  }
+
+  public void setGivenName(String givenName) {
+    this.givenName = givenName;
+  }
+
+  public String getHonorificPrefix() {
+    return honorificPrefix;
+  }
+
+  public void setHonorificPrefix(String honorificPrefix) {
+    this.honorificPrefix = honorificPrefix;
+  }
+
+  public String getHonorificSuffix() {
+    return honorificSuffix;
+  }
+
+  public void setHonorificSuffix(String honorificSuffix) {
+    this.honorificSuffix = honorificSuffix;
   }
 }

Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Person.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Person.java?rev=634312&r1=634311&r2=634312&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Person.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Person.java Thu Mar  6 07:44:28 2008
@@ -17,25 +17,207 @@
  */
 package org.apache.shindig.social;
 
-public class Person {
-  String id;
-  Name name;
-  String thumbnailUrl;
-  String profileUrl;
+import java.util.Date;
+
+/**
+ * see
+ * http://code.google.com/apis/opensocial/docs/0.7/reference/opensocial.Person.Field.html
+ *
+ */
+public class Person extends AbstractSocialData{
+  // TODO: Create the rest of the person fields and objects
+  // TODO: Change all of the array objects to list objects for easier
+  // manipulation
+  private String aboutMe;
+  private String[] activities;
+  private Address[] addresses;
+  private Integer age;
+  private BodyType bodyType;
+  private String[] books;
+  private String[] cars;
+  private String children;
+  private Address currentLocation;
+  private Date dateOfBirth;
+  // drinker : Person's drinking status, specified as an opensocial.Enum with
+  // the enum's key referencing opensocial.Enum.Drinker.
+  // emails :Emails associated with the person, specified as an Array of Emails.
+  private String ethnicity;
+  private String fashion;
+  private String[] food;
+  // gender : Person's gender, specified as an opensocial.Enum with the enum's
+  // key referencing opensocial.Enum.Gender.
+  private String happiestWhen;
+  private String[] hereos;
+  private String humor;
+  @Mandatory private String id;
+  private String[] interests;
+  private String jobInterests;
+  // private Organization[] jobs;
+  private String[] languagesSpoken;
+  private String livingArrangement;
+  // lookingFor : Person's statement about who or what they are looking for, or
+  // what they are interested in meeting people for.
+  private String[] movies;
+  private String[] music;
+  @Mandatory private Name name;
+  private String nickname;
+  private String pets;
+  private Phone[] phoneNumbers;
+  private String politicalViews;
+  // private Url profileSong
+  private String profileUrl;
+  // private Url profileVideo
+  private String[] quotes;
+  private String relationshipStatus;
+  private String religion;
+  private String romance;
+  private String scaredOf;
+  // private Organization[] schools;
+  private String sexualOrientation;
+  // smoker Person's smoking status, specified as an opensocial.Enum with the
+  // enum's key referencing opensocial.Enum.Smoker.
+  private String[] sports;
+  private String status;
+  private String[] tags;
+  private String thumbnailUrl;
+  // time_zone Person's time zone, specified as the difference in minutes
+  // between Greenwich Mean Time (GMT) and the user's local time.
+  private String[] turnOffs;
+  private String[] turnOns;
+  private String[] tvShows;
+  // private Url[] urls;
 
   public Person(String id, Name name) {
     this.id = id;
     this.name = name;
   }
 
-  // TODO: Use an auto translator
-  public String toJson() {
-    return "{"
-        + "\"id\" : \"" + id + "\", "
-        + "\"name\" : " + name.toJson() + ", "
-        + "\"thumbnailUrl\" : \"" + thumbnailUrl + "\", "
-        + "\"profileUrl\" : \"" + profileUrl + "\""
-        + "}";
+  public String getAboutMe() {
+    return aboutMe;
+  }
+
+  public void setAboutMe(String aboutMe) {
+    this.aboutMe = aboutMe;
+  }
+
+  public String[] getActivities() {
+    return activities;
+  }
+
+  public void setActivities(String[] activities) {
+    this.activities = activities;
+  }
+
+  public Address[] getAddresses() {
+    return addresses;
+  }
+
+  public void setAddresses(Address[] addresses) {
+    this.addresses = addresses;
+  }
+
+  public Integer getAge() {
+    return age;
+  }
+
+  public void setAge(Integer age) {
+    this.age = age;
+  }
+
+  public BodyType getBodyType() {
+    return bodyType;
+  }
+
+  public void setBodyType(BodyType bodyType) {
+    this.bodyType = bodyType;
+  }
+
+  public String[] getBooks() {
+    return books;
+  }
+
+  public void setBooks(String[] books) {
+    this.books = books;
+  }
+
+  public String[] getCars() {
+    return cars;
+  }
+
+  public void setCars(String[] cars) {
+    this.cars = cars;
+  }
+
+  public String getChildren() {
+    return children;
+  }
+
+  public void setChildren(String children) {
+    this.children = children;
+  }
+
+  public Address getCurrentLocation() {
+    return currentLocation;
+  }
+
+  public void setCurrentLocation(Address currentLocation) {
+    this.currentLocation = currentLocation;
+  }
+
+  public Date getDateOfBirth() {
+    return dateOfBirth;
+  }
+
+  public void setDateOfBirth(Date dateOfBirth) {
+    this.dateOfBirth = dateOfBirth;
+  }
+
+  public String getEthnicity() {
+    return ethnicity;
+  }
+
+  public void setEthnicity(String ethnicity) {
+    this.ethnicity = ethnicity;
+  }
+
+  public String getFashion() {
+    return fashion;
+  }
+
+  public void setFashion(String fashion) {
+    this.fashion = fashion;
+  }
+
+  public String[] getFood() {
+    return food;
+  }
+
+  public void setFood(String[] food) {
+    this.food = food;
+  }
+
+  public String getHappiestWhen() {
+    return happiestWhen;
+  }
+
+  public void setHappiestWhen(String happiestWhen) {
+    this.happiestWhen = happiestWhen;
+  }
+
+  public String[] getHereos() {
+    return hereos;
+  }
+
+  public void setHereos(String[] hereos) {
+    this.hereos = hereos;
+  }
+
+  public String getHumor() {
+    return humor;
+  }
+
+  public void setHumor(String humor) {
+    this.humor = humor;
   }
 
   public String getId() {
@@ -46,6 +228,54 @@
     this.id = id;
   }
 
+  public String[] getInterests() {
+    return interests;
+  }
+
+  public void setInterests(String[] interests) {
+    this.interests = interests;
+  }
+
+  public String getJobInterests() {
+    return jobInterests;
+  }
+
+  public void setJobInterests(String jobInterests) {
+    this.jobInterests = jobInterests;
+  }
+
+  public String[] getLanguagesSpoken() {
+    return languagesSpoken;
+  }
+
+  public void setLanguagesSpoken(String[] languagesSpoken) {
+    this.languagesSpoken = languagesSpoken;
+  }
+
+  public String getLivingArrangement() {
+    return livingArrangement;
+  }
+
+  public void setLivingArrangement(String livingArrangement) {
+    this.livingArrangement = livingArrangement;
+  }
+
+  public String[] getMovies() {
+    return movies;
+  }
+
+  public void setMovies(String[] movies) {
+    this.movies = movies;
+  }
+
+  public String[] getMusic() {
+    return music;
+  }
+
+  public void setMusic(String[] music) {
+    this.music = music;
+  }
+
   public Name getName() {
     return name;
   }
@@ -54,12 +284,36 @@
     this.name = name;
   }
 
-  public String getThumbnailUrl() {
-    return thumbnailUrl;
+  public String getNickname() {
+    return nickname;
   }
 
-  public void setThumbnailUrl(String thumbnailUrl) {
-    this.thumbnailUrl = thumbnailUrl;
+  public void setNickname(String nickname) {
+    this.nickname = nickname;
+  }
+
+  public String getPets() {
+    return pets;
+  }
+
+  public void setPets(String pets) {
+    this.pets = pets;
+  }
+
+  public Phone[] getPhoneNumbers() {
+    return phoneNumbers;
+  }
+
+  public void setPhoneNumbers(Phone[] phoneNumbers) {
+    this.phoneNumbers = phoneNumbers;
+  }
+
+  public String getPoliticalViews() {
+    return politicalViews;
+  }
+
+  public void setPoliticalViews(String politicalViews) {
+    this.politicalViews = politicalViews;
   }
 
   public String getProfileUrl() {
@@ -68,5 +322,109 @@
 
   public void setProfileUrl(String profileUrl) {
     this.profileUrl = profileUrl;
+  }
+
+  public String[] getQuotes() {
+    return quotes;
+  }
+
+  public void setQuotes(String[] quotes) {
+    this.quotes = quotes;
+  }
+
+  public String getRelationshipStatus() {
+    return relationshipStatus;
+  }
+
+  public void setRelationshipStatus(String relationshipStatus) {
+    this.relationshipStatus = relationshipStatus;
+  }
+
+  public String getReligion() {
+    return religion;
+  }
+
+  public void setReligion(String religion) {
+    this.religion = religion;
+  }
+
+  public String getRomance() {
+    return romance;
+  }
+
+  public void setRomance(String romance) {
+    this.romance = romance;
+  }
+
+  public String getScaredOf() {
+    return scaredOf;
+  }
+
+  public void setScaredOf(String scaredOf) {
+    this.scaredOf = scaredOf;
+  }
+
+  public String getSexualOrientation() {
+    return sexualOrientation;
+  }
+
+  public void setSexualOrientation(String sexualOrientation) {
+    this.sexualOrientation = sexualOrientation;
+  }
+
+  public String[] getSports() {
+    return sports;
+  }
+
+  public void setSports(String[] sports) {
+    this.sports = sports;
+  }
+
+  public String getStatus() {
+    return status;
+  }
+
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  public String[] getTags() {
+    return tags;
+  }
+
+  public void setTags(String[] tags) {
+    this.tags = tags;
+  }
+
+  public String getThumbnailUrl() {
+    return thumbnailUrl;
+  }
+
+  public void setThumbnailUrl(String thumbnailUrl) {
+    this.thumbnailUrl = thumbnailUrl;
+  }
+
+  public String[] getTurnOffs() {
+    return turnOffs;
+  }
+
+  public void setTurnOffs(String[] turnOffs) {
+    this.turnOffs = turnOffs;
+  }
+
+  public String[] getTurnOns() {
+    return turnOns;
+  }
+
+  public void setTurnOns(String[] turnOns) {
+    this.turnOns = turnOns;
+  }
+
+  public String[] getTvShows() {
+    return tvShows;
+  }
+
+  public void setTvShows(String[] tvShows) {
+    this.tvShows = tvShows;
   }
 }

Added: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Phone.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Phone.java?rev=634312&view=auto
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Phone.java (added)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/Phone.java Thu Mar  6 07:44:28 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.social;
+
+/**
+ * see
+ * http://code.google.com/apis/opensocial/docs/0.7/reference/opensocial.Phone.Field.html
+ *
+ */
+public class Phone extends AbstractSocialData {
+  @Mandatory private String number;
+  private String type;
+
+  public Phone(String number, String type) {
+    super();
+    this.number = number;
+    this.type = type;
+  }
+
+  public String getNumber() {
+    return number;
+  }
+
+  public void setNumber(String number) {
+    this.number = number;
+  }
+
+  public String getType() {
+    return type;
+  }
+
+  public void setType(String type) {
+    this.type = type;
+  }
+}

Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/file/BasicPeopleHandler.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/file/BasicPeopleHandler.java?rev=634312&r1=634311&r2=634312&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/file/BasicPeopleHandler.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/social/file/BasicPeopleHandler.java Thu Mar  6 07:44:28 2008
@@ -21,11 +21,13 @@
 import org.apache.shindig.social.Name;
 import org.apache.shindig.social.PeopleHandler;
 import org.apache.shindig.social.Person;
+import org.apache.shindig.social.Phone;
 import org.json.JSONException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -90,7 +92,16 @@
 
       String name = attributes.getNamedItem("name").getNodeValue();
       String id = attributes.getNamedItem("id").getNodeValue();
-      allPeople.put(id, new Person(id, new Name(name)));
+      Person person = new Person(id, new Name(name));
+
+      Node phoneItem = attributes.getNamedItem("phone");
+      if (phoneItem != null) {
+        String phone = phoneItem.getNodeValue();
+        Phone[] phones = {new Phone(phone, null)};
+        person.setPhoneNumbers(phones);
+      }
+
+      allPeople.put(id, person);
       ids.add(id);
     }
 

Added: incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/social/PersonTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/social/PersonTest.java?rev=634312&view=auto
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/social/PersonTest.java (added)
+++ incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/social/PersonTest.java Thu Mar  6 07:44:28 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.social;
+
+import junit.framework.TestCase;
+
+public class PersonTest extends TestCase {
+  private Person johnDoe;
+
+  @Override
+  public void setUp() throws Exception {
+    johnDoe = new Person("johnDoeId", new Name("John Doe"));
+    Phone[] phones = {
+        new Phone("+33H000000000", "home"),
+        new Phone("+33M000000000", "mobile"),
+        new Phone("+33W000000000", "work")};
+    johnDoe.setPhoneNumbers(phones);
+
+    Address[] addresses = {
+      new Address("My home address")
+    };
+    johnDoe.setAddresses(addresses);
+  }
+
+  public void testPersonToJson() throws Exception {
+    assertEquals(johnDoe.toJson().toString(),
+        "{\"id\":\"johnDoeId\"," +
+         "\"name\":{\"unstructured\":\"John Doe\"}," +
+         "\"phoneNumbers\":[" +
+            "{\"number\":\"+33H000000000\",\"type\":\"home\"}," +
+            "{\"number\":\"+33M000000000\",\"type\":\"mobile\"}," +
+            "{\"number\":\"+33W000000000\",\"type\":\"work\"}]," +
+         "\"addresses\":[{\"unstructuredAddress\":\"My home address\"}]}");
+  }
+}

Modified: incubator/shindig/trunk/javascript/samplecontainer/state-basicfriendlist.xml
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/samplecontainer/state-basicfriendlist.xml?rev=634312&r1=634311&r2=634312&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/samplecontainer/state-basicfriendlist.xml (original)
+++ incubator/shindig/trunk/javascript/samplecontainer/state-basicfriendlist.xml Thu Mar  6 07:44:28 2008
@@ -4,7 +4,7 @@
   </viewer>
 
   <viewerFriends>
-     <person id="jane.doe" name="Jane Doe"></person>
+     <person id="jane.doe" name="Jane Doe" phone="867-5309"></person>
      <person id="george.doe" name="George Doe"></person>
   </viewerFriends>