rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zh...@apache.org
Subject svn commit: r1104678 [2/4] - in /incubator/rave/trunk: ./ rave-portal/ rave-shindig/ rave-shindig/src/main/java/ rave-shindig/src/main/java/org/ rave-shindig/src/main/java/org/apache/ rave-shindig/src/main/java/org/apache/rave/ rave-shindig/src/main/ja...
Date Wed, 18 May 2011 03:42:11 GMT
Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationDataMapValueDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationDataMapValueDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationDataMapValueDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationDataMapValueDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,132 @@
+/*
+ * 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.opensocial.jpa;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+/**
+ * The final storage of data in the application datamap. Values are limited here to 4K in size.
+ */
+@Entity
+@Table(name="application_datavalue")
+public class ApplicationDataMapValueDb implements DbObject {
+  /**
+   * The internal object ID used for references to this object. Should be generated by the
+   * underlying storage mechanism
+   */
+  @Id
+  @GeneratedValue(strategy = IDENTITY)
+  @Column(name = "oid")
+  protected long objectId;
+
+  /**
+   * An optimistic locking field.
+   */
+  @Version
+  @Column(name = "version")
+  protected long version;
+
+  /**
+   * Each entry is associated with an application Data Map
+   */
+  @ManyToOne(targetEntity=ApplicationDataMapDb.class)
+  @JoinColumn(name="application_datamap_id", referencedColumnName="oid")
+  protected ApplicationDataMapDb applicationDataMap;
+  
+  /**
+   * Each entry has a name
+   */
+  @Basic
+  @Column(name="name", length=255)
+  protected String name;
+  
+  /**
+   * Each entry has a value (4K limit to size)
+   */
+  @Basic
+  @Column(name="value", length=4094)
+  protected String value;
+
+  /**
+   * @return the applicationDataMap
+   */
+  public ApplicationDataMapDb getApplicationDataMap() {
+    return applicationDataMap;
+  }
+
+  /**
+   * @param applicationDataMap the applicationDataMap to set
+   */
+  public void setApplicationDataMap(ApplicationDataMapDb applicationDataMap) {
+    this.applicationDataMap = applicationDataMap;
+  }
+
+  /**
+   * @return the name
+   */
+  public String getName() {
+    return name;
+  }
+
+  /**
+   * @param name the name to set
+   */
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  /**
+   * @return the value
+   */
+  public String getValue() {
+    return value;
+  }
+
+  /**
+   * @param value the value to set
+   */
+  public void setValue(String value) {
+    this.value = value;
+  }
+
+  /**
+   * @return the objectId
+   */
+  public long getObjectId() {
+    return objectId;
+  }
+
+  /**
+   * @return the version
+   */
+  public long getVersion() {
+    return version;
+  }
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,124 @@
+/*
+ * 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.opensocial.jpa;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+import org.apache.shindig.social.opensocial.model.ListField;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.MapKey;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import java.util.Map;
+
+/**
+ * Stores information about applications
+ */
+@Entity
+@Table(name = "application")
+public class ApplicationDb implements DbObject {
+  /**
+   * The internal object ID used for references to this object. Should be generated by the
+   * underlying storage mechanism
+   */
+  @Id
+  @GeneratedValue(strategy = IDENTITY)
+  @Column(name = "oid")
+  protected long objectId;
+
+  /**
+   * An optimistic locking field.
+   */
+  @Version
+  @Column(name = "version")
+  protected long version;
+
+
+  /**
+   * The application has properties.
+   */
+  @OneToMany(targetEntity = ApplicationPropertyDb.class, mappedBy = "application")
+  @MapKey(name = "type")
+  protected Map<String, ListField> properties;
+
+
+  /**
+   * Each Application has an Id
+   */
+  @Basic
+  @Column(name = "id", length = 255)
+  protected String id;
+
+
+  /**
+   * @return the properties
+   */
+  public Map<String, ListField> getProperties() {
+    return properties;
+  }
+
+
+  /**
+   * @param properties the properties to set
+   */
+  public void setProperties(Map<String, ListField> properties) {
+    this.properties = properties;
+  }
+
+
+  /**
+   * @return the id
+   */
+  public String getId() {
+    return id;
+  }
+
+
+  /**
+   * @param id the id to set
+   */
+  public void setId(String id) {
+    this.id = id;
+  }
+
+
+  /**
+   * @return the version
+   */
+  public long getVersion() {
+    return version;
+  }
+
+
+  /**
+   * @return the objectId
+   */
+  public long getObjectId() {
+    return objectId;
+  }
+
+
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationPropertyDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationPropertyDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationPropertyDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ApplicationPropertyDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,56 @@
+/*
+ * 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.opensocial.jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+/**
+ * This is a property of an application, extending the listfield type, and using the type property
+ * to perform the mapping. Main storage is in the listfield table, but application property stores
+ * the details of the properties of the application.
+ */
+@Entity
+@Table(name = "application_property")
+@PrimaryKeyJoinColumn(name = "oid")
+public class ApplicationPropertyDb extends ListFieldDb {
+  /**
+   * The application  relationship connected with this property.
+   */
+  @ManyToOne(targetEntity = ApplicationDb.class)
+  @JoinColumn(name = "application_id", referencedColumnName = "oid")
+  protected ApplicationDb application;
+
+  /**
+   * @return the application
+   */
+  public ApplicationDb getApplication() {
+    return application;
+  }
+
+  /**
+   * @param application the application to set
+   */
+  public void setApplication(ApplicationDb application) {
+    this.application = application;
+  }
+
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/BodyTypeDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/BodyTypeDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/BodyTypeDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/BodyTypeDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,219 @@
+/*
+ * 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.opensocial.jpa;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+import org.apache.shindig.social.opensocial.model.BodyType;
+import org.apache.shindig.social.opensocial.model.Person;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import java.util.List;
+
+/**
+ * The body type entity, stored in "body_type" 
+ *
+ */
+@Entity
+@Table(name = "body_type")
+@NamedQuery(name = BodyTypeDb.FINDBY_HEIGHT,
+    query = "select b from BodyTypeDb b where b.height = :height ")
+public class BodyTypeDb implements BodyType, DbObject {
+  /**
+   * Name of the JPA query to find BodyType by exact height, mainly used in testing.
+   */
+  public static final String FINDBY_HEIGHT = "q.bosytype.findbyheight";
+
+  /**
+   * name of the height parameter in JPA queries.
+   */
+  public static final String PARAM_HEIGHT = "height";
+
+  /**
+   * The internal object ID used for references to this object. Should be generated 
+   * by the underlying storage mechanism
+   */
+  @Id
+  @GeneratedValue(strategy = IDENTITY)
+  @Column(name = "oid")
+  private long objectId;
+
+  /**
+   * An optimistic locking field
+   */
+  @Version
+  @Column(name = "version")
+  protected long version;
+
+  @OneToMany(targetEntity = PersonDb.class, mappedBy = "bodyType")
+  private List<Person> persons;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.BodyType
+   */
+  @Basic
+  @Column(name = "build", length = 255)
+  private String build;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.BodyType
+   */
+  @Basic
+  @Column(name = "eye_color", length = 255)
+  private String eyeColor;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.BodyType
+   */
+  @Basic
+  @Column(name = "hair_color", length = 255)
+  private String hairColor;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.BodyType
+   */
+  @Basic
+  @Column(name = "height")
+  private Float height;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.BodyType
+   */
+  @Basic
+  @Column(name = "weight")
+  private Float weight;
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.BodyType#getBuild()
+   */
+  public String getBuild() {
+    return build;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.BodyType#setBuild(java.lang.String)
+   */
+  public void setBuild(String build) {
+    this.build = build;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.BodyType#getEyeColor()
+   */
+  public String getEyeColor() {
+    return eyeColor;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.BodyType#setEyeColor(java.lang.String)
+   */
+  public void setEyeColor(String eyeColor) {
+    this.eyeColor = eyeColor;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.BodyType#getHairColor()
+   */
+  public String getHairColor() {
+    return hairColor;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.BodyType#setHairColor(java.lang.String)
+   */
+  public void setHairColor(String hairColor) {
+    this.hairColor = hairColor;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.BodyType#getHeight()
+   */
+  public Float getHeight() {
+    return height;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.BodyType#setHeight(java.lang.String)
+   */
+  public void setHeight(Float height) {
+    this.height = height;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.BodyType#getWeight()
+   */
+  public Float getWeight() {
+    return weight;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.BodyType#setWeight(java.lang.String)
+   */
+  public void setWeight(Float weight) {
+    this.weight = weight;
+  }
+
+  /**
+   * @return the objectId
+   */
+  public long getObjectId() {
+    return objectId;
+  }
+
+
+  /**
+   * @return the persons
+   */
+  public List<Person> getPersons() {
+    return persons;
+  }
+
+  /**
+   * @param persons the persons to set
+   */
+  public void setPersons(List<Person> persons) {
+    this.persons = persons;
+  }
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/EmailDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/EmailDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/EmailDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/EmailDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,57 @@
+/*
+ * 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.opensocial.jpa;
+
+import org.apache.shindig.social.opensocial.model.Person;
+
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+/**
+ * Email Entity, extends the ListField object (and list_field table), joining on the object ID.
+ * Objects of this type will have "list_field_type" set to EmailDb in list_field
+ */
+@Entity
+@Table(name = "email")
+@PrimaryKeyJoinColumn(name = "oid")
+@NamedQuery(name = EmailDb.FINDBY_EMAIL, query = "select e from EmailDb e where e.value = :email ")
+public class EmailDb extends ListFieldDb {
+
+  /**
+   * The name of the JPA query to find Email by email address
+   */
+  public static final String FINDBY_EMAIL = "q.emai.findbyemail";
+  /**
+   * The name of the JPA parameter used for email address
+   */
+  public static final String PARAM_EMAIL = "email";
+
+  /**
+   * A list of People who have this address, a human may have more than one person and so may shared
+   * email addresses. Perhaps thats not valid in an implementation, but within this model it is
+   * possible.
+   */
+  @ManyToOne(targetEntity = PersonDb.class)
+  @JoinColumn(name = "person_id", referencedColumnName = "oid")
+  protected Person person;
+
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/EnumDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/EnumDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/EnumDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/EnumDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,90 @@
+/*
+ * 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.opensocial.jpa;
+
+import org.apache.shindig.protocol.model.Enum;
+
+/**
+ * This a utility holder class for Enums to assist in database storage. It does not have any
+ * database tables or persistence associated with it.
+ * 
+ * @param <E> The Enum type.
+ */
+public final class EnumDb<E extends Enum.EnumKey> implements Enum<E> {
+  private String displayValue;
+  private E value = null;
+
+  /**
+   * Constructs a Enum object.
+   * 
+   * @param value EnumKey The key to use
+   * @param displayValue String The display value
+   */
+  public EnumDb(E value, String displayValue) {
+    this.value = value;
+    this.displayValue = displayValue;
+  }
+
+  /**
+   * Constructs a Enum object.
+   * 
+   * @param value The key to use. Will use the value from getDisplayValue() as the display value.
+   */
+  public EnumDb(E value) {
+    this(value, value.getDisplayValue());
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Enum#getDisplayValue()
+   */
+  public String getDisplayValue() {
+    return displayValue;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Enum#setDisplayValue(java.lang.String)
+   */
+  public void setDisplayValue(String displayValue) {
+    this.displayValue = displayValue;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Enum#getValue()
+   */
+  public E getValue() {
+    return value;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Enum#setValue(org.apache.shindig.social.opensocial.model.Enum.EnumKey)
+   */
+  public void setValue(E value) {
+    this.value = value;
+  }
+
+  public String toString() {
+      if (value != null)
+          return value.toString();
+      else
+          return "";
+  }
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/FriendDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/FriendDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/FriendDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/FriendDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,145 @@
+/*
+ * 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.opensocial.jpa;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+import org.apache.shindig.social.opensocial.model.ListField;
+import org.apache.shindig.social.opensocial.model.Person;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.MapKey;
+import javax.persistence.OneToMany;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import java.util.Map;
+
+/**
+ * Fiends relates users to one another with attributes.
+ */
+@Entity 
+@Table(name = "friend")
+@PrimaryKeyJoinColumn(name = "oid") 
+public class FriendDb implements DbObject {
+  /**
+   * The internal object ID used for references to this object. Should be generated by the
+   * underlying storage mechanism
+   */
+  @Id
+  @GeneratedValue(strategy = IDENTITY)
+  @Column(name = "oid")
+  protected long objectId;
+
+  /**
+   * An optimistic locking field.
+   */
+  @Version
+  @Column(name = "version")
+  protected long version;
+
+  /**
+   * Someone asserts the friendship.
+   */
+  @ManyToOne(targetEntity = PersonDb.class)
+  @JoinColumn(name = "person_id", referencedColumnName = "oid")
+  protected Person person;
+
+  /**
+   * Someone else is the recipient of the friendship.
+   */
+  @ManyToOne(targetEntity = PersonDb.class)
+  @JoinColumn(name = "friend_id", referencedColumnName = "oid")
+  protected Person friend;
+
+  @Basic
+  @Column(name="score")
+  protected int score;
+
+  /**
+   * The friendship has properties.
+   */
+  @OneToMany(targetEntity = FriendPropertyDb.class, mappedBy = "friend")
+  @MapKey(name = "type")
+  protected Map<String, ListField> properties;
+
+  /**
+   * @return the person
+   */
+  public Person getPerson() {
+    return person;
+  }
+
+  /**
+   * @param person the person to set
+   */
+  public void setPerson(Person person) {
+    this.person = person;
+  }
+
+  /**
+   * @return the friend
+   */
+  public Person getFriend() {
+    return friend;
+  }
+
+  /**
+   * @param friend the friend to set
+   */
+  public void setFriend(Person friend) {
+    this.friend = friend;
+  }
+
+  /**
+   * @return the properties
+   */
+  public Map<String, ListField> getProperties() {
+    return properties;
+  }
+
+  /**
+   * @param properties the properties to set
+   */
+  public void setProperties(Map<String, ListField> properties) {
+    this.properties = properties;
+  }
+
+  /**
+   * @return the objectId
+   */
+  public long getObjectId() {
+    return objectId;
+  }
+
+  /**
+   * @return the version
+   */
+  public long getVersion() {
+    return version;
+  }
+
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/FriendPropertyDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/FriendPropertyDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/FriendPropertyDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/FriendPropertyDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,56 @@
+/*
+ * 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.opensocial.jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+/**
+ * This is a property of a friend link, extending the listfield type, and using the type property to
+ * perform the mapping. Main storage is in the listfield table, but friend property stores the
+ * details of the relationship with the friend object.
+ */
+@Entity
+@Table(name = "friend_property")
+@PrimaryKeyJoinColumn(name = "oid")
+public class FriendPropertyDb extends ListFieldDb {
+  /**
+   * The friend relationship connected with this property.
+   */
+  @ManyToOne(targetEntity = FriendDb.class)
+  @JoinColumn(name = "friend_id", referencedColumnName = "oid")
+  protected FriendDb friend;
+
+  /**
+   * @return the friend
+   */
+  public FriendDb getFriend() {
+    return friend;
+  }
+
+  /**
+   * @param friend the friend to set
+   */
+  public void setFriend(FriendDb friend) {
+    this.friend = friend;
+  }
+
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/GroupDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/GroupDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/GroupDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/GroupDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,168 @@
+/*
+ * 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.opensocial.jpa;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+import org.apache.shindig.social.opensocial.model.ListField;
+import org.apache.shindig.social.opensocial.model.Person;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.MapKey;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Represents a group in the social database. The assumption in this object is that groups are
+ * associated with individuals and are used by those individuals to manage people.
+ */
+@Entity
+@Table(name = "person_group")
+public class GroupDb implements DbObject {
+  /**
+   * The internal object ID used for references to this object. Should be generated by the
+   * underlying storage mechanism
+   */
+  @Id
+  @GeneratedValue(strategy = IDENTITY)
+  @Column(name = "oid")
+  protected long objectId;
+
+  /**
+   * An optimistic locking field.
+   */
+  @Version
+  @Column(name = "version")
+  protected long version;
+
+  /**
+   * There is a single owner of a group.
+   */
+  @ManyToOne(targetEntity = PersonDb.class)
+  @JoinColumn(name = "person_id", referencedColumnName = "oid")
+  protected Person owner;
+
+  /**
+   * There are many members of a group.
+   */
+  @ManyToMany(targetEntity = PersonDb.class)
+  @JoinTable(name = "membership", 
+      joinColumns = 
+        @JoinColumn(name = "group_id", referencedColumnName = "oid"), 
+      inverseJoinColumns = 
+        @JoinColumn(name = "person_id", referencedColumnName = "oid"))
+  protected List<Person> members;
+
+  /**
+   * Each group has a group Id.
+   */
+  @Basic
+  @Column(name = "id", length = 255)
+  protected String id;
+
+  /**
+   * The group has properties.
+   */
+  @OneToMany(targetEntity = GroupPropertyDb.class, mappedBy = "group")
+  @MapKey(name = "type")
+  protected Map<String, ListField> properties;
+
+  /**
+   * @return the owner
+   */
+  public Person getOwner() {
+    return owner;
+  }
+
+  /**
+   * @param owner the owner to set
+   */
+  public void setOwner(Person owner) {
+    this.owner = owner;
+  }
+
+  /**
+   * @return the members
+   */
+  public List<Person> getMembers() {
+    return members;
+  }
+
+  /**
+   * @param members the members to set
+   */
+  public void setMembers(List<Person> members) {
+    this.members = members;
+  }
+
+  /**
+   * @return the id
+   */
+  public String getId() {
+    return id;
+  }
+
+  /**
+   * @param id the id to set
+   */
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  /**
+   * @return the objectId
+   */
+  public long getObjectId() {
+    return objectId;
+  }
+
+  /**
+   * @return the version
+   */
+  public long getVersion() {
+    return version;
+  }
+
+  /**
+   * @return the properties
+   */
+  public Map<String, ListField> getProperties() {
+    return properties;
+  }
+
+  /**
+   * @param properties the properties to set
+   */
+  public void setProperties(Map<String, ListField> properties) {
+    this.properties = properties;
+  }
+
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/GroupPropertyDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/GroupPropertyDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/GroupPropertyDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/GroupPropertyDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,59 @@
+/*
+ * 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.opensocial.jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+/**
+ * This is a property of a group, extending the listfield type, and using the type property to
+ * perform the mapping. Main storage is in the listfield table, but group property stores the
+ * details of the properties of the group.
+ */
+@Entity
+@Table(name = "group_property")
+@PrimaryKeyJoinColumn(name = "oid")
+public class GroupPropertyDb extends ListFieldDb {
+  /**
+   * The group relationship connected with this property.
+   */
+  @ManyToOne(targetEntity = GroupDb.class)
+  @JoinColumn(name = "group_id", referencedColumnName = "oid")
+  protected GroupDb group;
+
+  /**
+   * @return the group
+   */
+  public GroupDb getGroup() {
+    return group;
+  }
+
+  /**
+   * @param group the group to set
+   */
+  public void setGroup(GroupDb group) {
+    this.group = group;
+  }
+  
+
+
+
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ImDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ImDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ImDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ImDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,45 @@
+/*
+ * 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.opensocial.jpa;
+
+import org.apache.shindig.social.opensocial.model.Person;
+
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+/**
+ * IM (Instant Message account) Entity, extends the ListField object (and list_field table), joining
+ * on the object ID. Objects of this type will have "list_field_type" set to ImDb in list_field
+ */
+@Entity
+@Table(name = "im")
+@PrimaryKeyJoinColumn(name = "oid")
+public class ImDb extends ListFieldDb {
+
+  /**
+   * The person who owns this IM account. This information is maintained in the database using a
+   * join column "person_id" in the im table that points to oid in the person table.
+   */
+  @ManyToOne(targetEntity = PersonDb.class)
+  @JoinColumn(name = "person_id", referencedColumnName = "oid")
+  protected Person person;
+
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ListFieldDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ListFieldDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ListFieldDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/ListFieldDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,162 @@
+/*
+ * 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.opensocial.jpa;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+import org.apache.shindig.social.opensocial.model.ListField;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorType;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+/**
+ * List fields represent storage of list of fields potentially with a preferred or primary value.
+ * This is the base storage class for all list fields, stored in the lsit_field table. Classes will
+ * extend this class using a join strategy and setting the list_field_type column to the type of
+ * class represented by the record. If there is no type it defaults to ListFieldDb.
+ */
+@MappedSuperclass
+//@Table(name="list_field")
+@Inheritance(strategy=InheritanceType.JOINED)
+@DiscriminatorColumn(name="list_field_type", length=30, discriminatorType=DiscriminatorType.STRING)
+@DiscriminatorValue(value="ListFieldDb")
+public class ListFieldDb implements ListField, DbObject {
+  /**
+   * The internal object ID used for references to this object. Should be generated 
+   * by the underlying storage mechanism
+   */
+  @Id
+  @GeneratedValue(strategy=IDENTITY)
+  @Column(name="oid")
+  protected long objectId;
+  
+  /**
+   * An optimistic locking field.
+   */
+  @Version
+  @Column(name="version")
+  protected long version;
+
+  
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.ListField
+   */
+  @Basic
+  @Column(name="field_type", length=255)
+  protected String type;
+  
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.ListField
+   */
+  @Basic
+  @Column(name="field_value", length=255)
+  protected String value;
+  
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.ListField
+   */
+  @Basic
+  @Column(name="primary_field")
+  protected Boolean primary;
+
+  /**
+   * Create a list field.
+   */
+  public ListFieldDb() { }
+
+  /**
+   * Create a list field, specifying the type and the value.
+   * @param type the type or name of the field
+   * @param value the value contained in the field.
+   */
+  public ListFieldDb(String type, String value) {
+    this.type = type;
+    this.value = value;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.ListField#getType()
+   */
+  public String getType() {
+    return type;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.ListField#setType(java.lang.String)
+   */
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.ListField#getValue()
+   */
+  public String getValue() {
+    return value;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.ListField#setValue(java.lang.String)
+   */
+  public void setValue(String value) {
+    this.value = value;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.ListField#getPrimary()
+   */
+  public Boolean getPrimary() {
+    return primary;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.ListField#setPrimary(java.lang.Boolean)
+   */
+  public void setPrimary(Boolean primary) {
+    this.primary = primary;
+  }
+
+  /** 
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.jpa.api.DbObject#getObjectId()
+   */
+  public long getObjectId() {
+    return objectId;
+  }
+
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/MediaItemDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/MediaItemDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/MediaItemDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/MediaItemDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,597 @@
+/*
+ * 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.opensocial.jpa;
+
+import static javax.persistence.CascadeType.MERGE;
+import static javax.persistence.CascadeType.PERSIST;
+import static javax.persistence.CascadeType.REFRESH;
+import static javax.persistence.GenerationType.IDENTITY;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+import org.apache.shindig.social.opensocial.model.Activity;
+import org.apache.shindig.social.opensocial.model.Address;
+import org.apache.shindig.social.opensocial.model.MediaItem;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.PostLoad;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+
+import java.util.List;
+
+/**
+ * Media items are stored in the media_item table, Items may be shared amongst activities and are
+ * related to people.
+ */
+@Entity
+@Table(name = "media_item")
+public class MediaItemDb implements MediaItem, DbObject {
+  /**
+   * The internal object ID used for references to this object. Should be generated
+   * by the underlying storage mechanism
+   */
+  @Id
+  @GeneratedValue(strategy = IDENTITY)
+  @Column(name = "oid")
+  private long objectId;
+
+  /**
+   * An optimistic locking field
+   */
+  @Version
+  @Column(name = "version")
+  protected long version;
+
+  /**
+   * The list of activities which this media item is reference in, this relationship is specified by
+   * the java property mediaItems in the class ActivityDb.
+   *
+   * @see ActivityDb for more information on this mapping.
+   */
+  @ManyToMany(targetEntity = ActivityDb.class, mappedBy = "mediaItems")
+  protected List<Activity> activities;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "mime_type", length = 255)
+  private String mimeType;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "media_type")
+  private String typeDb;
+
+  /**
+   * model field
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "thumbnail_url", length = 255)
+  private String thumbnailUrl;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Transient
+  private Type type;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "url", length = 255)
+  private String url;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "album_id")
+  private String albumId;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "created")
+  private String created;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "description")
+  private String description;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "title")
+  private String title;
+
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "duration")
+  private String duration;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "file_size")
+  private String fileSize;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "id")
+  private String id;
+
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "language")
+  private String language;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "last_updated")
+  private String lastUpdated;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @ManyToOne(targetEntity = AddressDb.class, cascade = { PERSIST, MERGE, REFRESH })
+  @JoinColumn(name = "address_id", referencedColumnName = "oid")
+  private Address location;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "num_comments")
+  private String numComments;
+
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "num_views")
+  private String numViews;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "num_votes")
+  private String numVotes;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "rating")
+  private String rating;
+
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "start_time")
+  private String startTime;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "tagged_people")
+  private String taggedPeople;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.MediaItem
+   */
+  @Basic
+  @Column(name = "tags")
+  private String tags;
+
+  /**
+   * Create a new blank media item.
+   */
+  public MediaItemDb() {
+  }
+
+  /**
+   * Create a media item specifying the mimeType, type and url.
+   * @param mimeType the mime type of the media item.
+   * @param type the type of the media items (see the specification)
+   * @param url the url pointing to the media item.
+   */
+  public MediaItemDb(String mimeType, Type type, String url) {
+    this.mimeType = mimeType;
+    this.type = type;
+    this.url = url;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.MediaItem#getMimeType()
+   */
+  public String getMimeType() {
+    return mimeType;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.MediaItem#setMimeType(java.lang.String)
+   */
+  public void setMimeType(String mimeType) {
+    this.mimeType = mimeType;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.MediaItem#getType()
+   */
+  public Type getType() {
+    return type;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.MediaItem#setType(org.apache.shindig.social.opensocial.model.MediaItem.Type)
+   */
+  public void setType(Type type) {
+    this.type = type;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.MediaItem#getUrl()
+   */
+  public String getUrl() {
+    return url;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.MediaItem#setUrl(java.lang.String)
+   */
+  public void setUrl(String url) {
+    this.url = url;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.MediaItem#getThumbnailUrl()
+   */
+  public String getThumbnailUrl() {
+    return thumbnailUrl;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.MediaItem#setThumbnailUrl(java.lang.String)
+   */
+  public void setThumbnailUrl(String url) {
+    this.thumbnailUrl = url;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getAlbumId() {
+    return albumId;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setAlbumId(String albumId) {
+    this.albumId = albumId;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getCreated() {
+    return created;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setCreated(String created) {
+    this.created = created;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getDescription() {
+    return description;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setDescription(String description) {
+    this.description = description;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getDuration() {
+    return duration;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setDuration(String duration) {
+    this.duration = duration;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getFileSize() {
+    return fileSize;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setFileSize(String fileSize) {
+    this.fileSize = fileSize;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getId() {
+    return id;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getLanguage() {
+    return language;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setLanguage(String language) {
+    this.language = language;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getLastUpdated() {
+    return lastUpdated;
+  }
+
+  public void setLastUpdated(String lastUpdated) {
+    this.lastUpdated = lastUpdated;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public Address getLocation() {
+    return location;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setLocation(Address location) {
+    this.location = location;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getNumComments() {
+    return numComments;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setNumComments(String numComments) {
+    this.numComments = numComments;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getNumViews() {
+    return numViews;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setNumViews(String numViews) {
+    this.numViews = numViews;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getNumVotes() {
+    return numVotes;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setNumVotes(String numVotes) {
+    this.numVotes = numVotes;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getRating() {
+    return rating;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setRating(String rating) {
+    this.rating = rating;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getStartTime() {
+    return startTime;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setStartTime(String startTime) {
+    this.startTime = startTime;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getTaggedPeople() {
+    return taggedPeople;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setTaggedPeople(String taggedPeople) {
+    this.taggedPeople = taggedPeople;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getTags() {
+    return tags;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setTags(String tags) {
+    this.tags = tags;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getTitle() {
+    return title;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public void setTitle(String title) {
+    this.title = title;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.jpa.api.DbObject#getObjectId()
+   */
+  public long getObjectId() {
+    return objectId;
+  }
+
+  /**
+   * a hook into the pre persist phase of JPA to convert type into the db representation.
+   */
+  @PrePersist
+  public void populateDbFields() {
+    typeDb = type.toString();
+  }
+
+  /**
+   * A hook into the load to convert the type in the Db into the Type Enum.
+   */
+  @PostLoad
+  public void loadTransientFields() {
+    type = Type.valueOf(typeDb);
+  }
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/MessageDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/MessageDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/MessageDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/MessageDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,328 @@
+/*
+ * 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.opensocial.jpa;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+import org.apache.shindig.social.opensocial.model.Message;
+import org.apache.shindig.social.opensocial.model.Url;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.PostLoad;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+
+/**
+ * Messages are stored in the message table.
+ */
+@Entity
+@Table(name="message")
+public class MessageDb implements Message, DbObject {
+  /**
+   * The internal object ID used for references to this object. Should be generated
+   * by the underlying storage mechanism
+   */
+  @Id
+  @GeneratedValue(strategy=IDENTITY)
+  @Column(name="oid")
+  protected long objectId;
+
+  /**
+   * An optimistic locking field
+   */
+  @Version
+  @Column(name="version")
+  protected long version;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.Message
+   */
+  @Basic
+  @Column(name="body", length=255)
+  protected String body;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.Message
+   */
+  @Basic
+  @Column(name="title", length=255)
+  protected String title;
+
+  /**
+   * model field. (database representation of type)
+   * @see org.apache.shindig.social.opensocial.model.Message
+   */
+  @Basic
+  @Column(name="message_type")
+  protected String typeDb;
+
+  /**
+   * model field.
+   * @see org.apache.shindig.social.opensocial.model.Message
+   */
+  @Transient
+  protected Type type;
+
+  /**
+   * create an empty message.
+   */
+  public MessageDb() {
+  }
+
+  /**
+   * Create a message object with body, title and type.
+   * @param initBody the body of the message.
+   * @param initTitle the title of the message.
+   * @param initType the type of the message.
+   */
+  public MessageDb(String initBody, String initTitle, Type initType) {
+    this.body = initBody;
+    this.title = initTitle;
+    this.type = initType;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Message#getBody()
+   */
+  public String getBody() {
+    return this.body;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Message#setBody(java.lang.String)
+   */
+  public void setBody(String newBody) {
+    this.body = newBody;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Message#getTitle()
+   */
+  public String getTitle() {
+    return this.title;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Message#setTitle(java.lang.String)
+   */
+  public void setTitle(String newTitle) {
+    this.title = newTitle;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Message#getType()
+   */
+  public Type getType() {
+    return type;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Message#setType(org.apache.shindig.social.opensocial.model.Message.Type)
+   */
+  public void setType(Type newType) {
+    this.type = newType;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.model.Message#sanitizeHTML(java.lang.String)
+   */
+  public String sanitizeHTML(String htmlStr) {
+    return htmlStr;
+  }
+
+  /**
+   * {@inheritDoc}
+   * @see org.apache.shindig.social.opensocial.jpa.api.DbObject#getObjectId()
+   */
+  public long getObjectId() {
+    return objectId;
+  }
+
+  /**
+   *
+   */
+  @PrePersist
+  public void populateDbFields() {
+    typeDb = type.toString();
+  }
+
+  /**
+   *
+   */
+  @PostLoad
+  public void loadTransientFields() {
+    type = Type.valueOf(typeDb);
+  }
+
+  /** {@inheritDoc} */
+  public String getAppUrl() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public String getBodyId() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public List<String> getCollectionIds() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public String getId() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public String getInReplyTo() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public List<String> getRecipients() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public List<String> getReplies() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public String getSenderId() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public Status getStatus() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public Date getTimeSent() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public String getTitleId() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public Date getUpdated() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public List<Url> getUrls() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public void setAppUrl(String url) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setBodyId(String bodyId) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setCollectionIds(List<String> collectionIds) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setId(String id) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setInReplyTo(String parentId) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setRecipients(List<String> recipients) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setSenderId(String senderId) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setStatus(Status status) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setTimeSent(Date timeSent) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setTitleId(String titleId) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setUpdated(Date updated) {
+    // TODO Auto-generated method stub
+  }
+
+  /** {@inheritDoc} */
+  public void setUrls(List<Url> urls) {
+    // TODO Auto-generated method stub
+  }
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/NameDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/NameDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/NameDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/NameDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,279 @@
+/*
+ * 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.opensocial.jpa;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+import org.apache.shindig.social.opensocial.jpa.api.DbObject;
+import org.apache.shindig.social.opensocial.model.Name;
+import org.apache.shindig.social.opensocial.model.Person;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import java.util.List;
+
+/**
+ * The name object, stored in the name table.
+ */
+@Entity
+@Table(name = "name")
+@NamedQuery(name = NameDb.FINDBY_FAMILY_NAME, query = "select n from NameDb n where n.familyName = :familyName ")
+public class NameDb implements Name, DbObject {
+  /**
+   * the name of the JPA query that selects a name by family name.
+   */
+  public static final String FINDBY_FAMILY_NAME = "q.name.findbyfamilyname";
+  /**
+   * the name of the family name parameter used in JPA named queries.
+   */
+  public static final String PARAM_FAMILY_NAME = "familyName";
+
+  /**
+   * The internal object ID used for references to this object. Should be generated by the
+   * underlying storage mechanism
+   */
+  @Id
+  @GeneratedValue(strategy = IDENTITY)
+  @Column(name = "oid")
+  private long objectId;
+
+  /**
+   * An optimistic locking field
+   */
+  @Version
+  @Column(name = "version")
+  protected long version;
+
+  /**
+   * A list of people who shared this name, relationship is specified by the name property on the
+   * Person Object.
+   */
+  @OneToMany(targetEntity = PersonDb.class, mappedBy = "name")
+  private List<Person> persons;
+
+  /**
+   * model field.
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name
+   */
+  @Basic
+  @Column(name = "additional_name", length = 255)
+  private String additionalName;
+
+  /**
+   * model field.
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name
+   */
+  @Basic
+  @Column(name = "family_name", length = 255)
+  private String familyName;
+
+  /**
+   * model field.
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name
+   */
+  @Basic
+  @Column(name = "given_name", length = 255)
+  private String givenName;
+
+  /**
+   * model field.
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name
+   */
+  @Basic
+  @Column(name = "honorific_prefix", length = 255)
+  private String honorificPrefix;
+
+  /**
+   * model field.
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name
+   */
+  @Basic
+  @Column(name = "honorific_suffix", length = 255)
+  private String honorificSuffix;
+
+  /**
+   * model field.
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name
+   */
+  @Basic
+  @Column(name = "formatted", length = 255)
+  private String formatted;
+
+  /**
+   * 
+   */
+  public NameDb() {
+  }
+
+  /**
+   * @param formatted
+   */
+  public NameDb(String formatted) {
+    this.formatted = formatted;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#getAdditionalName()
+   */
+  public String getAdditionalName() {
+    return additionalName;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#setAdditionalName(java.lang.String)
+   */
+  public void setAdditionalName(String additionalName) {
+    this.additionalName = additionalName;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#getFamilyName()
+   */
+  public String getFamilyName() {
+    return familyName;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#setFamilyName(java.lang.String)
+   */
+  public void setFamilyName(String familyName) {
+    this.familyName = familyName;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#getGivenName()
+   */
+  public String getGivenName() {
+    return givenName;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#setGivenName(java.lang.String)
+   */
+  public void setGivenName(String givenName) {
+    this.givenName = givenName;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#getHonorificPrefix()
+   */
+  public String getHonorificPrefix() {
+    return honorificPrefix;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#setHonorificPrefix(java.lang.String)
+   */
+  public void setHonorificPrefix(String honorificPrefix) {
+    this.honorificPrefix = honorificPrefix;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#getHonorificSuffix()
+   */
+  public String getHonorificSuffix() {
+    return honorificSuffix;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#setHonorificSuffix(java.lang.String)
+   */
+  public void setHonorificSuffix(String honorificSuffix) {
+    this.honorificSuffix = honorificSuffix;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.jpa.api.DbObject#getObjectId()
+   */
+  public long getObjectId() {
+    return objectId;
+  }
+
+  /**
+   * A list of people who have this name
+   * 
+   * @return the persons
+   */
+  public List<Person> getPersons() {
+    return persons;
+  }
+
+  /**
+   * Set the list of people who have this name
+   * 
+   * @param persons the persons to set
+   */
+  public void setPersons(List<Person> persons) {
+    this.persons = persons;
+
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#getFormatted()
+   */
+  public String getFormatted() {
+    return formatted;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see org.apache.shindig.social.opensocial.model.Name#setFormatted(java.lang.String)
+   */
+  public void setFormatted(String formatted) {
+    this.formatted = formatted;
+  }
+}

Added: incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/OrganizationAddressDb.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/OrganizationAddressDb.java?rev=1104678&view=auto
==============================================================================
--- incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/OrganizationAddressDb.java (added)
+++ incubator/rave/trunk/rave-shindig/src/main/java/org/apache/shindig/social/opensocial/jpa/OrganizationAddressDb.java Wed May 18 03:42:09 2011
@@ -0,0 +1,131 @@
+/*
+ * 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.opensocial.jpa;
+
+import org.apache.shindig.social.opensocial.model.Organization;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+/**
+ * This object connects to a single Address, and to a single organization, defining the
+ * organizations relationship with the address. The class extends AddressDb, which stores itself in
+ * the address table. The specialization of this class is stored in organization_address and joined
+ * on the objectId property (oid column). Records are discriminated using the address_usage column
+ * in the address table and set to the value 'sharedaddress' (i.e. no discrimination) indicating
+ * that the address is shared.
+ */
+// TODO, uncertain about the mapping of this, oid <-> oid means one to one, and this is only
+// associated with a single
+// Organization. IMHO, we should be mapping organizational_address.address_id to address.oid, but
+// need to think about this.
+@Entity
+@Table(name = "organizational_address")
+@DiscriminatorValue(value = "sharedaddress")
+// this is the same as others since we want to share the data.
+public class OrganizationAddressDb extends AddressDb {
+  /**
+   * Indicates this address is the primary address for the organization.
+   */
+  @Basic
+  @Column(name = "primary_organization")
+  private Boolean primary;
+
+  /**
+   * This address is associated with a single organization in this form.
+   *
+   */
+  @OneToOne(targetEntity = OrganizationDb.class)
+  @JoinColumn(name = "organization_id", referencedColumnName = "oid")
+  private Organization organization;
+
+  /**
+   * the type of the address for the organization.
+   *
+   * @see org.apache.shindig.social.opensocial.model.Address
+   */
+  @Basic
+  @Column(name = "type", length = 255)
+  private String type;
+
+  /**
+   * Create an organizational address.
+   */
+  public OrganizationAddressDb() {
+  }
+
+  /**
+   * {@inheritDoc}
+   *
+   * @see org.apache.shindig.social.opensocial.jpa.AddressDb#getType()
+   */
+  public String getType() {
+    return type;
+  }
+
+  /**
+   * {@inheritDoc}
+   *
+   * @see org.apache.shindig.social.opensocial.jpa.AddressDb#setType(java.lang.String)
+   */
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  /**
+   * {@inheritDoc}
+   *
+   * @see org.apache.shindig.social.opensocial.jpa.AddressDb#getPrimary()
+   */
+  public Boolean getPrimary() {
+    return primary;
+  }
+
+  /**
+   * {@inheritDoc}
+   *
+   * @see org.apache.shindig.social.opensocial.jpa.AddressDb#setPrimary(java.lang.Boolean)
+   */
+  public void setPrimary(Boolean primary) {
+    this.primary = primary;
+  }
+
+  /**
+   * The organization this address address relates to.
+   *
+   * @return the organization
+   */
+  public Organization getOrganization() {
+    return organization;
+  }
+
+  /**
+   * Set the organization this address relates to.
+   *
+   * @param organization the organization to set
+   */
+  public void setOrganization(Organization organization) {
+    this.organization = organization;
+  }
+
+}



Mime
View raw message