Class SimpleSubscriptionService
- java.lang.Object
-
- org.silverpeas.core.subscription.service.SimpleSubscriptionService
-
- All Implemented Interfaces:
Serializable
,ComponentInstanceDeletion
,SubscriptionService
@Service @Named("subscriptionService") public class SimpleSubscriptionService extends Object implements SubscriptionService, ComponentInstanceDeletion
Class declaration- Author:
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleSubscriptionService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(String componentInstanceId)
Deletes the resources belonging to the specified component instance.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 userId, 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
public void subscribe(Subscription subscription)
Description copied from interface:SubscriptionService
Register a subscription. The informations of creator identifier and creation date are ignored. If subscription already exists, nothing is registered.- Specified by:
subscribe
in interfaceSubscriptionService
-
subscribe
public void subscribe(Collection<? extends Subscription> subscriptions)
Description copied from interface:SubscriptionService
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
- Specified by:
subscribe
in interfaceSubscriptionService
-
unsubscribe
public void unsubscribe(Subscription subscription)
Description copied from interface:SubscriptionService
Unregister a subscription.- Specified by:
unsubscribe
in interfaceSubscriptionService
-
unsubscribe
public void unsubscribe(Collection<? extends Subscription> subscriptions)
Description copied from interface:SubscriptionService
Unregister given subscriptions.- Specified by:
unsubscribe
in interfaceSubscriptionService
-
unsubscribeBySubscriber
public void unsubscribeBySubscriber(SubscriptionSubscriber subscriber)
Description copied from interface:SubscriptionService
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- Specified by:
unsubscribeBySubscriber
in interfaceSubscriptionService
-
unsubscribeBySubscribers
public void unsubscribeBySubscribers(Collection<? extends SubscriptionSubscriber> subscribers)
Description copied from interface:SubscriptionService
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- Specified by:
unsubscribeBySubscribers
in interfaceSubscriptionService
-
unsubscribeByResource
public void unsubscribeByResource(SubscriptionResource resource)
Description copied from interface:SubscriptionService
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- Specified by:
unsubscribeByResource
in interfaceSubscriptionService
- Parameters:
resource
- the aimed resource
-
unsubscribeByResources
public void unsubscribeByResources(Collection<? extends SubscriptionResource> resources)
Description copied from interface:SubscriptionService
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- Specified by:
unsubscribeByResources
in interfaceSubscriptionService
- Parameters:
resources
- the aimed resources
-
existsSubscription
public boolean existsSubscription(Subscription subscription)
Description copied from interface:SubscriptionService
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.- Specified by:
existsSubscription
in interfaceSubscriptionService
- Returns:
-
getByResource
public SubscriptionList getByResource(SubscriptionResource resource)
Description copied from interface:SubscriptionService
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.
- Specified by:
getByResource
in interfaceSubscriptionService
- Parameters:
resource
- a resource subscription which could have no instance id specified.- Returns:
- list of subscriptions
-
getByResource
public SubscriptionList getByResource(SubscriptionResource resource, SubscriptionMethod method)
Description copied from interface:SubscriptionService
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.
- Specified by:
getByResource
in interfaceSubscriptionService
- Parameters:
resource
- a resource subscription which could have no instance id specified.method
- an optional subscription method.- Returns:
- list of subscriptions
-
getByUserSubscriber
public SubscriptionList getByUserSubscriber(String userId)
Description copied from interface:SubscriptionService
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a user.- Specified by:
getByUserSubscriber
in interfaceSubscriptionService
- 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
public SubscriptionList getBySubscriber(SubscriptionSubscriber subscriber)
Description copied from interface:SubscriptionService
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a subscriber.- Specified by:
getBySubscriber
in interfaceSubscriptionService
- Returns:
- list of subscriptions
-
getBySubscriberAndComponent
public SubscriptionList getBySubscriberAndComponent(SubscriptionSubscriber subscriber, String instanceId)
Description copied from interface:SubscriptionService
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a subscriber and a component (NODE or COMPONENT resources).- Specified by:
getBySubscriberAndComponent
in interfaceSubscriptionService
- Returns:
- list of subscriptions
-
getBySubscriberAndResource
public SubscriptionList getBySubscriberAndResource(SubscriptionSubscriber subscriber, SubscriptionResource resource)
Description copied from interface:SubscriptionService
Gets all subscriptions (COMPONENT/NODE and SELF_CREATION/FORCED) in relation to a subscriber and a resource.- Specified by:
getBySubscriberAndResource
in interfaceSubscriptionService
- Returns:
- list of subscriptions
-
getSubscribers
public SubscriptionSubscriberList getSubscribers(SubscriptionResource resource)
Description copied from interface:SubscriptionService
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.- Specified by:
getSubscribers
in interfaceSubscriptionService
- Returns:
- list of subscription subscribers
-
getSubscribers
public SubscriptionSubscriberList getSubscribers(SubscriptionResource resource, SubscriptionMethod method)
Description copied from interface:SubscriptionService
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.- Specified by:
getSubscribers
in interfaceSubscriptionService
- Returns:
- list of subscription subscribers
-
getSubscribers
public SubscriptionSubscriberList getSubscribers(Collection<? extends SubscriptionResource> resources)
Description copied from interface:SubscriptionService
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.- Specified by:
getSubscribers
in interfaceSubscriptionService
- Returns:
- list of subscription subscribers
-
getSubscribers
public SubscriptionSubscriberList getSubscribers(Collection<? extends SubscriptionResource> resources, SubscriptionMethod method)
Description copied from interface:SubscriptionService
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.- Specified by:
getSubscribers
in interfaceSubscriptionService
- Returns:
- list of subscription subscribers
-
isSubscriberSubscribedToResource
public boolean isSubscriberSubscribedToResource(SubscriptionSubscriber subscriber, SubscriptionResource resource)
Description copied from interface:SubscriptionService
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.- Specified by:
isSubscriberSubscribedToResource
in interfaceSubscriptionService
- Returns:
- true if the given subscriber is subscribed to given resource
-
isUserSubscribedToResource
public boolean isUserSubscribedToResource(String userId, SubscriptionResource resource)
Description copied from interface:SubscriptionService
Indicates if a user is subscribed to a resource.- Specified by:
isUserSubscribedToResource
in interfaceSubscriptionService
- 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
-
delete
public void delete(String componentInstanceId)
Deletes the resources belonging to the specified component instance. This method is invoked by Silverpeas when a component instance is being deleted.- Specified by:
delete
in interfaceComponentInstanceDeletion
- Parameters:
componentInstanceId
- the unique identifier of a component instance.
-
-