use of de.geeksfactory.opacclient.objects.ReservedItem in project opacclient by opacapp.
the class AccountItemDetailActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
Intent intent = new Intent();
int resultCode;
int item_id = menuItem.getItemId();
if (item_id == R.id.action_prolong) {
resultCode = RESULT_PROLONG;
intent.putExtra(EXTRA_DATA, ((LentItem) item).getProlongData());
} else if (item_id == R.id.action_download) {
resultCode = RESULT_DOWNLOAD;
intent.putExtra(EXTRA_DATA, ((LentItem) item).getDownloadData());
} else if (item_id == R.id.action_cancel) {
resultCode = RESULT_CANCEL;
intent.putExtra(EXTRA_DATA, ((ReservedItem) item).getCancelData());
} else if (item_id == R.id.action_booking) {
resultCode = RESULT_BOOKING;
intent.putExtra(EXTRA_DATA, ((ReservedItem) item).getBookingData());
} else {
return super.onOptionsItemSelected(menuItem);
}
setResult(resultCode, intent);
supportFinishAfterTransition();
return true;
}
use of de.geeksfactory.opacclient.objects.ReservedItem in project opacclient by opacapp.
the class IOpacAccountTest method testParseResList.
@Test
public void testParseResList() throws OpacApi.OpacErrorException {
String html = readResource("/iopac/" + file);
List<ReservedItem> media = new ArrayList<>();
IOpac.parseResList(media, Jsoup.parse(html), new JSONObject());
}
use of de.geeksfactory.opacclient.objects.ReservedItem in project opacclient by opacapp.
the class PicaOldAccountTest method testParseResList.
@Test
public void testParseResList() throws OpacApi.OpacErrorException {
String html = readResource("/pica_old/reslist/" + file);
// we may not have all files for all libraries
if (html == null)
return;
List<ReservedItem> media = new ArrayList<>();
PicaOld.parseResList(media, Jsoup.parse(html), new DummyStringProvider());
assertTrue(media.size() > 0);
}
use of de.geeksfactory.opacclient.objects.ReservedItem in project opacclient by opacapp.
the class WinBiapAccountTest method testParseResList.
@Test
public void testParseResList() throws OpacApi.OpacErrorException {
String html = readResource("/winbiap/reslist/" + file);
// we may not have all files for all libraries
if (html == null)
return;
List<ReservedItem> media = WinBiap.parseResList(Jsoup.parse(html), new DummyStringProvider(), new JSONObject());
for (ReservedItem item : media) {
assertNotNull(item.getMediaType());
assertContainsData(item.getCover());
}
assertTrue(media.size() > 0);
}
use of de.geeksfactory.opacclient.objects.ReservedItem in project opacclient by opacapp.
the class Heidi method parse_reservations.
protected List<ReservedItem> parse_reservations(String html) {
Document doc = Jsoup.parse(html);
List<ReservedItem> reservations = new ArrayList<>();
DateTimeFormatter fmt = DateTimeFormat.forPattern("dd.MM.yyyy").withLocale(Locale.GERMAN);
for (Element tr : doc.select("table.kontopos tr")) {
ReservedItem item = new ReservedItem();
Element desc = tr.child(1).select("label").first();
Element pos = tr.child(3);
if (tr.child(1).select("a").size() > 0) {
String kk = getQueryParamsFirst(tr.child(1).select("a").first().absUrl("href")).get("katkey");
item.setId(kk);
}
if (tr.child(0).select("input").size() > 0) {
item.setCancelData(tr.child(0).select("input").first().val());
}
int i = 0;
for (Node node : desc.childNodes()) {
if (node instanceof TextNode) {
String text = ((TextNode) node).text().trim();
if (i == 0) {
item.setAuthor(text);
} else if (i == 1) {
item.setTitle(text);
}
i++;
}
}
i = 0;
for (Node node : pos.childNodes()) {
if (node instanceof TextNode) {
String text = ((TextNode) node).text().trim();
if (i == 0 && text.contains("")) {
try {
item.setReadyDate(fmt.parseLocalDate(text));
} catch (IllegalArgumentException e) {
item.setStatus(text);
}
} else if (i == 1) {
item.setBranch(text);
}
i++;
}
}
reservations.add(item);
}
return reservations;
}
Aggregations