Search in sources :

Example 21 with SearchQuery

use of de.geeksfactory.opacclient.searchfields.SearchQuery in project opacclient by opacapp.

the class IOpac method search.

@Override
public SearchRequestResult search(List<SearchQuery> queries) throws IOException, OpacErrorException {
    if (!initialised) {
        start();
    }
    List<NameValuePair> params = new ArrayList<>();
    int index = 0;
    start();
    for (SearchQuery query : queries) {
        index = addParameters(query, params, index);
    }
    params.add(new BasicNameValuePair("Anzahl", "10"));
    params.add(new BasicNameValuePair("pshStart", "Suchen"));
    if (index == 0) {
        throw new OpacErrorException(stringProvider.getString(StringProvider.NO_CRITERIA_INPUT));
    }
    String html = httpPost(opac_url + "/cgi-bin/di.exe", new UrlEncodedFormEntity(params, "iso-8859-1"), getDefaultEncoding());
    return parse_search(html, 1);
}
Also used : SearchQuery(de.geeksfactory.opacclient.searchfields.SearchQuery) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) ArrayList(java.util.ArrayList) UrlEncodedFormEntity(org.apache.http.client.entity.UrlEncodedFormEntity)

Aggregations

SearchQuery (de.geeksfactory.opacclient.searchfields.SearchQuery)21 ArrayList (java.util.ArrayList)16 BasicNameValuePair (org.apache.http.message.BasicNameValuePair)11 NameValuePair (org.apache.http.NameValuePair)9 TextSearchField (de.geeksfactory.opacclient.searchfields.TextSearchField)8 DropdownSearchField (de.geeksfactory.opacclient.searchfields.DropdownSearchField)6 SearchField (de.geeksfactory.opacclient.searchfields.SearchField)6 Element (org.jsoup.nodes.Element)4 SearchRequestResult (de.geeksfactory.opacclient.objects.SearchRequestResult)3 BarcodeSearchField (de.geeksfactory.opacclient.searchfields.BarcodeSearchField)3 Document (org.jsoup.nodes.Document)3 OpacErrorException (de.geeksfactory.opacclient.apis.OpacApi.OpacErrorException)2 SearchResult (de.geeksfactory.opacclient.objects.SearchResult)2 CheckboxSearchField (de.geeksfactory.opacclient.searchfields.CheckboxSearchField)2 JsonSearchFieldDataSource (de.geeksfactory.opacclient.storage.JsonSearchFieldDataSource)2 JSONObject (org.json.JSONObject)2 SuppressLint (android.annotation.SuppressLint)1 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1