Package org.silverpeas.core.subscription
Interface SubscriptionService
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
SimpleSubscriptionService
public interface SubscriptionService extends Serializable
Interface declaration- Author:
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
existsSubscription(Subscription subscription)
Checks if the given subscription already exists.SubscriptionList
getByResource(SubscriptionResource resource)
Gets all subscriptions in relation to the given resource.SubscriptionList
getByResource(SubscriptionResource resource, SubscriptionMethod method)
Gets all subscriptions in relation to the given resource.SubscriptionList
getBySubscriber(SubscriptionSubscriber subscriber)
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a subscriber.SubscriptionList
getBySubscriberAndComponent(SubscriptionSubscriber subscriber, String instanceId)
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a subscriber and a component (NODE or COMPONENT resources).SubscriptionList
getBySubscriberAndResource(SubscriptionSubscriber subscriber, SubscriptionResource resource)
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a subscriber and a resource.SubscriptionList
getByUserSubscriber(String userId)
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a user.SubscriptionSubscriberList
getSubscribers(Collection<? extends SubscriptionResource> resources)
Gets all subscribers (USER and/or GROUP) that are subscribed to given resources.SubscriptionSubscriberList
getSubscribers(Collection<? extends SubscriptionResource> resources, SubscriptionMethod method)
Gets all subscribers (USER and/or GROUP) that are subscribed to given resources.SubscriptionSubscriberList
getSubscribers(SubscriptionResource resource)
Gets all subscribers (USER and/or GROUP) that are subscribed to a resource.SubscriptionSubscriberList
getSubscribers(SubscriptionResource resource, SubscriptionMethod method)
Gets all subscribers (USER and/or GROUP) that are subscribed to a resource.boolean
isSubscriberSubscribedToResource(SubscriptionSubscriber subscriber, SubscriptionResource resource)
Indicates if a subscriber is subscribed to a resource.boolean
isUserSubscribedToResource(String user, SubscriptionResource resource)
Indicates if a user is subscribed to a resource.void
subscribe(Collection<? extends Subscription> subscriptions)
Register given subscriptions.void
subscribe(Subscription subscription)
Register a subscription.void
unsubscribe(Collection<? extends Subscription> subscriptions)
Unregister given subscriptions.void
unsubscribe(Subscription subscription)
Unregister a subscription.void
unsubscribeByResource(SubscriptionResource resource)
Unregister all subscriptions in relation to the given resource.void
unsubscribeByResources(Collection<? extends SubscriptionResource> resources)
Unregister all subscriptions in relation to the given resources.void
unsubscribeBySubscriber(SubscriptionSubscriber subscriber)
Unregister all subscription in relation to the given subscriber.void
unsubscribeBySubscribers(Collection<? extends SubscriptionSubscriber> subscribers)
Unregister all subscription in relation to given subscribers.
-
-
-
Method Detail
-
subscribe
void subscribe(Subscription subscription)
Register a subscription. The informations of creator identifier and creation date are ignored. If subscription already exists, nothing is registered.- Parameters:
subscription
-
-
subscribe
void subscribe(Collection<? extends Subscription> subscriptions) throws SubscribeRuntimeException
Register given subscriptions. The information of creator identifier and creation date are ignored. If a subscription already exists, nothing is registered for it.IMPORTANT: runtime error will be thrown if subscription is created with Anonymous or Guest user
- Parameters:
subscriptions
-- Throws:
SubscribeRuntimeException
- if attempting to create subscription with Anonymous or Guest user.
-
unsubscribe
void unsubscribe(Subscription subscription)
Unregister a subscription.- Parameters:
subscription
-
-
unsubscribe
void unsubscribe(Collection<? extends Subscription> subscriptions)
Unregister given subscriptions.- Parameters:
subscriptions
-
-
unsubscribeBySubscriber
void unsubscribeBySubscriber(SubscriptionSubscriber subscriber)
Unregister all subscription in relation to the given subscriber. If the given subscriber is a user, no subscription by a group is deleted even if the user is part of the group- Parameters:
subscriber
-
-
unsubscribeBySubscribers
void unsubscribeBySubscribers(Collection<? extends SubscriptionSubscriber> subscribers)
Unregister all subscription in relation to given subscribers. If a given subscriber is a user, no subscription by a group is deleted even if the user is part of the group- Parameters:
subscribers
-
-
unsubscribeByResource
void unsubscribeByResource(SubscriptionResource resource)
Unregister all subscriptions in relation to the given resource. If given resource is a node, please notice that subscriptions of linked nodes (sub nodes) are not deleted- Parameters:
resource
- the aimed resource
-
unsubscribeByResources
void unsubscribeByResources(Collection<? extends SubscriptionResource> resources)
Unregister all subscriptions in relation to the given resources. If it exists one or several resources of nodes, please notice that subscriptions of linked nodes (sub nodes) are not deleted- Parameters:
resources
- the aimed resources
-
existsSubscription
boolean existsSubscription(Subscription subscription)
Checks if the given subscription already exists. If the given subscription subscriber is a user but that this user is subscribed only through a group subscription, the method will return false.- Parameters:
subscription
-- Returns:
-
getByResource
SubscriptionList getByResource(SubscriptionResource resource)
Gets all subscriptions in relation to the given resource.
It is possible here to not specify the instance id the resource is linked to, but BE CAREFUL to do that with resources having a unique identifier.
- Parameters:
resource
- a resource subscription which could have no instance id specified.- Returns:
- list of subscriptions
-
getByResource
SubscriptionList getByResource(SubscriptionResource resource, SubscriptionMethod method)
Gets all subscriptions in relation to the given resource.
It is possible here to not specify the instance id the resource is linked to, but BE CAREFUL to do that with resources having a unique identifier.
- Parameters:
resource
- a resource subscription which could have no instance id specified.method
- an optional subscription method.- Returns:
- list of subscriptions
-
getByUserSubscriber
SubscriptionList getByUserSubscriber(String userId)
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a user.- Parameters:
userId
-- Returns:
- list of subscriptions of users that have subscribed themselves, of users that are subscribed through a subscribed group and of users that have been subscribed by an other user
-
getBySubscriber
SubscriptionList getBySubscriber(SubscriptionSubscriber subscriber)
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a subscriber.- Parameters:
subscriber
-- Returns:
- list of subscriptions
-
getBySubscriberAndComponent
SubscriptionList getBySubscriberAndComponent(SubscriptionSubscriber subscriber, String instanceId)
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a subscriber and a component (NODE or COMPONENT resources).- Parameters:
subscriber
-instanceId
-- Returns:
- list of subscriptions
-
getBySubscriberAndResource
SubscriptionList getBySubscriberAndResource(SubscriptionSubscriber subscriber, SubscriptionResource resource)
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a subscriber and a resource.- Parameters:
subscriber
-resource
-- Returns:
- list of subscriptions
-
getSubscribers
SubscriptionSubscriberList getSubscribers(SubscriptionResource resource)
Gets all subscribers (USER and/or GROUP) that are subscribed to a resource. If a group subscriber is returned into result, caller has to perform it. User subscribers depending to a group subscription are not returned.- Parameters:
resource
-- Returns:
- list of subscription subscribers
-
getSubscribers
SubscriptionSubscriberList getSubscribers(SubscriptionResource resource, SubscriptionMethod method)
Gets all subscribers (USER and/or GROUP) that are subscribed to a resource. If a group subscriber is returned into result, caller has to perform it. User subscribers depending to a group subscription are not returned.- Parameters:
resource
-method
-- Returns:
- list of subscription subscribers
-
getSubscribers
SubscriptionSubscriberList getSubscribers(Collection<? extends SubscriptionResource> resources)
Gets all subscribers (USER and/or GROUP) that are subscribed to given resources. If a group subscriber is returned into result, caller has to perform it. User subscribers depending to a group subscription are not returned.- Parameters:
resources
-- Returns:
- list of subscription subscribers
-
getSubscribers
SubscriptionSubscriberList getSubscribers(Collection<? extends SubscriptionResource> resources, SubscriptionMethod method)
Gets all subscribers (USER and/or GROUP) that are subscribed to given resources. If a group subscriber is returned into result, caller has to perform it. User subscribers depending to a group subscription are not returned.- Parameters:
resources
-method
-- Returns:
- list of subscription subscribers
-
isSubscriberSubscribedToResource
boolean isSubscriberSubscribedToResource(SubscriptionSubscriber subscriber, SubscriptionResource resource)
Indicates if a subscriber is subscribed to a resource. If user subscriber is searched but that the user is subscribed only through a group subscription, the method will return false.- Parameters:
subscriber
-resource
-- Returns:
- true if the given subscriber is subscribed to given resource
-
isUserSubscribedToResource
boolean isUserSubscribedToResource(String user, SubscriptionResource resource)
Indicates if a user is subscribed to a resource.- Parameters:
user
-resource
-- Returns:
- true if user has subscribed himself, or if user is subscribed through a subscribed group or if user has been subscribed by an other user
-
-