org.exoplatform.social.client.core.model
Class RestActivityImpl

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by org.json.simple.JSONObject
              extended by org.exoplatform.social.client.core.model.ModelImpl
                  extended by org.exoplatform.social.client.core.model.RestActivityImpl
All Implemented Interfaces:
Serializable, Cloneable, Map, Model, RestActivity, org.json.simple.JSONAware, org.json.simple.JSONStreamAware

public class RestActivityImpl
extends ModelImpl
implements RestActivity

Implementation of RestActivity.

Since:
May 26, 2011
Author:
hoatle (hoatlevan at gmail dot com)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface org.exoplatform.social.client.api.model.RestActivity
RestActivity.Field
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class org.exoplatform.social.client.core.model.ModelImpl
propertyChanges
 
Fields inherited from interface org.exoplatform.social.client.api.model.RestActivity
DEFAULT_ACTIVITY_TYPE, DOC_ACTIVITY_TYPE, LINK_ACTIVITY_TYPE
 
Constructor Summary
RestActivityImpl()
          Constructor without any params.
 
Method Summary
 void addTemplateParameter(String name, String value)
          Adds a new template parameter with the specified name and value.
 RestActivityStream getActivityStream()
          Gets activity stream.
 String getAppId()
          Gets a string specifying the application that this activity is associated with.
 List<RestComment> getAvailableComments()
          Gets the available list of comments for this activity.
 List<RestIdentity> getAvailableLikes()
          Gets the available list of likes for this activity.
 String getBody()
          gets the body fields of Activity, this field is optional and use to storage the extended attribute of activity.
 String getId()
          Gets a string ID that is permanently associated with this activity.
 String getIdentityId()
          Gets a string uuid of the identity who created this activity.
 Long getPostedTime()
          Gets the time at which this activity took place in milliseconds since the epoch.
 RestIdentity getPosterIdentity()
          Gets the poster identity who created this activity.
 Double getPriority()
          Gets the priority, a number between 0 and 1 representing the relative priority of this activity in relation to other activities from the same source.
 String getTemplateParameter(String name)
          Returns the template parameter with the specified name.
 Map<String,String> getTemplateParams()
          Gets a map of custom key/value pairs associated with this activity.
 String getTitle()
          Gets a string specifying the primary text of an activity.
 String getTitleId()
          Gets a string specifying the title template message ID in the gadget spec.
 List<RestComment> getTotalComments()
          Gets the total number of comments.
 List<RestIdentity> getTotalLikes()
          Gets the total number of likes.
 int getTotalNumberOfComments()
          Gets the number of total comments.
 int getTotalNumberOfLikes()
          Gets the number of total likes.
 String getType()
          Gets a string specifying the type of activity.
 boolean isLiked()
          Checks if this activity is liked by current user.
 void setAppId(String appId)
          Sets a string specifying the application that this activity is associated with.
 void setAvailableComments(List<RestComment> restCommentList)
          Sets the available list of comments for this activity.
 void setBody(String title)
          Sets the body fields of Activity, this field is optional and use to storage the extended attribute of activity.
 void setId(String id)
          Sets a string ID that is permanently associated with this activity.
 void setIdentityId(String identityId)
          Sets a string uuid of the identity who created this activity.
 void setPostedTime(Long postedTime)
          Sets the time at which this activity took place in milliseconds since the epoch Container support for this field is OPTIONAL.
 void setPriority(Double priority)
          Sets the priority, a number between 0 and 1 representing the relative priority of this activity in relation to other activities from the same source.
 void setTemplateParams(Map<String,String> templateParams)
          Set a map of custom key/value pairs associated with this activity.
 void setTitle(String title)
          Sets a string specifying the primary text of an activity.
 void setTitleId(String titleId)
          Sets a string specifying the title template message ID in the gadget spec.
 void setType(String type)
          Sets a string specifying the type of activity.
 
Methods inherited from class org.exoplatform.social.client.core.model.ModelImpl
addPropertyChangeListener, addToListField, findPropertyChangeListeners, getField, getFieldAsList, getFieldAsMap, getFieldAsString, getFieldNames, hasField, isFieldMultikeyed, isFieldMultivalued, removePropertyChangeListener, setField
 
Methods inherited from class org.json.simple.JSONObject
escape, toJSONString, toJSONString, toString, toString, writeJSONString, writeJSONString
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.exoplatform.social.client.api.model.Model
addPropertyChangeListener, addToListField, findPropertyChangeListeners, getField, getFieldAsList, getFieldAsMap, getFieldAsString, getFieldNames, hasField, isFieldMultikeyed, isFieldMultivalued, removePropertyChangeListener, setField
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from interface org.json.simple.JSONAware
toJSONString
 
Methods inherited from interface org.json.simple.JSONStreamAware
writeJSONString
 

Constructor Detail

RestActivityImpl

public RestActivityImpl()
Constructor without any params.

Method Detail

getId

public String getId()
Gets a string ID that is permanently associated with this activity. Container support for this field is OPTIONAL.

Specified by:
getId in interface RestActivity
Returns:
a string ID that is permanently associated with this activity.

setId

public void setId(String id)
Sets a string ID that is permanently associated with this activity. Container support for this field is OPTIONAL.

Specified by:
setId in interface RestActivity
Parameters:
id - a string ID that is permanently associated with this activity.

getTitle

public String getTitle()
Gets a string specifying the primary text of an activity. Container support for this field is REQUIRED. Titles may only have the following HTML tags: <b> <i>, <a>, <span>. The container may ignore this formatting when rendering the activity.

Specified by:
getTitle in interface RestActivity
Returns:
astring specifying the primary text of an activity.

setBody

public void setBody(String title)
Sets the body fields of Activity, this field is optional and use to storage the extended attribute of activity.

Specified by:
setBody in interface RestActivity

getBody

public String getBody()
gets the body fields of Activity, this field is optional and use to storage the extended attribute of activity.

Specified by:
getBody in interface RestActivity
Returns:

setTitle

public void setTitle(String title)
Sets a string specifying the primary text of an activity. Container support for this field is REQUIRED. Titles may only have the following HTML tags: <b> <i>, <a>, <span>. The container may ignore this formatting when rendering the activity.

Specified by:
setTitle in interface RestActivity
Parameters:
title - a string specifying the primary text of an activity.

getTitleId

public String getTitleId()
Gets a string specifying the title template message ID in the gadget spec. Container support for this field is REQUIRED. The title is the primary text of an activity. Titles may only have the following HTML tags: <<b> <i>, <a>, <span>. The container may ignore this formatting when rendering the activity.

Specified by:
getTitleId in interface RestActivity
Returns:
a string specifying the title template message ID in the gadget spec.

setTitleId

public void setTitleId(String titleId)
Sets a string specifying the title template message ID in the gadget spec. Container support for this field is REQUIRED. The title is the primary text of an activity. Titles may only have the following HTML tags: <<b> <i>, <a>, <span>. The container may ignore this formatting when rendering the activity.

Specified by:
setTitleId in interface RestActivity
Parameters:
titleId - a string specifying the title template message ID in the gadget spec.

getAppId

public String getAppId()
Gets a string specifying the application that this activity is associated with. Container support for this field is REQUIRED.

Specified by:
getAppId in interface RestActivity
Returns:
A string specifying the application that this activity is associated with

setAppId

public void setAppId(String appId)
Sets a string specifying the application that this activity is associated with. Container support for this field is REQUIRED.

Specified by:
setAppId in interface RestActivity
Parameters:
appId - A string specifying the application that this activity is associated with

getType

public String getType()
Gets a string specifying the type of activity. Container support for this field is REQUIRED.

Specified by:
getType in interface RestActivity
Returns:
A string specifying the application that this activity is associated with

setType

public void setType(String type)
Sets a string specifying the type of activity. Container support for this field is REQUIRED.

Specified by:
setType in interface RestActivity

getPostedTime

public Long getPostedTime()
Gets the time at which this activity took place in milliseconds since the epoch. Container support for this field is OPTIONAL. Higher priority ones are higher in the list.

Specified by:
getPostedTime in interface RestActivity
Returns:
The time at which this activity took place in milliseconds since the epoch

setPostedTime

public void setPostedTime(Long postedTime)
Sets the time at which this activity took place in milliseconds since the epoch Container support for this field is OPTIONAL. This value can not be set by the end user.

Specified by:
setPostedTime in interface RestActivity
Parameters:
postedTime - the time at which this activity took place in milliseconds since the epoch

getPriority

public Double getPriority()
Gets the priority, a number between 0 and 1 representing the relative priority of this activity in relation to other activities from the same source. Container support for this field is OPTIONAL.

Specified by:
getPriority in interface RestActivity
Returns:
a number between 0 and 1 representing the relative priority of this activity in relation to other activities from the same source

setPriority

public void setPriority(Double priority)
Sets the priority, a number between 0 and 1 representing the relative priority of this activity in relation to other activities from the same source. Container support for this field is OPTIONAL.

Specified by:
setPriority in interface RestActivity
Parameters:
priority - a number between 0 and 1 representing the relative priority of this activity in relation to other activities from the same source.

getTemplateParams

public Map<String,String> getTemplateParams()
Gets a map of custom key/value pairs associated with this activity. Container support for this field is OPTIONAL.

Specified by:
getTemplateParams in interface RestActivity
Returns:
a map of custom key/value pairs associated with this activity.

setTemplateParams

public void setTemplateParams(Map<String,String> templateParams)
Set a map of custom key/value pairs associated with this activity. The data has type Map. The object may be either a String or a Person. When passing in a person with key PersonKey, can use the following replacement variables in the template: Container support for this field is OPTIONAL.

Specified by:
setTemplateParams in interface RestActivity
Parameters:
templateParams - a map of custom key/value pairs associated with this activity.

getIdentityId

public String getIdentityId()
Gets a string uuid of the identity who created this activity.

Specified by:
getIdentityId in interface RestActivity
Returns:
a string ID of the identity who created this activity.

setIdentityId

public void setIdentityId(String identityId)
Sets a string uuid of the identity who created this activity.

Specified by:
setIdentityId in interface RestActivity
Parameters:
identityId - a string ID of the identity who created this activity.

isLiked

public boolean isLiked()
Checks if this activity is liked by current user.

Specified by:
isLiked in interface RestActivity
Returns:
boolean value

getPosterIdentity

public RestIdentity getPosterIdentity()
                               throws SocialClientLibException
Gets the poster identity who created this activity.

Specified by:
getPosterIdentity in interface RestActivity
Returns:
the poster identity
Throws:
SocialClientLibException

getAvailableComments

public List<RestComment> getAvailableComments()
Gets the available list of comments for this activity. Return Number of latest comments of this activity.

Specified by:
getAvailableComments in interface RestActivity
Returns:
Number of latest comments
See Also:
RestActivity.getTotalComments()

setAvailableComments

public void setAvailableComments(List<RestComment> restCommentList)
Sets the available list of comments for this activity.

Specified by:
setAvailableComments in interface RestActivity
Parameters:
restCommentList - available comment list

getTotalNumberOfComments

public int getTotalNumberOfComments()
Gets the number of total comments.

Specified by:
getTotalNumberOfComments in interface RestActivity
Returns:
the the number of total comments

getTotalComments

public List<RestComment> getTotalComments()
                                   throws SocialClientLibException
Gets the total number of comments.

Specified by:
getTotalComments in interface RestActivity
Returns:
the total comment list
Throws:
SocialClientLibException

getActivityStream

public RestActivityStream getActivityStream()
                                     throws SocialClientLibException
Gets activity stream. This is lazy loading.

Specified by:
getActivityStream in interface RestActivity
Returns:
the associated activity stream.
Throws:
SocialClientLibException

getTemplateParameter

public String getTemplateParameter(String name)
Returns the template parameter with the specified name. This is a helper method.

Specified by:
getTemplateParameter in interface RestActivity
Parameters:
name - name of template parameter whose value is to be returned
Returns:
a string associated with a name

addTemplateParameter

public void addTemplateParameter(String name,
                                 String value)
Adds a new template parameter with the specified name and value. This is a helper method.

Specified by:
addTemplateParameter in interface RestActivity
Parameters:
name - name of new template parameter to add
value - value of template parameter to associate with passed name

getTotalNumberOfLikes

public int getTotalNumberOfLikes()
Description copied from interface: RestActivity
Gets the number of total likes.

Specified by:
getTotalNumberOfLikes in interface RestActivity
Returns:
the the number of total likes

getTotalLikes

public List<RestIdentity> getTotalLikes()
                                 throws SocialClientLibException
Description copied from interface: RestActivity
Gets the total number of likes.

Specified by:
getTotalLikes in interface RestActivity
Returns:
the total like list
Throws:
SocialClientLibException

getAvailableLikes

public List<RestIdentity> getAvailableLikes()
Description copied from interface: RestActivity
Gets the available list of likes for this activity. Return Number of latest likes of this activity.

Specified by:
getAvailableLikes in interface RestActivity
Returns:
Number of latest likes
See Also:
RestActivity.getTotalLikes()


Copyright © 2011 eXo Platform. All Rights Reserved.