use of de.geeksfactory.opacclient.objects.LentItem in project opacclient by opacapp.
the class AccountDataSource method getLentItem.
public LentItem getLentItem(long id) {
String[] selA = { "" + id };
Cursor cursor = database.query(AccountDatabase.TABLENAME_LENT, AccountDatabase.COLUMNS_LENT, "id = ?", selA, null, null, null);
LentItem item = null;
cursor.moveToFirst();
if (!cursor.isAfterLast()) {
item = cursorToLentItem(cursor);
}
// Make sure to close the cursor
cursor.close();
return item;
}
use of de.geeksfactory.opacclient.objects.LentItem in project opacclient by opacapp.
the class AccountDataSource method cursorToLentItem.
private LentItem cursorToLentItem(Cursor cursor) {
LentItem item = new LentItem();
setAccountItemAttributes(cursor, item);
item.setBarcode(cursor.getString(7));
item.setDeadline(cursor.getString(8));
item.setHomeBranch(cursor.getString(9));
item.setLendingBranch(cursor.getString(10));
item.setProlongData(cursor.getString(11));
item.setRenewable(cursor.getInt(12) == 1);
item.setDownloadData(cursor.getString(13));
item.setEbook(cursor.getInt(14) == 1);
return item;
}
use of de.geeksfactory.opacclient.objects.LentItem in project opacclient by opacapp.
the class AccountDataSource method getAllLentItems.
public List<LentItem> getAllLentItems() {
List<LentItem> items = new ArrayList<>();
Cursor cursor = database.query(AccountDatabase.TABLENAME_LENT, AccountDatabase.COLUMNS_LENT, null, null, null, null, null);
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
LentItem item = cursorToLentItem(cursor);
items.add(item);
cursor.moveToNext();
}
cursor.close();
return items;
}
use of de.geeksfactory.opacclient.objects.LentItem in project opacclient by opacapp.
the class PicaLBSAccountTest method testParseMediaList.
@Test
public void testParseMediaList() throws OpacApi.OpacErrorException {
String html = readResource("/pica_lbs/medialist/" + file);
// we may not have all files for all libraries
if (html == null)
return;
List<LentItem> media = PicaLBS.parseMediaList(Jsoup.parse(html), new DummyStringProvider());
assertTrue(media.size() > 0);
for (LentItem item : media) {
assertNotNull(item.getTitle());
assertNotNull(item.getDeadline());
}
}
use of de.geeksfactory.opacclient.objects.LentItem in project opacclient by opacapp.
the class SISISAccountTest method testParseMediaList.
@Test
public void testParseMediaList() throws OpacApi.OpacErrorException {
String html = readResource("/sisis/medialist/" + file);
// we may not have all files for all libraries
if (html == null)
return;
List<LentItem> media = new ArrayList<LentItem>();
Document doc = Jsoup.parse(html);
SISIS.parse_medialist(media, doc, 0, new JSONObject());
if (!file.equals("dresden.html")) {
assertTrue(media.size() > 0);
}
// The test is still useful: Before 4.5.10 we actually had a bug with empty accounts.
for (LentItem item : media) {
assertNotNull(item.getTitle());
assertNotNull(item.getDeadline());
}
Map<String, Integer> links = SISIS.getAccountPageLinks(doc);
if (file.equals("erfurt.html")) {
// here we have two pages
assertTrue(links.size() == 1);
assertTrue(links.get("https://opac.erfurt.de/webOPACClient/userAccount" + ".do?methodToCall=pos&accountTyp=AUSLEIHEN&anzPos=11").equals(11));
}
}
Aggregations