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

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

public class ActivityServiceImpl
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
ActivityServiceImpl()
           
 
Method Summary
 RestActivity create(RestActivity newInstance)
          Creates a new instance.
 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.
 RealtimeListAccess<RestActivity> getActivityStream(RestIdentity restIdentity)
          Gets activity stream from an owner stream identity.
 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> getFeedActivityStream(RestIdentity userRestIdentity)
          Gets all activities from a stream owner, his connections and spaces aggregated into one stream.
 RealtimeListAccess<RestActivity> getSpacesActivityStream(RestIdentity userRestIdentity)
          Gets all activities from spaces which a user is a member of that space aggregated into one stream.
 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

ActivityServiceImpl

public ActivityServiceImpl()
Method Detail

create

public RestActivity create(RestActivity newInstance)
                    throws AccessDeniedException,
                           ServiceException
Creates a new instance.

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

get

public RestActivity get(String uuid)
                 throws AccessDeniedException,
                        ServiceException
Gets an existing instance by its uuid.

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

update

public RestActivity update(RestActivity existingInstance)
                    throws AccessDeniedException,
                           ServiceException
Updates an existing instance.

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

delete

public RestActivity delete(RestActivity existingInstance)
                    throws AccessDeniedException,
                           ServiceException
Deletes an existing instance.

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

getActivityStream

public RealtimeListAccess<RestActivity> getActivityStream(RestIdentity restIdentity)
                                                   throws AccessDeniedException,
                                                          ServiceException
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:
AccessDeniedException
ServiceException

getSpacesActivityStream

public RealtimeListAccess<RestActivity> getSpacesActivityStream(RestIdentity userRestIdentity)
                                                         throws AccessDeniedException,
                                                                ServiceException
Description copied from interface: ActivityService
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:
AccessDeniedException
ServiceException

getConnectionsActivityStream

public RealtimeListAccess<RestActivity> getConnectionsActivityStream(RestIdentity userRestIdentity)
                                                              throws AccessDeniedException,
                                                                     ServiceException
Description copied from interface: ActivityService
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:
AccessDeniedException
ServiceException

getFeedActivityStream

public RealtimeListAccess<RestActivity> getFeedActivityStream(RestIdentity userRestIdentity)
                                                       throws AccessDeniedException,
                                                              ServiceException
Description copied from interface: ActivityService
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:
AccessDeniedException
ServiceException

createComment

public RestComment createComment(RestActivity existingRestActivity,
                                 RestComment newRestComment)
                          throws AccessDeniedException,
                                 ServiceException
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:
AccessDeniedException
ServiceException

getComment

public RestComment getComment(String commentId)
                       throws AccessDeniedException,
                              ServiceException
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:
AccessDeniedException
ServiceException

deleteComment

public RestComment deleteComment(RestComment existingRestComment)
                          throws AccessDeniedException,
                                 ServiceException
Deletes an existing comment.

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

like

public RestLike like(RestActivity existingRestActivity)
              throws AccessDeniedException,
                     ServiceException
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:
AccessDeniedException
ServiceException

unlike

public RestLike unlike(RestActivity existingRestActivity)
                throws AccessDeniedException,
                       ServiceException
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:
AccessDeniedException
ServiceException


Copyright © 2011 eXo Platform. All Rights Reserved.