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 aLinkIndexQuery
.A typical usage would be to:
- 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. - 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 ahttp://jazz.net/xmlns/foundation/1.0/LinkProvider
property, thecreate
method will return an emptyOptional
but it will not throw any error. - Use
AbstractResourceRequest.call()
to execute the query
- Since:
- 1.7.0
-
-
Constructor Summary
Constructors Constructor Description ExecuteLinkIndexQuery(OslcClient client, URI uri, LinkIndexQuery linkIndexQuery)
Creates a newExecuteLinkIndexQuery
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ClientResponse
call(OslcResource resource)
Executes the request on the specified resource.static Optional<ExecuteLinkIndexQuery>
create(OslcClient client, LinkIndexQuery linkIndexQuery)
Creates aExecuteLinkIndexQuery
instance.protected ResourceResponse<Collection<DirectedLink>>
createResponse(OslcResource resource, ClientResponse response)
Processes the response obtained when executing a request on the specified resource.-
Methods inherited from class com.sodius.oslc.client.requests.AbstractResourceRequest
call, createErrorResponse, createResourceResponse, getClient, getUri
-
-
-
-
Constructor Detail
-
ExecuteLinkIndexQuery
public ExecuteLinkIndexQuery(OslcClient client, URI uri, LinkIndexQuery linkIndexQuery)
Creates a newExecuteLinkIndexQuery
instance.If the link index query URI is not known, one may use the
ResourceResponse.Factory
instead.- Parameters:
client
- the OSLC clienturi
- the link index query URIlinkIndexQuery
- the query to execute
-
-
Method Detail
-
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 classAbstractResourceRequest<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 theResourceRequest
interface, this method is called only when the HTTP response status is20x
.- Specified by:
createResponse
in classAbstractResourceRequest<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 aExecuteLinkIndexQuery
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 clientlinkIndexQuery
- the link index query to execute- Returns:
- an optional ExecuteLinkIndexQuery instance
-
-