Class QueryServiceHttpClient

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, QueryService

    public class QueryServiceHttpClient
    extends java.lang.Object
    implements QueryService, java.io.Closeable
    • Constructor Summary

      Constructors 
      Constructor Description
      QueryServiceHttpClient​(java.lang.String type, java.lang.String baseUrl)  
    • Method Summary

      Modifier and Type Method Description
      void close()  
      java.lang.Boolean destroy​(ServiceUser user, QueryKey queryKey)
      Destroy any existing query being conducted under the given key.
      java.util.Optional<DataSource> getDataSource​(ServiceUser user, DocRef docRef)
      Get the details of the DataSource given by the DocRef.
      java.util.Optional<DocRef> getDocRefForQueryKey​(ServiceUser user, QueryKey queryKey)
      Used by REST layer to retrieve the doc ref for a given query key.
      java.lang.String getType()
      Get the doc ref type that this service wraps.
      java.util.Optional<SearchResponse> search​(ServiceUser user, SearchRequest request)
      Conduct a search on the data, it may be a successive call for long running searches.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QueryServiceHttpClient

        public QueryServiceHttpClient​(java.lang.String type,
                                      java.lang.String baseUrl)
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • getType

        public java.lang.String getType()
        Description copied from interface: QueryService
        Get the doc ref type that this service wraps.
        Specified by:
        getType in interface QueryService
        Returns:
        The doc ref type name
      • getDataSource

        public java.util.Optional<DataSource> getDataSource​(ServiceUser user,
                                                            DocRef docRef)
                                                     throws QueryApiException
        Description copied from interface: QueryService
        Get the details of the DataSource given by the DocRef. Used to build user interfaces for querying the specific data.
        Specified by:
        getDataSource in interface QueryService
        Parameters:
        user - The authenticated user
        docRef - The Doc Ref of the DataSource to fetch
        Returns:
        The DataSource definition for the given doc ref
        Throws:
        QueryApiException - if anything goes wrong
      • destroy

        public java.lang.Boolean destroy​(ServiceUser user,
                                         QueryKey queryKey)
                                  throws QueryApiException
        Description copied from interface: QueryService
        Destroy any existing query being conducted under the given key.
        Specified by:
        destroy in interface QueryService
        Parameters:
        user - The authenticated user
        queryKey - The query key that was given with the search request.
        Returns:
        Success indicator
        Throws:
        QueryApiException - if anything goes wrong
      • getDocRefForQueryKey

        public java.util.Optional<DocRef> getDocRefForQueryKey​(ServiceUser user,
                                                               QueryKey queryKey)
        Description copied from interface: QueryService
        Used by REST layer to retrieve the doc ref for a given query key. Primarily used to check the permissions for the given doc ref.
        Specified by:
        getDocRefForQueryKey in interface QueryService
        Parameters:
        user - The authenticated user
        queryKey - The query key, it should match a current query
        Returns:
        The DocRef of the query, if found, if not found the result will be empty.