View Javadoc
1   package org.kuali.ole.describe.service;
2   
3   import org.kuali.incubator.SolrRequestReponseHandler;
4   
5   import java.util.List;
6   
7   /**
8    * DiscoveryHelperService is the service class to access Discovery services
9    */
10  public class DiscoveryHelperService {
11      private final String queryString = "DocType:bibliographic AND instanceIdentifier:";
12      private final String bibQueryString = "DocType:bibliographic AND uniqueId:";
13      SolrRequestReponseHandler solrRequestReponseHandler;
14  
15      /**
16       * Returns the Response List based on the queryField and Value from the SolrRequestReponseHandler class.
17       *
18       * @param queryField
19       * @param value
20       * @return Returns the Response.
21       */
22      public List getResponseFromSOLR(String queryField, String value) {
23          String queryString = queryField + ":" + value;
24          return getSolrRequestReponseHandler().retriveResults(queryString);
25      }
26  
27      /**
28       * Returns the List of BibInformation records based on the instanceUUID.
29       *
30       * @param instanceUUID
31       * @return Returns BibInformation
32       */
33      public List getBibInformationFromInsatnceId(String instanceUUID) {
34          return getSolrRequestReponseHandler().retriveResults(queryString + instanceUUID);
35      }
36  
37      /**
38       * Returns the List of BibInformation records based on the BibUUID.
39       *
40       * @param bibUUID
41       * @return Returns BibInformation
42       */
43      public List getBibInformationFromBibId(String bibUUID) {
44          return getSolrRequestReponseHandler().retriveResults(bibQueryString + bibUUID);
45      }
46  
47  
48      /**
49       * Returns the new instance of SolrRequestReponseHandler provided there should not be any existing instance,Otherwise returns existing instance.
50       *
51       * @return Returns the SolrRequestReponseHandler
52       */
53      public SolrRequestReponseHandler getSolrRequestReponseHandler() {
54          if (null == solrRequestReponseHandler) {
55              solrRequestReponseHandler = new SolrRequestReponseHandler();
56          }
57          return solrRequestReponseHandler;
58      }
59  
60      /**
61       * Sets the SolrRequestReponseHandler attribute value.
62       *
63       * @param solrRequestReponseHandler
64       */
65      public void setSolrRequestReponseHandler(SolrRequestReponseHandler solrRequestReponseHandler) {
66          this.solrRequestReponseHandler = solrRequestReponseHandler;
67      }
68  }