org.exoplatform.social.client.core.service
Class ActivityServiceImplV1Alpha2

java.lang.Object
  extended by org.exoplatform.social.client.core.service.ServiceBase<RestActivity,ActivityService<RestActivity>>
      extended by org.exoplatform.social.client.core.service.ActivityServiceImplV1Alpha2
All Implemented Interfaces:
CRUDLifecycle<RestActivity>, Lifecycle<RestActivity,ActivityService<RestActivity>>, ActivityService<RestActivity>, Service<RestActivity>

public class ActivityServiceImplV1Alpha2
extends ServiceBase<RestActivity,ActivityService<RestActivity>>
implements ActivityService<RestActivity>

Implementation of ActivityService.

Since:
Jun 28, 2011
Author:
hoatle (hoatlevan at gmail dot com)

Field Summary
 
Fields inherited from class org.exoplatform.social.client.core.service.ServiceBase
crudLifecycle, lifecycle, started
 
Fields inherited from interface org.exoplatform.social.client.api.event.CRUDLifecycle
AFTER_CREATE_EVENT, AFTER_DELETE_EVENT, AFTER_UPDATE_EVENT, BEFORE_CREATE_EVENT, BEFORE_DELETE_EVENT, BEFORE_UPDATE_EVENT, CREATE_EVENT, DELETE_EVENT, UPDATE_EVENT
 
Fields inherited from interface org.exoplatform.social.client.api.event.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
ActivityServiceImplV1Alpha2()
           
 
Method Summary
 RestActivity create(RestActivity newInstance)
          Creates a new instance.
 RestActivity create(RestActivity newActivity, QueryParams queryParams)
          Create new Activity from current Identity to targetIdentity
 RestComment createComment(RestActivity existingRestActivity, RestComment newRestComment)
          Creates a new comment to this activity.
 RestActivity delete(RestActivity existingInstance)
          Deletes an existing instance.
 RestComment deleteComment(RestComment existingRestComment)
          Deletes an existing comment.
 RestActivity get(String uuid)
          Gets an existing instance by its uuid.
 RestActivity get(String activityId, QueryParams queryParams)
          Gets an existing instance by its activityId and limit the number of comment/like by by input parameter .
 RealtimeListAccess<RestActivity> getActivityStream(RestIdentity restIdentity)
          Gets activity stream from an owner stream identity.
 RealtimeListAccess<RestActivity> getActivityStream(RestIdentity restIdentity, QueryParams queryParams)
          Get Activity Stream with input parameter (limit, number of comment, number of like);
 RestComment getComment(String commentId)
          Gets an existing comment by its id.
 RealtimeListAccess<RestActivity> getConnectionsActivityStream(RestIdentity userRestIdentity)
          Gets all connections' activities aggregated into one stream.
 RealtimeListAccess<RestActivity> getConnectionsActivityStream(RestIdentity restIdentity, QueryParams queryParams)
          Gets all connections' activities aggregated into one stream with input parameter (limit, number of comment, number of like);
 RealtimeListAccess<RestActivity> getFeedActivityStream(RestIdentity userRestIdentity)
          Gets all activities from a stream owner, his connections and spaces aggregated into one stream.
 RealtimeListAccess<RestActivity> getFeedActivityStream(RestIdentity userRestIdentity, QueryParams queryParams)
          Gets all activities from a stream owner, his connections and spaces aggregated into one stream with input parameter (limit, number of comment, number of like);
 RealtimeListAccess<RestActivity> getSpacesActivityStream(RestIdentity userRestIdentity)
          Gets all activities from spaces which a user is a member of that space aggregated into one stream.
 RealtimeListAccess<RestActivity> getSpacesActivityStream(RestIdentity userRestIdentity, QueryParams queryParams)
          Gets all activities from spaces which a user is a member of that space aggregated into one stream with input parameter (limit, number of comment, number of like);
 RestLike like(RestActivity existingRestActivity)
          The authenticate identity likes an existing activity.
 RestLike unlike(RestActivity existingRestActivity)
          The authenticated identity unlikes an existing activity.
 RestActivity update(RestActivity existingInstance)
          Updates an existing instance.
 
Methods inherited from class org.exoplatform.social.client.core.service.ServiceBase
addCRUDLifecycleListener, addLifecycleListener, doCreate, doDelete, doUpdate, findCRUDLifecycleListeners, findLifecycleListeners, postCreate, postDelete, postUpdate, preCreate, preDelete, preUpdate, removeCRUDLifecycleListener, removeLifecycleListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityServiceImplV1Alpha2

public ActivityServiceImplV1Alpha2()
Method Detail

create

public RestActivity create(RestActivity newInstance)
                    throws SocialClientLibException
Creates a new instance.

Specified by:
create in interface Service<RestActivity>
Parameters:
newInstance - new instance
Returns:
the created instance
Throws:
SocialClientLibException

create

public RestActivity create(RestActivity newActivity,
                           QueryParams queryParams)
                    throws SocialClientLibException
Create new Activity from current Identity to targetIdentity

Specified by:
create in interface ActivityService<RestActivity>
Parameters:
newActivity - Activity
queryParams - the query params
Returns:
Throws:
SocialClientLibException

get

public RestActivity get(String uuid)
                 throws SocialClientLibException
Gets an existing instance by its uuid.

Specified by:
get in interface Service<RestActivity>
Parameters:
uuid - the uuid
Returns:
an existing instance
Throws:
SocialClientLibException

update

public RestActivity update(RestActivity existingInstance)
                    throws SocialClientLibException
Updates an existing instance.

Specified by:
update in interface Service<RestActivity>
Returns:
new updated instance
Throws:
SocialClientLibException

delete

public RestActivity delete(RestActivity existingInstance)
                    throws SocialClientLibException
Deletes an existing instance.

Specified by:
delete in interface Service<RestActivity>
Returns:
the deleted instance
Throws:
SocialClientLibException

getActivityStream

public RealtimeListAccess<RestActivity> getActivityStream(RestIdentity restIdentity)
                                                   throws SocialClientLibException
Gets activity stream from an owner stream identity. For example:
    RestIdentity demoIdentity = identityService.get("123456789abcdef");
    RealtimeListAccess activityListAccess = activityService.getActivityStream(demoIdentity);
 
or:
   RestIdentity spaceIdentity = new RestIdentityImpl();
   spaceIdentity.setProviderId("space");
   spaceIdentity.setRemoteId("hello_world");
   RealtimeListAccess activityListAccess = activityService.getActivitySream(spaceIdentity);
 

Specified by:
getActivityStream in interface ActivityService<RestActivity>
Parameters:
restIdentity - the owner stream identity, could be a user or space identity.
Returns:
the real time list access
Throws:
SocialClientLibException

getActivityStream

public RealtimeListAccess<RestActivity> getActivityStream(RestIdentity restIdentity,
                                                          QueryParams queryParams)
                                                   throws SocialClientLibException
Get Activity Stream with input parameter (limit, number of comment, number of like);

Specified by:
getActivityStream in interface ActivityService<RestActivity>
Returns:
Throws:
SocialClientLibException

getSpacesActivityStream

public RealtimeListAccess<RestActivity> getSpacesActivityStream(RestIdentity userRestIdentity)
                                                         throws SocialClientLibException
Gets all activities from spaces which a user is a member of that space aggregated into one stream.

Specified by:
getSpacesActivityStream in interface ActivityService<RestActivity>
Parameters:
userRestIdentity - the associated user identity
Returns:
the real time list access
Throws:
SocialClientLibException

getSpacesActivityStream

public RealtimeListAccess<RestActivity> getSpacesActivityStream(RestIdentity userRestIdentity,
                                                                QueryParams queryParams)
                                                         throws SocialClientLibException
Gets all activities from spaces which a user is a member of that space aggregated into one stream with input parameter (limit, number of comment, number of like);

Specified by:
getSpacesActivityStream in interface ActivityService<RestActivity>
Returns:
Throws:
SocialClientLibException

getConnectionsActivityStream

public RealtimeListAccess<RestActivity> getConnectionsActivityStream(RestIdentity userRestIdentity)
                                                              throws SocialClientLibException
Gets all connections' activities aggregated into one stream.

Specified by:
getConnectionsActivityStream in interface ActivityService<RestActivity>
Parameters:
userRestIdentity - the associated user identity
Returns:
the real time list access
Throws:
SocialClientLibException

getConnectionsActivityStream

public RealtimeListAccess<RestActivity> getConnectionsActivityStream(RestIdentity restIdentity,
                                                                     QueryParams queryParams)
                                                              throws SocialClientLibException
Gets all connections' activities aggregated into one stream with input parameter (limit, number of comment, number of like);

Specified by:
getConnectionsActivityStream in interface ActivityService<RestActivity>
Returns:
Throws:
SocialClientLibException

getFeedActivityStream

public RealtimeListAccess<RestActivity> getFeedActivityStream(RestIdentity userRestIdentity)
                                                       throws SocialClientLibException
Gets all activities from a stream owner, his connections and spaces aggregated into one stream.

Specified by:
getFeedActivityStream in interface ActivityService<RestActivity>
Parameters:
userRestIdentity - the associated user identity
Returns:
the realtime list access
Throws:
SocialClientLibException

getFeedActivityStream

public RealtimeListAccess<RestActivity> getFeedActivityStream(RestIdentity userRestIdentity,
                                                              QueryParams queryParams)
                                                       throws SocialClientLibException
Gets all activities from a stream owner, his connections and spaces aggregated into one stream with input parameter (limit, number of comment, number of like);

Specified by:
getFeedActivityStream in interface ActivityService<RestActivity>
Returns:
Throws:
SocialClientLibException

createComment

public RestComment createComment(RestActivity existingRestActivity,
                                 RestComment newRestComment)
                          throws SocialClientLibException
Creates a new comment to this activity.

Specified by:
createComment in interface ActivityService<RestActivity>
Parameters:
existingRestActivity - the existing activity
newRestComment - the new created comment
Returns:
the created comment
Throws:
SocialClientLibException

getComment

public RestComment getComment(String commentId)
                       throws SocialClientLibException
Gets an existing comment by its id.

Specified by:
getComment in interface ActivityService<RestActivity>
Parameters:
commentId - the comment id
Returns:
the existing comment with the specified id
Throws:
SocialClientLibException

deleteComment

public RestComment deleteComment(RestComment existingRestComment)
                          throws SocialClientLibException
Deletes an existing comment.

Specified by:
deleteComment in interface ActivityService<RestActivity>
Parameters:
existingRestComment - the existing comment
Returns:
the deleted comment
Throws:
SocialClientLibException

like

public RestLike like(RestActivity existingRestActivity)
              throws SocialClientLibException
The authenticate identity likes an existing activity.

Specified by:
like in interface ActivityService<RestActivity>
Parameters:
existingRestActivity - the existing activity
Returns:
the created RestLike instance
Throws:
SocialClientLibException

unlike

public RestLike unlike(RestActivity existingRestActivity)
                throws SocialClientLibException
The authenticated identity unlikes an existing activity.

Specified by:
unlike in interface ActivityService<RestActivity>
Parameters:
existingRestActivity - the existing activity
Returns:
the deleted RestLike instance.
Throws:
SocialClientLibException

get

public RestActivity get(String activityId,
                        QueryParams queryParams)
                 throws SocialClientLibException
Gets an existing instance by its activityId and limit the number of comment/like by by input parameter .

Specified by:
get in interface ActivityService<RestActivity>
Parameters:
activityId - the activityId
queryParams - the query params
Returns:
an existing instance
Throws:
SocialClientLibException


Copyright © 2011-2012 eXo Platform. All Rights Reserved.