Author: chirag
Date: Thu Apr 29 19:20:16 2010
New Revision: 939466

URL: http://svn.apache.org/viewvc?rev=939466&view=rev
Log:
Add support the 0.9 MediaItem spec
Code Review: http://codereview.appspot.com/988045/show

Modified:
    
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/MediaItemImpl.java
    
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/MediaItem.java
    
shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXStreamAtomConverterTest.java

Modified: 
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/MediaItemImpl.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/MediaItemImpl.java?rev=939466&r1=939465&r2=939466&view=diff
==============================================================================
--- 
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/MediaItemImpl.java
 (original)
+++ 
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/MediaItemImpl.java
 Thu Apr 29 19:20:16 2010
@@ -21,16 +21,32 @@ import org.apache.shindig.social.opensoc
 
 /**
  * see
- * <a 
href="http://www.opensocial.org/Technical-Resources/opensocial-spec-v081/opensocial-reference#opensocial.MediaItem";>
- * 
http://www.opensocial.org/Technical-Resources/opensocial-spec-v081/opensocial-reference#opensocial.MediaItem</a>
+ * <a 
href="http://www.opensocial.org/Technical-Resources/opensocial-spec-v09/OpenSocial-Specification.html#opensocial.MediaItem.Field";>
+ * opensocial.MediaItem.Field</a>
  *
  */
 public class MediaItemImpl implements MediaItem {
-
+  private String albumId;
+  private String created;
+  private String description;
+  private String duration;
+  private String fileSize;
+  private String id;
+  private String language;
+  private String lastUpdated;
+  private String location;
   private String mimeType;
+  private String numComments;
+  private String numViews;
+  private String numVotes;
+  private String rating;
+  private String startTime;
+  private String taggedPeople;
+  private String tags;
+  private String thumbnailUrl;
+  private String title;
   private Type type;
   private String url;
-  private String thumbnailUrl;
 
   public MediaItemImpl() {
   }
@@ -52,7 +68,7 @@ public class MediaItemImpl implements Me
   public Type getType() {
     return type;
   }
-
+  
   public void setType(Type type) {
     this.type = type;
   }
@@ -64,6 +80,147 @@ public class MediaItemImpl implements Me
   public void setUrl(String url) {
     this.url = url;
   }
-  public String getThumbnailUrl() { return this.thumbnailUrl; }
-  public void setThumbnailUrl(String url) { this.thumbnailUrl = url; }
+
+  public String getThumbnailUrl() {
+    return this.thumbnailUrl;
+  }
+
+  public void setThumbnailUrl(String url) {
+    this.thumbnailUrl = url;
+  }
+
+  public String getAlbumId() {
+    return albumId;
+  }
+
+  public void setAlbumId(String albumId) {
+    this.albumId = albumId;
+  }
+
+  public String getCreated() {
+    return created;
+  }
+
+  public void setCreated(String created) {
+    this.created = created;
+  }
+
+  public String getDescription() {
+    return description;
+  }
+
+  public void setDescription(String description) {
+    this.description = description;
+  }
+
+  public String getDuration() {
+    return duration;
+  }
+
+  public void setDuration(String duration) {
+    this.duration = duration;
+  }
+
+  public String getFileSize() {
+    return fileSize;
+  }
+  
+  public void setFileSize(String fileSize) {
+    this.fileSize = fileSize;
+  }
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  public String getLanguage() {
+    return language;
+  }
+
+  public void setLanguage(String language) {
+    this.language = language;
+  }
+
+  public String getLastUpdated() {
+    return lastUpdated;
+  }
+
+  public void setLastUpdated(String lastUpdated) {
+    this.lastUpdated = lastUpdated;
+  }
+
+  public String getLocation() {
+    return location;
+  }
+
+  public void setLocation(String location) {
+    this.location = location;
+  }
+
+  public String getNumComments() {
+    return numComments;
+  }
+  
+  public void setNumComments(String numComments) {
+    this.numComments = numComments;
+  }
+
+  public String getNumViews() {
+    return numViews;
+  }
+
+  public void setNumViews(String numViews) {
+    this.numViews = numViews;
+  }
+
+  public String getNumVotes() {
+    return numVotes;
+  }
+
+  public void setNumVotes(String numVotes) {
+    this.numVotes = numVotes;
+  }
+
+  public String getRating() {
+    return rating;
+  }
+
+  public void setRating(String rating) {
+    this.rating = rating;
+  }
+
+  public String getStartTime() {
+    return startTime;
+  }
+
+  public void setStartTime(String startTime) {
+    this.startTime = startTime;
+  }
+
+  public String getTaggedPeople() {
+    return taggedPeople;
+  }
+
+  public void setTaggedPeople(String taggedPeople) {
+    this.taggedPeople = taggedPeople;
+  }
+
+  public String getTags() {
+    return tags;
+  }
+
+  public void setTags(String tags) {
+    this.tags = tags;
+  }
+
+  public String getTitle() {
+    return title;
+  }
+  public void setTitle(String title) {
+    this.title = title;
+  }
 }

Modified: 
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/MediaItem.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/MediaItem.java?rev=939466&r1=939465&r2=939466&view=diff
==============================================================================
--- 
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/MediaItem.java
 (original)
+++ 
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/MediaItem.java
 Thu Apr 29 19:20:16 2010
@@ -33,14 +33,27 @@ public interface MediaItem {
    * Fields for MediaItem.
    */
   public static enum Field {
-    /** the field name for mimeType. */
+    ALBUM_ID("albumId"),
+    CREATED("created"),
+    DESCRIPTION("description"),
+    DURATION("DURATION"),
+    FILE_SIZE("fileSize"),
+    ID("id"),
+    LANGUAGE("language"),
+    LAST_UPDATED("lastUpdated"),
+    LOCATION("location"),
     MIME_TYPE("mimeType"),
-    /** the field name for type. */
+    NUM_COMMENTS("numComments"),
+    NUM_VIEWS("numViews"),
+    NUM_VOTES("numVotes"),
+    RATING("rating"),
+    START_TIME("startTime"),
+    TAGGED_PEOPLE("taggedPeople"),
+    TAGS("tags"),
+    THUMBNAIL_URL("thumbnailUrl"),
+    TITLE("title"),
     TYPE("type"),
-    /** the field name for url. */
-    URL("url"),
-    /** the thumbnail Url */
-    THUMBNAIL_URL("thumbnailUrl");
+    URL("url");
 
     /**
      * The field name that the instance represents.
@@ -69,11 +82,8 @@ public interface MediaItem {
    * An enumeration of potential media types.
    */
   public enum Type {
-    /** the constant for audio types. */
     AUDIO("audio"),
-    /** the constant for image types. */
     IMAGE("image"),
-    /** the constant for video types. */
     VIDEO("video");
 
     /**
@@ -101,57 +111,256 @@ public interface MediaItem {
 
   /**
    * Get the mime type for this Media item.
-   *
    * @return the mime type.
    */
   String getMimeType();
 
   /**
    * Set the mimetype for this Media Item.
-   *
    * @param mimeType the mimeType
    */
   void setMimeType(String mimeType);
 
   /**
    * Get the Type of this media item, either audio, image or video.
-   *
    * @return the Type of this media item
    */
   Type getType();
 
   /**
    * Get the Type of this media item, either audio, image or video.
-   *
    * @param type the type of this media item
    */
   void setType(Type type);
 
   /**
    * Get a URL for the media item.
-   *
    * @return the url of the media item
    */
   String getUrl();
 
   /**
    * Set a URL for the media item.
-   *
    * @param url the media item URL
    */
   void setUrl(String url);
 
   /**
    * Get the thumbnail URL for the media item.
-   *
-   * @return the thumbnail url of the media item
+   * @return the thumbnail url of the MediaItem
    */
   String getThumbnailUrl();
 
   /**
    * Set a thumbnail URL for the media item.
-   *
    * @param url the thumbnail URL of the MediaItem
    */
   void setThumbnailUrl(String url);
+
+  /**
+   * Get the album which the media item belongs to.
+   * @return the album id.
+   */
+  String getAlbumId();
+
+  /**
+   * Set the album id which the media item belongs to.
+   * @param albumId the album id
+   */
+  void setAlbumId(String albumId);
+
+  /**
+   * Get the creation time
+   * @return creation time associated with the media item in UTC.
+   */
+  String getCreated();
+
+  /**
+   * Set the creation time
+   * @param created creation time associated with the media item in UTC.
+   */
+  void setCreated(String created);
+
+  /**
+   * Get the description of the media item
+   * @return description
+   */
+  String getDescription();
+
+  /**
+   * Set the description of the media item
+   * @param description
+   */
+  void setDescription(String description);
+
+  /**
+   * Get the playtime length in seconds of the MediaItem
+   * @return playtime
+   */
+  String getDuration();
+
+  /**
+   * Set the playtime length in seconds of the MediaItem
+   * @param duration
+   */
+  void setDuration(String duration);
+
+  /**
+   * Get the MediaItem's file size
+   * @return fileSize
+   */
+  String getFileSize();
+
+  /**
+   * Set the number of bytes for the MediaItem
+   * @param fileSize
+   */
+  void setFileSize(String fileSize);
+
+  /**
+   * Get the MediaItem's id 
+   * @return id
+   */
+  String getId();
+
+  /**
+   * Set the MediaItem's id
+   * @param id
+   */
+  void setId(String id);
+
+  /**
+   * Get the language associated with the media item in ISO 639-3 format
+   * @return
+   */
+  String getLanguage();
+
+  /**
+   * Set the language associated with the media item in ISO 639-3 format
+   * @param language
+   */
+  void setLanguage(String language);
+
+  /**
+   * Get the update time associated with the media item
+   * @return lastUpdated
+   */
+  String getLastUpdated();
+
+  /**
+   * Set the update time associated with the media item 
+   * @param lastUpdated
+   */
+  void setLastUpdated(String lastUpdated);
+
+  /**
+   * Get the location corresponding to the media item
+   * @return location
+   */
+  String getLocation();
+
+  /**
+   * Set the location corresponding to the media item
+   * @param location
+   */
+  void setLocation(String location);
+
+
+  /**
+   * Get the number of comments on the media item
+   * @return numComments
+   */
+  String getNumComments();
+
+  /**
+   * Set the number of comments on the media item
+   * @param numComments
+   */
+  void setNumComments(String numComments);
+
+  /**
+   * Get the number of views for the media item
+   * @return numViews
+   */
+  String getNumViews();
+
+  /**
+   * Set the number of views for the media item
+   * @param numViews
+   */
+  void setNumViews(String numViews);
+
+
+  /**
+   * Get the number of votes received for voting.
+   * @return numVotes
+   */
+  String getNumVotes();
+
+  /**
+   * Set the number of votes received for voting.
+   * @param numVotes
+   */
+  void setNumVotes(String numVotes);
+
+  /**
+   * Get the average rating of the media item on a scale of 0-10
+   * @return rating
+   */
+  String getRating();
+
+  /**
+   * Set the average rating of the media item on a scale of 0-10
+   * @param rating
+   */
+  void setRating(String rating);
+
+  /**
+   * Get the time when the content is available.
+   * @return startTime
+   */
+  String getStartTime();
+
+  /**
+   * Set the the time when the content is available.
+   * @param startTime
+   */
+  void setStartTime(String startTime);
+
+  /**
+   * Get people tagged in the media item.
+   * @return taggedPeople
+   */
+  String getTaggedPeople();
+
+  /**
+   * Set people tagged in the media item.
+   * @param taggedPeople
+   */
+  void setTaggedPeople(String taggedPeople);
+
+
+  /**
+   * Get tags associated with this media item.
+   * @return tags
+   */
+  String getTags();
+
+  /**
+   * Set tags associated with this media item.
+   * @param tags
+   */
+  void setTags(String tags);
+
+  /**
+   * Get the title for this media item
+   * @return title
+   */
+  String getTitle();
+
+  /**
+   * Set the title for this media item
+   * @param title
+   */
+  void setTitle(String title);
 }

Modified: 
shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXStreamAtomConverterTest.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXStreamAtomConverterTest.java?rev=939466&r1=939465&r2=939466&view=diff
==============================================================================
--- 
shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXStreamAtomConverterTest.java
 (original)
+++ 
shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXStreamAtomConverterTest.java
 Thu Apr 29 19:20:16 2010
@@ -73,8 +73,14 @@ public class BeanXStreamAtomConverterTes
 
     activity = new ActivityImpl("activityId", johnDoe.getId());
 
-    activity.setMediaItems(Lists.<MediaItem> newArrayList(new MediaItemImpl(
-        "image/jpg", MediaItem.Type.IMAGE, "http://foo.bar";)));
+    MediaItemImpl mediaItem = new MediaItemImpl();
+    mediaItem.setMimeType("image/jpg");
+    mediaItem.setType(MediaItem.Type.IMAGE);
+    mediaItem.setUrl("http://foo.bar";);
+    mediaItem.setLocation("CA");
+    mediaItem.setNumViews("10000");
+
+    activity.setMediaItems(Lists.<MediaItem> newArrayList(mediaItem));
     activity.setUrl("http://foo.com";);
 
     beanXmlConverter = new BeanXStreamAtomConverter(
@@ -230,6 +236,8 @@ public class BeanXStreamAtomConverterTes
         + "        <mimeType>image/jpg</mimeType>"
         + "        <type>IMAGE</type>"
         + "        <url>http://foo.bar</url>"
+        + "        <location>CA</location>"
+        + "        <numViews>10000</numViews>"
         + "    </mediaItems>"
         + "    <url>http://foo.com</url>"
         + "    <userId>johnDoeId</userId>"
@@ -240,6 +248,8 @@ public class BeanXStreamAtomConverterTes
         + "        <mimeType>image/jpg</mimeType>"
         + "        <type>IMAGE</type>"
         + "        <url>http://foo.bar</url>"
+        + "        <location>CA</location>"
+        + "        <numViews>10000</numViews>"
         + "    </mediaItems>"
         + "    <url>http://foo.com</url>"
         + "    <userId>johnDoeId</userId>"
@@ -250,6 +260,8 @@ public class BeanXStreamAtomConverterTes
         + "        <mimeType>image/jpg</mimeType>"
         + "        <type>IMAGE</type>"
         + "        <url>http://foo.bar</url>"
+        + "        <location>CA</location>"
+        + "        <numViews>10000</numViews>"
         + "    </mediaItems>"
         + "    <url>http://foo.com</url>"
         + "    <userId>johnDoeId</userId>"


Reply via email to