Class ExecuteLinkIndexQuery

java.lang.Object
com.sodius.oslc.client.requests.AbstractResourceRequest<ResourceResponse<Collection<DirectedLink>>>
com.sodius.oslc.core.process.links.requests.ExecuteLinkIndexQuery
All Implemented Interfaces:
ResourceRequest<ResourceResponse<Collection<DirectedLink>>>, Callable<ResourceResponse<Collection<DirectedLink>>>

public class ExecuteLinkIndexQuery extends AbstractResourceRequest<ResourceResponse<Collection<DirectedLink>>>
A request that executes a LinkIndexQuery.

A typical usage would be to:

  1. Call LinkIndexQuery.create(Collection, ProjectAreaAssociations, URI, URI, URI) to get a list of link index queries to execute for a resource and the associations declared on its project.
  2. For each result of the previous step, instantiate this class with create(OslcClient, LinkIndexQuery), which will query the Service Contribution Resource (SCR) associated to the given link index query's root services, in order to get the right link index query URI.
    Note that if there is no matching "Service Contribution Resource" document (SCR) or if that SCR does not provide a http://jazz.net/xmlns/foundation/1.0/LinkProvider property, the create method will return an empty Optional but it will not throw any error.
  3. Use AbstractResourceRequest.call() to execute the query
Since:
1.7.0
  • Constructor Details

    • ExecuteLinkIndexQuery

      public ExecuteLinkIndexQuery(OslcClient client, URI uri, LinkIndexQuery linkIndexQuery)
      Creates a new ExecuteLinkIndexQuery instance.

      If the link index query URI is not known, one may use the ResourceResponse.Factory instead.

      Parameters:
      client - the OSLC client
      uri - the link index query URI
      linkIndexQuery - the query to execute
  • Method Details

    • call

      protected ClientResponse call(OslcResource resource)
      Description copied from class: AbstractResourceRequest
      Executes the request on the specified resource. Subclasses may add extra information (such as headers) on the resource before executing the request.
      Specified by:
      call in class AbstractResourceRequest<ResourceResponse<Collection<DirectedLink>>>
      Parameters:
      resource - the resource on which to execute a request.
      Returns:
      the response of the request execution.
    • createResponse

      protected ResourceResponse<Collection<DirectedLink>> createResponse(OslcResource resource, ClientResponse response)
      Description copied from class: AbstractResourceRequest
      Processes the response obtained when executing a request on the specified resource. Due to the contract of the ResourceRequest interface, this method is called only when the HTTP response status is 20x .
      Specified by:
      createResponse in class AbstractResourceRequest<ResourceResponse<Collection<DirectedLink>>>
      Parameters:
      resource - the resource on which a request is executed.
      response - the response obtained.
      Returns:
      the extraction of the response content into the expected format.
    • create

      public static Optional<ExecuteLinkIndexQuery> create(OslcClient client, LinkIndexQuery linkIndexQuery)
      Creates a ExecuteLinkIndexQuery instance.

      The given LinkIndexQuery must contain the rootServices property, which will be used to discover the link index query URI.

      If the rootServices property does not have a matching "Service Contribution Resource" document (SCR) or if that SCR does not provide a http://jazz.net/xmlns/foundation/1.0/LinkProvider property, return an empty Optional instead.

      Parameters:
      client - an OSLC client
      linkIndexQuery - the link index query to execute
      Returns:
      an optional ExecuteLinkIndexQuery instance