com.silverpeas.subscribe.web
Class SubscriptionResource

java.lang.Object
  extended by com.silverpeas.web.RESTWebService
      extended by com.silverpeas.subscribe.web.SubscriptionResource

@Service
@RequestScoped
@Authorized
public class SubscriptionResource
extends RESTWebService

A REST Web resource representing a given subscription. It is a web service that provides an access to a subscription referenced by its URL.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.silverpeas.web.RESTWebService
RESTWebService.WebProcess<RETURN_VALUE>, RESTWebService.WebTreatment<RETURN_VALUE>
 
Field Summary
 
Fields inherited from class com.silverpeas.web.RESTWebService
RESPONSE_HEADER_ARRAYSIZE, REST_WEB_SERVICES_URI_BASE
 
Constructor Summary
SubscriptionResource()
           
 
Method Summary
protected  Collection<SubscriberEntity> asSubscriberWebEntities(Collection<SubscriptionSubscriber> subscribers)
          Gets WEB entity collection representing the given subscriber collection.
protected  SubscriberEntity asSubscriberWebEntity(SubscriptionSubscriber subscriber)
          Gets the WEB entity representing the given subscriber.
protected  Collection<SubscriptionEntity> asWebEntities(Collection<Subscription> subscriptions)
          Gets WEB entity collection representing the given subscription collection.
protected  SubscriptionEntity asWebEntity(Subscription subscription)
          Gets the WEB entity representing the given subscription.
 String getComponentId()
          Gets the identifier of the component instance to which the requested resource belongs to.
 Collection<SubscriberEntity> getComponentSubscribers()
          Gets the JSON representation of component subscription subscribers.
 javax.ws.rs.core.Response getComponentSubscribersWithInheritance(String subscriptionType, boolean existenceIndicatorOnly)
          Gets the JSON representation of resource subscription subscribers with inheritance.
 Collection<SubscriptionEntity> getComponentSubscriptions()
          Gets the JSON representation of component subscriptions in relation with the user.
 Collection<SubscriberEntity> getSubscribers(String resourceId)
          Gets the JSON representation of component/node subscription subscribers.
 javax.ws.rs.core.Response getSubscribersWithInheritance(String subscriptionType, String resourceId, boolean existenceIndicatorOnly)
          Gets the JSON representation of resource subscription subscribers with inheritance.
 Collection<SubscriptionEntity> getSubscriptions(String resourceId)
          Gets the JSON representation of component/node subscriptions of a resource.
 
Methods inherited from class com.silverpeas.web.RESTWebService
getBundle, getBundleLocation, getGreaterUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getUriInfo, getUserDetail, getUserPreferences, getUserRoles, process, validateUserAuthentication, validateUserAuthorization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubscriptionResource

public SubscriptionResource()
Method Detail

getComponentSubscriptions

public Collection<SubscriptionEntity> getComponentSubscriptions()
Gets the JSON representation of component subscriptions in relation with the user. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.

Returns:
the response to the HTTP GET request with the JSON representation of the asked component subscriptions.

getSubscriptions

public Collection<SubscriptionEntity> getSubscriptions(String resourceId)
Gets the JSON representation of component/node subscriptions of a resource. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.

Parameters:
resourceId - identifier of the aimed resource (NODE for now). When a new type of resource will be managed, the resource type will have to be passed into URI
Returns:
the response to the HTTP GET request with the JSON representation of the asked component subscriptions.

getComponentSubscribers

public Collection<SubscriberEntity> getComponentSubscribers()
Gets the JSON representation of component subscription subscribers. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.

Returns:
the response to the HTTP GET request with the JSON representation of the asked component subscriptions.

getSubscribers

public Collection<SubscriberEntity> getSubscribers(String resourceId)
Gets the JSON representation of component/node subscription subscribers. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.

Parameters:
resourceId - identifier of the aimed resource (NODE for now). When a new type of resource will be managed, the resource type will have to be passed into URI
Returns:
the response to the HTTP GET request with the JSON representation of the asked component subscriptions.

getComponentSubscribersWithInheritance

public javax.ws.rs.core.Response getComponentSubscribersWithInheritance(String subscriptionType,
                                                                        boolean existenceIndicatorOnly)
Gets the JSON representation of resource subscription subscribers with inheritance. For example, it returns subscribers af a node and those of its parents too. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.

Parameters:
subscriptionType - the type of subscription.
existenceIndicatorOnly - indicates if the return must only be true (if it exists at least one subscriber) or false (no subscribers).
Returns:
the response to the HTTP GET request with the JSON representation of the asked component subscriptions.

getSubscribersWithInheritance

public javax.ws.rs.core.Response getSubscribersWithInheritance(String subscriptionType,
                                                               String resourceId,
                                                               boolean existenceIndicatorOnly)
Gets the JSON representation of resource subscription subscribers with inheritance. For example, it returns subscribers af a node and those of its parents too. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.

Parameters:
subscriptionType - the type of subscription.
resourceId - identifier of the aimed resource (NODE for now). When a new type of resource will be managed, the resource type will have to be passed into URI
existenceIndicatorOnly - indicates if the return must only be true (if it exists at least one subscriber) or false (no subscribers).
Returns:
the response to the HTTP GET request with the JSON representation of the asked component subscriptions.

asWebEntities

protected Collection<SubscriptionEntity> asWebEntities(Collection<Subscription> subscriptions)
Gets WEB entity collection representing the given subscription collection.

Parameters:
subscriptions -
Returns:

asWebEntity

protected SubscriptionEntity asWebEntity(Subscription subscription)
Gets the WEB entity representing the given subscription.

Parameters:
subscription -
Returns:

asSubscriberWebEntities

protected Collection<SubscriberEntity> asSubscriberWebEntities(Collection<SubscriptionSubscriber> subscribers)
Gets WEB entity collection representing the given subscriber collection.

Parameters:
subscribers -
Returns:

asSubscriberWebEntity

protected SubscriberEntity asSubscriberWebEntity(SubscriptionSubscriber subscriber)
Gets the WEB entity representing the given subscriber.

Parameters:
subscriber -
Returns:

getComponentId

public String getComponentId()
Description copied from class: RESTWebService
Gets the identifier of the component instance to which the requested resource belongs to.

Specified by:
getComponentId in class RESTWebService
Returns:
the identifier of the Silverpeas component instance.


Copyright © 2016 Silverpeas. All Rights Reserved.