Skip to content

Commit

Permalink
Implement support for SLUB Dresden (#553)
Browse files Browse the repository at this point in the history
* Add SLUB API, implement parseSearchFields and getSupportFlags

This API is specific for SLUB in Dresden.

* Implement search, searchGetPage, getResultById, prolong, account, checkAccountData

* Implement getShareUrl

* Add two more mediatypes

* Refactor for testing, add tests

for account, search result and detailed item

* Include year in search results only if not "null"

* Correctly process reserved inter-library loan items

* Make test of expiry date work independently of locale

Format expected date value according to current locale (required
for CI testing)

* implement cancel

* Change search method from POST to GET

If the search yields exactly one result then the POST method doesn't return a
JSON object but the html catalogue detail web site of this item. Using GET
handles this case correctly (returns JSON with one item).

* Add MIT license header

as requested at https://github.com/opacapp/opacclient/wiki

* Change all http requests methods from POST to GET

As of Jan 15, 2020, all account POST requests get redirected to the web catalogue
login page and POST requests for all search requests get redirected to the html
result pages of the web catalogue.

* Add remaining details to DetailedItem and fix reserved and lent items

* Add SUPPORT_FLAG_ENDLESS_SCROLLING flag

to prevent reloading the page the selected result is located on before
calling getResultById.

* Partly revert d18931b

As of Jan 17, 2020, POST requests are accepted again. So we change the
account requests back to POST for security reasons (see recommendation
https://tools.ietf.org/html/rfc2616#section-15.1.3)

* Process boolean status values in account request results

and add test for requestAccount

* Implement reservation and tests for it

- minor fix to SLUBAccountMockTest
- combine all SLUB tests into test suite

* Fix code analysis issues

and simplify isRenewable assignment

* Refactor mapping of json array to map for pickup points

to simplify code

* Add SLUB API, implement parseSearchFields and getSupportFlags

This API is specific for SLUB in Dresden.

* Implement search, searchGetPage, getResultById, prolong, account, checkAccountData

* Implement getShareUrl

* Add two more mediatypes

* Refactor for testing, add tests

for account, search result and detailed item

* Include year in search results only if not "null"

* Correctly process reserved inter-library loan items

* Make test of expiry date work independently of locale

Format expected date value according to current locale (required
for CI testing)

* implement cancel

* Change search method from POST to GET

If the search yields exactly one result then the POST method doesn't return a
JSON object but the html catalogue detail web site of this item. Using GET
handles this case correctly (returns JSON with one item).

* Add MIT license header

as requested at https://github.com/opacapp/opacclient/wiki

* Change all http requests methods from POST to GET

As of Jan 15, 2020, all account POST requests get redirected to the web catalogue
login page and POST requests for all search requests get redirected to the html
result pages of the web catalogue.

* Add remaining details to DetailedItem and fix reserved and lent items

* Add SUPPORT_FLAG_ENDLESS_SCROLLING flag

to prevent reloading the page the selected result is located on before
calling getResultById.

* Partly revert d18931b

As of Jan 17, 2020, POST requests are accepted again. So we change the
account requests back to POST for security reasons (see recommendation
https://tools.ietf.org/html/rfc2616#section-15.1.3)

* Process boolean status values in account request results

and add test for requestAccount

* Implement reservation and tests for it

- minor fix to SLUBAccountMockTest
- combine all SLUB tests into test suite

* Fix code analysis issues

and simplify isRenewable assignment

* Fix error with no_criteria_input introduced in 118089a

- and add tests for search
- tests for parseSearchFields
- add dropdown search field for access (physical/digital) and fix url build method
  the prevent issues with space in url query name part

* Refactor mapping of json array to map for pickup points

to simplify code

* Implement renewal for inter-library loan items and tests for it

* Fix various code formatting issues

* Fix parseSearchFields according to new catalogue homepage

'baseurl' actually gets redirected to https://www.slub-dresden.de/
which then gets redirected to https://www.slub-dresden.de/startseite/.
This works as the default 'followRedirects' setting in OkHttpClient
Builder() is true.

* Fix status message

Provide status only if not renewable. Status gives the reason why the item is not
renewable (SLUB changed its policy: items can be renewed more than 2 times now)

* Remove colon from test resource file name

to enable build on Windows systems as colons are not allowed in Windows file names.

* Replace ExpectedException.none() by assertThrows

as the former became deprecated in JUnit 4.13

* Make lent items status message strings translatable

* Fix code analysis warning overriding '@string/copy'

which is marked as private in androidx.preference:preference.

* Rename string COPY to ITEM_COPY

to prevent overriding '@string/copy' which is marked as private in androidx.preference:preference.
This basically reverts commit b5ea66f and prevents the warning by renaming instead of marking the
string as overriding.

* Fix typo and coding conventions issue

(lambda argument should be moved out of parentheses)

* Add tests for Cancel

* Use DummyStringProvider for testing

* Add comment about FL = inter-library loan

* Simplify code

by replacing .map with .forEach

* Change JSON getters from opt to get

in cases where the item is always available.

* Set SearchResult.MediaType to NONE for unknown formats
  • Loading branch information
StefRe authored Oct 15, 2020
1 parent f0925d6 commit 9ed8476
Show file tree
Hide file tree
Showing 25 changed files with 5,276 additions and 0 deletions.
1 change: 1 addition & 0 deletions opacclient/libopac/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies {
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'com.shazam:shazamcrest:0.11'
}

task copyTestResources(type: Copy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import de.geeksfactory.opacclient.apis.Primo;
import de.geeksfactory.opacclient.apis.SISIS;
import de.geeksfactory.opacclient.apis.SLIM;
import de.geeksfactory.opacclient.apis.SLUB;
import de.geeksfactory.opacclient.apis.SRU;
import de.geeksfactory.opacclient.apis.TestApi;
import de.geeksfactory.opacclient.apis.TouchPoint;
Expand Down Expand Up @@ -141,6 +142,8 @@ public static OpacApi create(Library lib, StringProvider sp, HttpClientFactory h
newApiInstance = new Koha();
} else if (lib.getApi().equals("netbiblio")) {
newApiInstance = new NetBiblio();
} else if (lib.getApi().equals("slub")) {
newApiInstance = new SLUB();
} else if (lib.getApi().equals("arena")) {
newApiInstance = new Arena();
} else if (lib.getApi().equals("slim")) {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ public interface StringProvider {
String PLEASE_CHANGE_PASSWORD = "please_change_password";
String PROLONG_ALL_NOT_POSSIBLE = "prolong_all_not_possible";
String PROLONG_ALL_NO_ITEMS = "prolong_all_no_items";
String HOLD = "hold";
String REQUEST_READY = "request_ready";
String READINGROOM = "readingroom";
String REQUEST_PROGRESS = "request_progress";
String RESERVED_POS = "reserved_pos";
String ITEM_COPY = "item_copy";
String RESERVED = "reserved";
String RENEWED = "renewed";

/**
* Returns the translated string identified by identifier
Expand Down
3 changes: 3 additions & 0 deletions opacclient/libopac/src/main/resources/meanings/slub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Zugang": "DIGITAL"
}
Loading

0 comments on commit 9ed8476

Please sign in to comment.