Package org.alfresco.repo.subscriptions
Class SubscriptionServiceImpl
- java.lang.Object
-
- org.alfresco.repo.subscriptions.SubscriptionServiceImpl
-
- All Implemented Interfaces:
ActivateableBean,SubscriptionService
public class SubscriptionServiceImpl extends java.lang.Object implements SubscriptionService
-
-
Field Summary
Fields Modifier and Type Field Description protected ActionServiceactionServiceprotected booleanactiveprotected ActivityServiceactivityServiceprotected AuthorityServiceauthorityServiceprotected FileFolderServicefileFolderServiceprotected org.alfresco.service.namespace.NamespaceServicenamespaceServiceprotected org.alfresco.service.cmr.repository.NodeServicenodeServiceprotected PersonServicepersonServiceprotected org.alfresco.service.cmr.search.SearchServicesearchServiceprotected SubscriptionsDAOsubscriptionsDAO
-
Constructor Summary
Constructors Constructor Description SubscriptionServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckEnabled()Checks if the subscription service is enabled.protected voidcheckRead(java.lang.String userId, boolean checkPrivate)Checks if the current user is allowed to get subscription data.protected voidcheckUserNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)Checks if the node is a user node and throws an exception if it id not.protected voidcheckWrite(java.lang.String userId)Checks if the current user is allowed to get change data.voidfollow(java.lang.String userId, java.lang.String userToFollow)Follows a user.booleanfollows(java.lang.String userId, java.lang.String userToFollow)Returns if the user follows to the given other user.protected java.lang.StringgetEmailTemplateRef()Returns the NodeRef of the email template ornullif the template coudln't be found.PagingFollowingResultsgetFollowers(java.lang.String userId, org.alfresco.query.PagingRequest pagingRequest)Returns a list of users that follow the given user.intgetFollowersCount(java.lang.String userId)Returns how many users follow the given user.PagingFollowingResultsgetFollowing(java.lang.String userId, org.alfresco.query.PagingRequest pagingRequest)Returns a list of users that the given user follows.intgetFollowingCount(java.lang.String userId)Returns how many users the given user follows.intgetSubscriptionCount(java.lang.String userId, SubscriptionItemTypeEnum type)Returns how many nodes the given user has subscribed to.PagingSubscriptionResultsgetSubscriptions(java.lang.String userId, SubscriptionItemTypeEnum type, org.alfresco.query.PagingRequest pagingRequest)Returns the nodes a user has subscribed to.protected org.alfresco.service.cmr.repository.NodeRefgetUserNodeRef(java.lang.String userId)Gets the user node ref from the user id.booleanhasSubscribed(java.lang.String userId, org.alfresco.service.cmr.repository.NodeRef node)Returns if the user has subscribed to the given node.booleanisActive()Returns if subscription are enabled for this system.booleanisSubscriptionListPrivate(java.lang.String userId)Returns if the subscription list of the given user is set to private.protected voidsendFollowingMail(java.lang.String userId, java.lang.String userToFollow)Sends an email to the person that is followed.voidsetActionService(ActionService actionService)Sets the action service.voidsetActive(boolean active)voidsetActivityService(ActivityService activictyService)Sets the activity service.voidsetAuthorityService(AuthorityService authorityService)Sets the authority service.voidsetFileFolderService(FileFolderService fileFolderService)Set the fileFolder service.voidsetFollowingEmailTemplateLocation(RepositoryLocation followingEmailTemplateLocation)voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)Set the namespace service.voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)Sets the node service.voidsetPersonService(PersonService personService)Sets the person service.voidsetSearchService(org.alfresco.service.cmr.search.SearchService searchService)Set the search service.voidsetSubscriptionListPrivate(java.lang.String userId, boolean isPrivate)Sets or unsets the subscription list of the given user to private.voidsetSubscriptionsDAO(SubscriptionsDAO subscriptionsDAO)Sets the subscriptions DAO.voidsubscribe(java.lang.String userId, org.alfresco.service.cmr.repository.NodeRef node)Subscribes to a node.voidunfollow(java.lang.String userId, java.lang.String userToUnfollow)Unfollows a user.voidunsubscribe(java.lang.String userId, org.alfresco.service.cmr.repository.NodeRef node)Unsubscribes from a node.
-
-
-
Field Detail
-
subscriptionsDAO
protected SubscriptionsDAO subscriptionsDAO
-
nodeService
protected org.alfresco.service.cmr.repository.NodeService nodeService
-
personService
protected PersonService personService
-
activityService
protected ActivityService activityService
-
authorityService
protected AuthorityService authorityService
-
actionService
protected ActionService actionService
-
searchService
protected org.alfresco.service.cmr.search.SearchService searchService
-
namespaceService
protected org.alfresco.service.namespace.NamespaceService namespaceService
-
fileFolderService
protected FileFolderService fileFolderService
-
active
protected boolean active
-
-
Method Detail
-
setSubscriptionsDAO
public void setSubscriptionsDAO(SubscriptionsDAO subscriptionsDAO)
Sets the subscriptions DAO.
-
setNodeService
public final void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Sets the node service.
-
setPersonService
public final void setPersonService(PersonService personService)
Sets the person service.
-
setActivityService
public final void setActivityService(ActivityService activictyService)
Sets the activity service.
-
setAuthorityService
public final void setAuthorityService(AuthorityService authorityService)
Sets the authority service.
-
setActionService
public final void setActionService(ActionService actionService)
Sets the action service.
-
setSearchService
public final void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
Set the search service.
-
setNamespaceService
public final void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
Set the namespace service.
-
setFileFolderService
public final void setFileFolderService(FileFolderService fileFolderService)
Set the fileFolder service.
-
setActive
public final void setActive(boolean active)
-
setFollowingEmailTemplateLocation
public void setFollowingEmailTemplateLocation(RepositoryLocation followingEmailTemplateLocation)
-
getSubscriptions
public PagingSubscriptionResults getSubscriptions(java.lang.String userId, SubscriptionItemTypeEnum type, org.alfresco.query.PagingRequest pagingRequest)
Description copied from interface:SubscriptionServiceReturns the nodes a user has subscribed to.- Specified by:
getSubscriptionsin interfaceSubscriptionService- Parameters:
userId- the id of the usertype- the type of the nodespagingRequest- paging details
-
getSubscriptionCount
public int getSubscriptionCount(java.lang.String userId, SubscriptionItemTypeEnum type)Description copied from interface:SubscriptionServiceReturns how many nodes the given user has subscribed to.- Specified by:
getSubscriptionCountin interfaceSubscriptionService- Parameters:
userId- the id of the usertype- the type of the nodes
-
subscribe
public void subscribe(java.lang.String userId, org.alfresco.service.cmr.repository.NodeRef node)Description copied from interface:SubscriptionServiceSubscribes to a node.- Specified by:
subscribein interfaceSubscriptionService- Parameters:
userId- id of the usernode- the node
-
unsubscribe
public void unsubscribe(java.lang.String userId, org.alfresco.service.cmr.repository.NodeRef node)Description copied from interface:SubscriptionServiceUnsubscribes from a node.- Specified by:
unsubscribein interfaceSubscriptionService- Parameters:
userId- id of the usernode- the node
-
hasSubscribed
public boolean hasSubscribed(java.lang.String userId, org.alfresco.service.cmr.repository.NodeRef node)Description copied from interface:SubscriptionServiceReturns if the user has subscribed to the given node.- Specified by:
hasSubscribedin interfaceSubscriptionService- Parameters:
userId- id of the usernode- the node
-
getFollowing
public PagingFollowingResults getFollowing(java.lang.String userId, org.alfresco.query.PagingRequest pagingRequest)
Description copied from interface:SubscriptionServiceReturns a list of users that the given user follows.- Specified by:
getFollowingin interfaceSubscriptionService- Parameters:
userId- id of the userpagingRequest- paging details
-
getFollowingCount
public int getFollowingCount(java.lang.String userId)
Description copied from interface:SubscriptionServiceReturns how many users the given user follows.- Specified by:
getFollowingCountin interfaceSubscriptionService- Parameters:
userId- the id of the user
-
getFollowers
public PagingFollowingResults getFollowers(java.lang.String userId, org.alfresco.query.PagingRequest pagingRequest)
Description copied from interface:SubscriptionServiceReturns a list of users that follow the given user.- Specified by:
getFollowersin interfaceSubscriptionService- Parameters:
userId- id of the userpagingRequest- paging details
-
getFollowersCount
public int getFollowersCount(java.lang.String userId)
Description copied from interface:SubscriptionServiceReturns how many users follow the given user.- Specified by:
getFollowersCountin interfaceSubscriptionService- Parameters:
userId- the id of the user
-
follow
public void follow(java.lang.String userId, java.lang.String userToFollow)Description copied from interface:SubscriptionServiceFollows a user.- Specified by:
followin interfaceSubscriptionService- Parameters:
userId- the id of the useruserToFollow- the id of the user to follow
-
unfollow
public void unfollow(java.lang.String userId, java.lang.String userToUnfollow)Description copied from interface:SubscriptionServiceUnfollows a user.- Specified by:
unfollowin interfaceSubscriptionService- Parameters:
userId- the id of the useruserToUnfollow- the id of the user to unfollow
-
follows
public boolean follows(java.lang.String userId, java.lang.String userToFollow)Description copied from interface:SubscriptionServiceReturns if the user follows to the given other user.- Specified by:
followsin interfaceSubscriptionService- Parameters:
userId- id of the useruserToFollow- the id of the other user
-
setSubscriptionListPrivate
public void setSubscriptionListPrivate(java.lang.String userId, boolean isPrivate)Description copied from interface:SubscriptionServiceSets or unsets the subscription list of the given user to private.- Specified by:
setSubscriptionListPrivatein interfaceSubscriptionService- Parameters:
userId- the id of the userisPrivate-true- set list private,false- set list public
-
isSubscriptionListPrivate
public boolean isSubscriptionListPrivate(java.lang.String userId)
Description copied from interface:SubscriptionServiceReturns if the subscription list of the given user is set to private.- Specified by:
isSubscriptionListPrivatein interfaceSubscriptionService- Parameters:
userId- the id of the user
-
isActive
public boolean isActive()
Description copied from interface:SubscriptionServiceReturns if subscription are enabled for this system.- Specified by:
isActivein interfaceActivateableBean- Specified by:
isActivein interfaceSubscriptionService- Returns:
trueif this bean is active
-
checkEnabled
protected void checkEnabled()
Checks if the subscription service is enabled.
-
checkRead
protected void checkRead(java.lang.String userId, boolean checkPrivate)Checks if the current user is allowed to get subscription data.
-
checkWrite
protected void checkWrite(java.lang.String userId)
Checks if the current user is allowed to get change data.
-
getUserNodeRef
protected org.alfresco.service.cmr.repository.NodeRef getUserNodeRef(java.lang.String userId)
Gets the user node ref from the user id.
-
checkUserNode
protected void checkUserNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Checks if the node is a user node and throws an exception if it id not.
-
sendFollowingMail
protected void sendFollowingMail(java.lang.String userId, java.lang.String userToFollow)Sends an email to the person that is followed.
-
getEmailTemplateRef
protected java.lang.String getEmailTemplateRef()
Returns the NodeRef of the email template ornullif the template coudln't be found.
-
-