Class TqlResourceImpl.QueryPoller
- java.lang.Object
-
- com.artisol.teneo.inquire.client.resources.TqlResourceImpl.QueryPoller
-
- All Implemented Interfaces:
TqlResourceImpl.QueryCancelable
- Enclosing class:
- TqlResourceImpl
public class TqlResourceImpl.QueryPoller extends Object implements TqlResourceImpl.QueryCancelable
Represents the result of an asynchronous query to Teneo Inquire.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Tries to cancel the query.String
getQueryId()
Gets the ID of the query process.Iterable<Map<String,Object>>
getResults()
Gets the results so far.boolean
isFinished()
Check if this query has finished.boolean
poll()
Polls the query backend to get the current status of the query.boolean
poll(int timeout)
Polls the query backend to get the current status of the query.
-
-
-
Method Detail
-
getQueryId
public String getQueryId()
Gets the ID of the query process.- Returns:
- A String with the Query ID
-
cancel
public void cancel() throws com.artisol.teneo.inquire.api.exceptions.InquireException
Description copied from interface:TqlResourceImpl.QueryCancelable
Tries to cancel the query.- Specified by:
cancel
in interfaceTqlResourceImpl.QueryCancelable
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- Thrown if the query couldn't be cancelled
-
isFinished
public boolean isFinished()
Check if this query has finished.- Returns:
- True if the query has finished, false otherwise
-
getResults
public Iterable<Map<String,Object>> getResults()
Gets the results so far. IfisFinished()
is true then returns the final results, else will return whatever results where returned last time the query was polled.- Returns:
- An iterable over the resulting objects
-
poll
public boolean poll() throws com.artisol.teneo.inquire.api.exceptions.InquireException
Polls the query backend to get the current status of the query.- Returns:
- True if the query has finished
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- Thrown if the current status couldn't be returned
-
poll
public boolean poll(int timeout) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Polls the query backend to get the current status of the query.- Parameters:
timeout
- Request timeout [seconds]- Returns:
- True if the query has finished
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- Thrown if the current status couldn't be returned
-
-