Class SubscriptionResource
- java.lang.Object
-
- org.silverpeas.core.web.rs.RESTWebService
-
- org.silverpeas.core.webapi.subscribe.AbstractSubscriptionResource
-
- org.silverpeas.core.webapi.subscribe.SubscriptionResource
-
- All Implemented Interfaces:
ProtectedWebResource
,WebAuthenticationValidation
,WebAuthorizationValidation
,SilverpeasWebResource
@WebService @Path("subscriptions/{componentId}") @Authorized public class SubscriptionResource extends AbstractSubscriptionResource
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 org.silverpeas.core.web.rs.RESTWebService
RESTWebService.WebProcess<R>, RESTWebService.WebTreatment<R>
-
-
Field Summary
-
Fields inherited from class org.silverpeas.core.web.rs.RESTWebService
RESPONSE_HEADER_ARRAYSIZE
-
Fields inherited from interface org.silverpeas.core.web.SilverpeasWebResource
BASE_PATH
-
-
Constructor Summary
Constructors Constructor Description SubscriptionResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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(String userId)
Gets the JSON representation of component subscriptions in relation with the user.protected String
getResourceBasePath()
Gets the base path of the web resource relative to the root path of all the web resources in Silverpeas as given bySilverpeasWebResource.getBasePath()
.javax.ws.rs.core.Response
getSubscribers(String subscriptionType, String resourceId)
Gets the JSON representation of component/node subscription subscribers.javax.ws.rs.core.Response
getSubscribersWithInheritance(String subscriptionType, String resourceId, String locationId, boolean existenceIndicatorOnly)
Gets the JSON representation of resource subscription subscribers with inheritance.Collection<SubscriptionEntity>
getSubscriptions(String subscriptionType, String resourceId, String userId)
Gets the JSON representation of component/node subscriptions of a resource.-
Methods inherited from class org.silverpeas.core.webapi.subscribe.AbstractSubscriptionResource
decodeSubscriptionResourceType, getComponentId, getSubscription, getSubscriptionResource
-
Methods inherited from class org.silverpeas.core.web.rs.RESTWebService
createWebResourceUri, fromPage, getBundle, getBundleLocation, getHighestUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getSilverpeasContext, getUri, getUser, getUserPreferences, getUserRoles, identifiedBy, identifiedBy, initContext, initWebResourceUri, isUserDefined, process
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.web.rs.ProtectedWebResource
validateUserAuthorization
-
Methods inherited from interface org.silverpeas.core.web.rs.WebAuthenticationValidation
validateUserAuthentication
-
-
-
-
Method Detail
-
getComponentSubscriptions
@GET @Produces("application/json") public Collection<SubscriptionEntity> getComponentSubscriptions(@QueryParam("userId") String userId)
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.- Parameters:
userId
- optional filter on a user represented by its id.- Returns:
- the response to the HTTP GET request with the JSON representation of the asked component subscriptions.
-
getSubscriptions
@GET @Path("{subscriptionType}/{id}") @Produces("application/json") public Collection<SubscriptionEntity> getSubscriptions(@PathParam("subscriptionType") String subscriptionType, @PathParam("id") String resourceId, @QueryParam("userId") String userId)
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 URIuserId
- optional filter on a user represented by its id.- Returns:
- the response to the HTTP GET request with the JSON representation of the asked component subscriptions.
-
getComponentSubscribers
@GET @Path("subscribers") @Produces("application/json") 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
@GET @Path("{subscriptionType}/subscribers/{id}") public javax.ws.rs.core.Response getSubscribers(@PathParam("subscriptionType") String subscriptionType, @PathParam("id") 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
@GET @Path("{subscriptionType}/subscribers/inheritance") public javax.ws.rs.core.Response getComponentSubscribersWithInheritance(@PathParam("subscriptionType") String subscriptionType, @QueryParam("existenceIndicatorOnly") 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
@GET @Path("{subscriptionType}/subscribers/inheritance/{id}") public javax.ws.rs.core.Response getSubscribersWithInheritance(@PathParam("subscriptionType") String subscriptionType, @PathParam("id") String resourceId, @QueryParam("locationId") String locationId, @QueryParam("existenceIndicatorOnly") 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 URIlocationId
- optional identifier of the current location of the requested resource.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
- a collection of subscriptions- Returns:
- a collection of subscription entities
-
asWebEntity
protected SubscriptionEntity asWebEntity(Subscription subscription)
Gets the WEB entity representing the given subscription.- Parameters:
subscription
- a subscription- Returns:
- a subscription entity
-
asSubscriberWebEntities
protected Collection<SubscriberEntity> asSubscriberWebEntities(Collection<SubscriptionSubscriber> subscribers)
Gets WEB entity collection representing the given subscriber collection.- Parameters:
subscribers
- a collection of subscribers in subscriptions- Returns:
- a collection of subscriber entities.
-
asSubscriberWebEntity
protected SubscriberEntity asSubscriberWebEntity(SubscriptionSubscriber subscriber)
Gets the WEB entity representing the given subscriber.- Parameters:
subscriber
- a subscriber in a subscription- Returns:
- a subscriber entity
-
getResourceBasePath
protected String getResourceBasePath()
Description copied from class:RESTWebService
Gets the base path of the web resource relative to the root path of all the web resources in Silverpeas as given bySilverpeasWebResource.getBasePath()
.- Specified by:
getResourceBasePath
in classRESTWebService
- Returns:
- the relative path that identifies this REST web service among all other REST web services.
-
-