java.lang.Object
org.cruk.clarity.api.impl.SavedQueryRunner
Extraction of code to run a saved query to simplify
ClarityAPIImpl. This
class needs to handle an error response and convert the XML returned as an exception
when there is an error to a ClarityException.- Since:
- 2.34
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ResponseErrorHandlerThe error handler.protected ClientHttpRequestFactoryClient request factory.protected LoggerLogger. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionrunSavedQuery(Linkable<SavedQuery> query, OutputStream out, long maximumResults) Run a saved query and write the result to the given output stream.voidsetErrorHandler(ResponseErrorHandler handler) Set the error handler.voidSet the request factory.
-
Field Details
-
logger
Logger. -
httpRequestFactory
Client request factory. -
errorHandler
The error handler.
-
-
Constructor Details
-
SavedQueryRunner
public SavedQueryRunner()Constructor.
-
-
Method Details
-
setHttpRequestFactory
@Autowired @Qualifier("clarityClientHttpRequestFactory") public void setHttpRequestFactory(ClientHttpRequestFactory factory) Set the request factory.- Parameters:
factory- The HTTP request factory.
-
setErrorHandler
@Autowired @Qualifier("clarityExceptionErrorHandler") public void setErrorHandler(ResponseErrorHandler handler) Set the error handler.- Parameters:
handler- The error handler.
-
runSavedQuery
public SavedQuerySummary runSavedQuery(Linkable<SavedQuery> query, OutputStream out, long maximumResults) throws IOException Run a saved query and write the result to the given output stream.- Parameters:
query- The saved query to run.out- The stream to write to. Must be open.maximumResults- The maximum number of results to return. If negative, don't set a limit.- Returns:
- A summary of the report returned.
- Throws:
IOException- if there is a problem writing to the output stream.ClarityException- if there is an error reported back from Clarity.InvalidURIException- in the near impossible case of the query URI being invalid.- See Also:
-