use of de.geeksfactory.opacclient.apis.ApacheBaseApi in project opacclient by opacapp.
the class GetSearchFieldsCallable method call.
@Override
public Map<String, List<SearchField>> call() {
OpacApi api = OpacApiFactory.create(lib, "OpacApp/Test");
if (api instanceof ApacheBaseApi) {
((ApacheBaseApi) api).setHttpLoggingEnabled(false);
}
Set<String> langs = null;
try {
langs = api.getSupportedLanguages();
} catch (IOException e) {
}
if (langs == null) {
// Use default language
try {
Map<String, List<SearchField>> map = new HashMap<>();
map.put("default", api.getSearchFields());
return map;
} catch (IOException | OpacErrorException | JSONException e) {
}
} else {
Map<String, List<SearchField>> map = new HashMap<>();
for (String lang : langs) {
api.setLanguage(lang);
try {
map.put(lang, api.getSearchFields());
} catch (IOException | OpacErrorException | JSONException e) {
}
}
return map;
}
return null;
}
use of de.geeksfactory.opacclient.apis.ApacheBaseApi in project opacclient by opacapp.
the class CoverDownloadTask method getImage.
protected byte[] getImage() throws IOException {
try {
OpacApi api = ((OpacClient) context.getApplicationContext()).getApi();
if (api instanceof ApacheBaseApi) {
return getImageApacheClient(((ApacheBaseApi) api).http_client);
} else if (api instanceof OkHttpBaseApi) {
return getImageOkHttpClient(((OkHttpBaseApi) api).http_client);
}
} catch (OpacClient.LibraryRemovedException e) {
}
HttpClient httpClient;
httpClient = new AndroidHttpClientFactory().getNewApacheHttpClient(false, true, false, false);
return getImageApacheClient(httpClient);
}
Aggregations