Class TqlResourceImpl
- java.lang.Object
-
- com.artisol.teneo.inquire.client.resources.AbstractResource
-
- com.artisol.teneo.inquire.client.resources.TqlResourceImpl
-
- All Implemented Interfaces:
com.artisol.teneo.inquire.api.resources.TqlResource
public class TqlResourceImpl extends AbstractResource implements com.artisol.teneo.inquire.api.resources.TqlResource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TqlResourceImpl.QueryCancelable
Interface handle to cancel Query operations that will submit their results through a Future Callback.class
TqlResourceImpl.QueryPoller
Represents the result of an asynchronous query to Teneo Inquire.
-
Field Summary
-
Fields inherited from interface com.artisol.teneo.inquire.api.resources.TqlResource
DELETE_LOG_DATA_SOURCE_SHARED_QUERY_PATH, DELETE_LOG_DATA_SOURCE_SHARED_QUERY_SUMMARY, GET_LOG_DATA_SOURCE_CANCEL_QUERY_PATH, GET_LOG_DATA_SOURCE_CANCEL_QUERY_SUMMARY, GET_LOG_DATA_SOURCE_METADATA_PATH, GET_LOG_DATA_SOURCE_METADATA_SUMMARY, GET_LOG_DATA_SOURCE_POLL_QUERY_PATH, GET_LOG_DATA_SOURCE_POLL_QUERY_SUMMARY, GET_LOG_DATA_SOURCE_SHARED_QUERIES_PATH, GET_LOG_DATA_SOURCE_SHARED_QUERIES_SUMMARY, PATH, POST_LOG_DATA_SOURCE_SHARED_QUERY_CREATE_PATH, POST_LOG_DATA_SOURCE_SHARED_QUERY_CREATE_SUMMARY, POST_LOG_DATA_SOURCE_SHARED_QUERY_SUBMIT_PATH, POST_LOG_DATA_SOURCE_SHARED_QUERY_SUBMIT_SUMMARY, POST_LOG_DATA_SOURCE_SOLUTION_REVISIONS_PATH, POST_LOG_DATA_SOURCE_SOLUTION_REVISIONS_SUMMARY, POST_LOG_DATA_SOURCE_SUBMIT_QUERY_PATH, POST_LOG_DATA_SOURCE_SUBMIT_QUERY_SUMMARY
-
-
Constructor Summary
Constructors Constructor Description TqlResourceImpl(javax.ws.rs.client.WebTarget webTarget, ExecutorService executorService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteSharedQuery(String ldsName, String identifier)
Deletes aSharedQuery
if it exists.Iterable<Map<String,Object>>
executeQuery(String ldsName, String tql, Map<String,Object> parameters)
Executes a TQL query returning the resulting rows.Iterable<Map<String,Object>>
executeSharedQuery(String ldsName, String identifier, Map<String,Object> parameters)
Executes a Shared Query synchronously and returns the resulting rows.List<com.artisol.teneo.inquire.api.models.SharedQuery>
getSharedQueries(String ldsName)
Fetches theSharedQuery
's for a LDS.Iterable<Map<String,Object>>
getSolutionRevisions(String ldsName, Map<String,Object> parameters)
Executes a TQL query returning the solution revisions.void
saveSharedQuery(String ldsName, com.artisol.teneo.inquire.api.models.SharedQuery query)
Persists aSharedQuery
.TqlResourceImpl.QueryPoller
submitQuery(String ldsName, String tql, Map<String,Object> parameters)
Executes a TQL asynchronously query returning aTqlResourceImpl.QueryPoller
which can be polled to get the latest results and find out when the query has finished.TqlResourceImpl.QueryCancelable
submitQuery(String ldsName, String tql, Map<String,Object> parameters, com.google.common.util.concurrent.FutureCallback<Iterable<Map<String,Object>>> callback)
Executes a TQL query asynchronously, returning aTqlResourceImpl.QueryCancelable
which can be used to cancel the query.TqlResourceImpl.QueryPoller
submitSharedQuery(String ldsName, String identifier, Map<String,Object> parameters)
Executes a Shared Query asynchronously and returns aTqlResourceImpl.QueryPoller
which can be polled to get the latest results and find out when the query has finished.TqlResourceImpl.QueryCancelable
submitSharedQuery(String ldsName, String identifier, Map<String,Object> parameters, com.google.common.util.concurrent.FutureCallback<Iterable<Map<String,Object>>> callback)
Executes a Shared Query asynchronously, returning aTqlResourceImpl.QueryCancelable
which can be used to cancel the query.TqlResourceImpl.QueryPoller
submitSolutionRevisionQuery(String ldsName, Map<String,Object> parameters)
Executes an asynchronous request to get all the solution revisions.
-
-
-
Constructor Detail
-
TqlResourceImpl
public TqlResourceImpl(javax.ws.rs.client.WebTarget webTarget, ExecutorService executorService)
-
-
Method Detail
-
submitQuery
public TqlResourceImpl.QueryPoller submitQuery(String ldsName, String tql, Map<String,Object> parameters) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Executes a TQL asynchronously query returning aTqlResourceImpl.QueryPoller
which can be polled to get the latest results and find out when the query has finished.- Parameters:
ldsName
- The LDS nametql
- The TQL string to be executedparameters
- The query parameters to be added to the HTTP request- Returns:
- A QueryPoller object
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- If there is any problem processing the request
-
submitSolutionRevisionQuery
public TqlResourceImpl.QueryPoller submitSolutionRevisionQuery(String ldsName, Map<String,Object> parameters) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Executes an asynchronous request to get all the solution revisions.- Parameters:
ldsName
- The LDS nameparameters
- The query parameters to be added to the HTTP request- Returns:
- A QueryPoller
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- If there is any problem processing the request
-
executeSharedQuery
public Iterable<Map<String,Object>> executeSharedQuery(String ldsName, String identifier, Map<String,Object> parameters) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Executes a Shared Query synchronously and returns the resulting rows. This query cannot be cancelled.- Parameters:
ldsName
- The LDS nameidentifier
- Either the name or the ID of the shared queryparameters
- The query parameters to be added to the HTTP request- Returns:
- Query result (List of Maps)
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- If there is any problem processing the request
-
submitSharedQuery
public TqlResourceImpl.QueryPoller submitSharedQuery(String ldsName, String identifier, Map<String,Object> parameters) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Executes a Shared Query asynchronously and returns aTqlResourceImpl.QueryPoller
which can be polled to get the latest results and find out when the query has finished.- Parameters:
ldsName
- The LDS nameidentifier
- Either the name or the ID of the shared queryparameters
- The query parameters to be added to the HTTP request- Returns:
- A QueryPoller
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- If there is any problem processing the request
-
submitQuery
public TqlResourceImpl.QueryCancelable submitQuery(String ldsName, String tql, Map<String,Object> parameters, com.google.common.util.concurrent.FutureCallback<Iterable<Map<String,Object>>> callback) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Executes a TQL query asynchronously, returning aTqlResourceImpl.QueryCancelable
which can be used to cancel the query. It allows to pass a callback that will be called when query finish or fail.- Parameters:
ldsName
- The LDS nametql
- The TQL string to be executedparameters
- The query parameters to be added to the HTTP requestcallback
- The callback to be called when query finish- Returns:
- A handle to the object for cancelling the request
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- If there is any problem processing the request
-
submitSharedQuery
public TqlResourceImpl.QueryCancelable submitSharedQuery(String ldsName, String identifier, Map<String,Object> parameters, com.google.common.util.concurrent.FutureCallback<Iterable<Map<String,Object>>> callback) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Executes a Shared Query asynchronously, returning aTqlResourceImpl.QueryCancelable
which can be used to cancel the query. It allows to pass a callback that will be called when query finish or fail.- Parameters:
ldsName
- The LDS nameidentifier
- Either the name or the ID of the shared queryparameters
- The query parameters to be added to the HTTP requestcallback
- Then callback to be called when query finish- Returns:
- If there is any problem processing the request
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- If there is any problem processing the request
-
executeQuery
public Iterable<Map<String,Object>> executeQuery(String ldsName, String tql, Map<String,Object> parameters) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Executes a TQL query returning the resulting rows. This query cannot be cancelled.- Parameters:
ldsName
- The LDS nametql
- The TQL string to be executedparameters
- The query parameters to be added to the HTTP request- Returns:
- Query result (An iterable over Maps of the results)
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- If there is any problem processing the request
-
getSolutionRevisions
public Iterable<Map<String,Object>> getSolutionRevisions(String ldsName, Map<String,Object> parameters) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Executes a TQL query returning the solution revisions. This query cannot be cancelled.- Parameters:
ldsName
- The LDS nameparameters
- The query parameters to be added to the HTTP request- Returns:
- Query result (An iterable over Maps of the results)
- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- If there is any problem processing the request
-
getSharedQueries
public List<com.artisol.teneo.inquire.api.models.SharedQuery> getSharedQueries(String ldsName) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Fetches theSharedQuery
's for a LDS.- Parameters:
ldsName
- The LDS name- Returns:
- A List of all the
SharedQuery
s of the LDS - Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- If there is any problem processing the request
-
saveSharedQuery
public void saveSharedQuery(String ldsName, com.artisol.teneo.inquire.api.models.SharedQuery query) throws com.artisol.teneo.inquire.api.exceptions.InquireException
Persists aSharedQuery
. Overwrites any existingSharedQuery
of the same name.- Parameters:
ldsName
- The LDS namequery
- The query to save- Throws:
com.artisol.teneo.inquire.api.exceptions.InquireException
- If there is any problem processing the request
-
-