Class ExecuteQuery<T>

  • Type Parameters:
    T - the type of members of the ResponseInfoCollection resource
    All Implemented Interfaces:
    ResourceRequest<ResponseInfoCollection<T>>, Callable<ResponseInfoCollection<T>>

    public class ExecuteQuery<T>
    extends AbstractResourceRequest<ResponseInfoCollection<T>>
    Executes a GET or POST request on an OSLC query capability URL.

    If the query parameters are too long for a GET request, prefer using post(OslcClient, URI, String, Class), provided the server supports such POST request.

    This request returns a ResponseInfoCollection resource, which contains resources of the desired type and matching a given condition. The number of returned resources is usually limited by the server. The ResponseInfoCollection resource may contain information about a next page URI, that shall be used as is by a subsequent ExecuteQuery request to get the next set of resources. If a POST is used, the subsequent request entity must be the same as for the initial request. This process shall be repeated by the client to capture the entire set of resources, until no next page is provided by the ResponseInfoCollection resource.

    Since:
    3.6.0
    • Method Detail

      • get

        public static <T> ExecuteQuery<T> get​(OslcClient client,
                                              URI uri,
                                              Class<T> type)
        Creates a query request to fetch resources from a remote server that match a given condition.

        The given URI should combine the base location of an OSLC query capability and query parameters to control the condition to filter resources. See QueryUriBuilder for building such URI.

        An Accept header is set to application/rdf+xml, as this is the most frequently used exchange format.

        Type Parameters:
        T - the type of members of the ResponseInfoCollection resource
        Parameters:
        client - the REST client used to execute a request
        uri - the URI of the query, which should include query parameters
        type - the type of resources to query
        Returns:
        a GET query request
        See Also:
        QueryUriBuilder.build(URI)
      • get

        public static <T> ExecuteQuery<T> get​(OslcClient client,
                                              URI uri,
                                              Class<T> type,
                                              MediaType acceptType)
        Creates a query request to fetch resources from a remote server that match a given condition.

        The given URI should combine the base location of an OSLC query capability and query parameters to control the condition to filter resources. See QueryUriBuilder for building such URI.

        Caution: the application/json media type is not supported by this request.

        Type Parameters:
        T - the type of members of the ResponseInfoCollection resource
        Parameters:
        client - the REST client used to execute a request
        uri - the URI of the query, which should include query parameters
        type - the type of resources to query
        acceptType - the Accept header value to use
        Returns:
        a GET query request
        Throws:
        IllegalArgumentException - if acceptType is application/json
        See Also:
        QueryUriBuilder.build(URI)
      • post

        public static <T> ExecuteQuery<T> post​(OslcClient client,
                                               URI uri,
                                               String formEntity,
                                               Class<T> type)
        Creates a query request to fetch resources from a remote server that match a given condition.

        The given URI should be the OSLC query base location. It should not contain OSLC Query parameters. Query parameters are to be encoded as a POST entity. See QueryUriBuilder.buildPostEntity() for building such content.

        An Accept header is set to application/rdf+xml, as this is the most frequently used exchange format.

        Type Parameters:
        T - the type of members of the ResponseInfoCollection resource
        Parameters:
        client - the REST client used to execute a request
        uri - the URI of the query base location
        formEntity - the OSLC query parameters encoded in a application/x-www-form-urlencoded body
        type - the type of resources to query
        Returns:
        a POST query request
        See Also:
        QueryUriBuilder.buildPostEntity()
      • post

        public static <T> ExecuteQuery<T> post​(OslcClient client,
                                               URI uri,
                                               String formEntity,
                                               Class<T> type,
                                               MediaType acceptType)
        Creates a query request to fetch resources from a remote server that match a given condition.

        The given URI should be the OSLC query base location. It should not contain OSLC Query parameters. Query parameters are to be encoding as a POST entity. See QueryUriBuilder.buildPostEntity() for building such content.

        Caution: the application/json media type is not supported by this request.

        Type Parameters:
        T - the type of members of the ResponseInfoCollection resource
        Parameters:
        client - the REST client used to execute a request
        uri - the URI of the query base location
        formEntity - the OSLC query parameters encoded in a application/x-www-form-urlencoded body
        type - the type of resources to query
        acceptType - the Accept header value to use
        Returns:
        a POST query request
        Throws:
        IllegalArgumentException - if acceptType is application/json
        See Also:
        QueryUriBuilder.buildPostEntity()