Class SubscriptionResource

    • Constructor Detail

      • SubscriptionResource

        public SubscriptionResource()
    • 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 URI
        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.
      • 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 URI
        locationId - 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