com.silverpeas.subscribe.service
Class SimpleSubscriptionService

java.lang.Object
  extended by com.silverpeas.subscribe.service.SimpleSubscriptionService
All Implemented Interfaces:
SubscriptionService

@Named(value="subscriptionService")
public class SimpleSubscriptionService
extends Object
implements SubscriptionService

Class declaration

Author:

Constructor Summary
SimpleSubscriptionService()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSubscriptionService

public SimpleSubscriptionService()
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 interface SubscriptionService

subscribe

public void subscribe(Collection<? extends Subscription> subscriptions)
Description copied from interface: SubscriptionService
Register given subscriptions. The informations of creator identifier and creation date are ignored. If a subscription already exists, nothing is registered for it.

Specified by:
subscribe in interface SubscriptionService

unsubscribe

public void unsubscribe(Subscription subscription)
Description copied from interface: SubscriptionService
Unregister a subscription.

Specified by:
unsubscribe in interface SubscriptionService

unsubscribe

public void unsubscribe(Collection<? extends Subscription> subscriptions)
Description copied from interface: SubscriptionService
Unregister given subscriptions.

Specified by:
unsubscribe in interface SubscriptionService

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 interface SubscriptionService

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 interface SubscriptionService

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 interface SubscriptionService
Parameters:
resource - the aimed resource
See Also:

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 interface SubscriptionService
Parameters:
resources - the aimed resources
See Also:

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 interface SubscriptionService
Returns:

getByResource

public SubscriptionList getByResource(SubscriptionResource resource)
Description copied from interface: SubscriptionService
Gets all subscriptions in relation to the given resource.

Specified by:
getByResource in interface SubscriptionService
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.

Specified by:
getByResource in interface SubscriptionService
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 interface SubscriptionService
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 interface SubscriptionService
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 interface SubscriptionService
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 interface SubscriptionService
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 interface SubscriptionService
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 interface SubscriptionService
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 interface SubscriptionService
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 interface SubscriptionService
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 interface SubscriptionService
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 interface SubscriptionService
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


Copyright © 2016 Silverpeas. All Rights Reserved.