Modifier and Type | Class and Description |
---|---|
class |
TouchPoint.SingleResultFound |
OpacApi.CancelResult, OpacApi.MultiStepResult, OpacApi.OpacErrorException, OpacApi.ProlongAllResult, OpacApi.ProlongResult, OpacApi.ReservationResult
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
CSId |
protected org.json.JSONObject |
data |
protected static java.util.HashMap<java.lang.String,SearchResult.MediaType> |
defaulttypes |
protected java.lang.String |
ENCODING |
protected java.lang.String |
identifier |
protected long |
logged_in |
protected Account |
logged_in_as |
protected java.lang.String |
opac_url |
protected int |
resultcount |
protected java.lang.String |
reusehtml_reservation |
protected long |
SESSION_LIFETIME |
http_client, httpLoggingEnabled, initialised, KEY_SEARCH_QUERY_AUDIENCE, KEY_SEARCH_QUERY_AUTHOR, KEY_SEARCH_QUERY_AVAILABLE, KEY_SEARCH_QUERY_BARCODE, KEY_SEARCH_QUERY_BRANCH, KEY_SEARCH_QUERY_CATEGORY, KEY_SEARCH_QUERY_DIGITAL, KEY_SEARCH_QUERY_FREE, KEY_SEARCH_QUERY_HOME_BRANCH, KEY_SEARCH_QUERY_ISBN, KEY_SEARCH_QUERY_KEYWORDA, KEY_SEARCH_QUERY_KEYWORDB, KEY_SEARCH_QUERY_LOCATION, KEY_SEARCH_QUERY_ORDER, KEY_SEARCH_QUERY_PUBLISHER, KEY_SEARCH_QUERY_SYSTEM, KEY_SEARCH_QUERY_TITLE, KEY_SEARCH_QUERY_YEAR, KEY_SEARCH_QUERY_YEAR_RANGE_END, KEY_SEARCH_QUERY_YEAR_RANGE_START, library, stringProvider, supportedLanguages
SUPPORT_FLAG_ACCOUNT_PROLONG_ALL, SUPPORT_FLAG_CHANGE_ACCOUNT, SUPPORT_FLAG_ENDLESS_SCROLLING, SUPPORT_FLAG_QUICKLINKS, SUPPORT_FLAG_WARN_PROLONG_FEES, SUPPORT_FLAG_WARN_RESERVATION_FEES
Constructor and Description |
---|
TouchPoint() |
Modifier and Type | Method and Description |
---|---|
AccountData |
account(Account acc)
Load account view (borrowed and reserved items, see
AccountData )
This function is always called from a background thread, you can use blocking network
operations in it. |
OpacApi.CancelResult |
cancel(java.lang.String media,
Account account,
int useraction,
java.lang.String selection)
Cancel a media reservation/order identified by the given String (see AccountData
documentation) (see
AccountData )
This function is always called from a background thread, you can use blocking network
operations in it. |
void |
checkAccountData(Account account)
Check the validity of given account data.
|
SearchRequestResult |
filterResults(Filter filter,
Filter.Option option)
If your
OpacApi.search(List) implementation puts something different from null
into SearchRequestResult.setFilters(List) , this will be called to apply a filter to
the last search request. |
DetailledItem |
getResult(int nr)
Get details for the item at
position from last OpacApi.search(java.util.List<de.geeksfactory.opacclient.searchfields.SearchQuery>) or OpacApi.searchGetPage(int) call. |
DetailledItem |
getResultById(java.lang.String id,
java.lang.String homebranch)
Get details for the item with unique ID id.
|
java.lang.String |
getShareUrl(java.lang.String id,
java.lang.String title)
Some library systems allow us to share search results.
|
java.util.Set<java.lang.String> |
getSupportedLanguages()
Get all languages supported by this library.
|
int |
getSupportFlags()
Return which optional features your API implementation supports.
|
void |
init(Library lib,
HttpClientFactory httpClientFactory)
Initializes HTTP client and String Provider
|
protected de.geeksfactory.opacclient.apis.TouchPoint.LoginResponse |
login(Account acc) |
protected DetailledItem |
parse_result(java.lang.String html) |
protected SearchRequestResult |
parse_search_wrapped(java.lang.String html,
int page) |
protected SearchRequestResult |
parse_search(java.lang.String html,
int page) |
java.util.List<SearchField> |
parseSearchFields() |
OpacApi.ProlongResult |
prolong(java.lang.String a,
Account account,
int useraction,
java.lang.String Selection)
Extend the lending period of the item identified by the given String (see
AccountData )
This function is always called from a background thread, you can use blocking network
operations in it. |
OpacApi.ProlongAllResult |
prolongAll(Account account,
int useraction,
java.lang.String selection)
Extend the lending period of all lent items.
|
OpacApi.ReservationResult |
reservation(DetailledItem item,
Account acc,
int useraction,
java.lang.String selection)
Perform a reservation on the item last fetched with
getResultById or
getResult for Account acc . |
SearchRequestResult |
search(java.util.List<SearchQuery> query)
Performs a catalogue search.
|
SearchRequestResult |
searchGetPage(int page)
Get result page
page of the search performed last with OpacApi.search(java.util.List<de.geeksfactory.opacclient.searchfields.SearchQuery>) . |
void |
setLanguage(java.lang.String language)
Set the language to use.
|
void |
start()
May be called on application startup and you are free to call it in our
OpacApi.search(java.util.List<de.geeksfactory.opacclient.searchfields.SearchQuery>)
implementation or similar positions. |
SearchRequestResult |
volumeSearch(java.util.Map<java.lang.String,java.lang.String> query)
Performs a catalogue search for volumes of an item.
|
buildHttpGetParams, cleanUrl, convertStreamToString, convertStreamToString, downloadCover, getDefaultEncoding, getQueryParams, getQueryParamsFirst, getSearchFields, httpGet, httpGet, httpGet, httpGet, httpPost, httpPost, httpPost, httpPost, logHttpError, searchQueryListToMap, setHttpLoggingEnabled, setStringProvider, shouldUseMeaningDetector
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSearchFields, setStringProvider
protected static java.util.HashMap<java.lang.String,SearchResult.MediaType> defaulttypes
protected final long SESSION_LIFETIME
protected java.lang.String opac_url
protected org.json.JSONObject data
protected java.lang.String CSId
protected java.lang.String identifier
protected java.lang.String reusehtml_reservation
protected int resultcount
protected long logged_in
protected Account logged_in_as
protected java.lang.String ENCODING
public java.util.List<SearchField> parseSearchFields() throws java.io.IOException, org.json.JSONException
parseSearchFields
in class BaseApi
java.io.IOException
org.json.JSONException
public void start() throws java.io.IOException
OpacApi
OpacApi.search(java.util.List<de.geeksfactory.opacclient.searchfields.SearchQuery>)
implementation or similar positions. It is commonly used to initialize a session. You MUST
NOT rely on it being called and should check by yourself, whether it was already called (if
your following calls require it to be called before). You SHOULD use this function to
populate the MetaDataSource e.g. with information on your library's branches.
This function is always called from a background thread, you can use blocking network
operations in it.start
in interface OpacApi
start
in class BaseApi
java.io.IOException
- if network connection failedNotReachableException
- may throw this if the library couldn't be reachedpublic void init(Library lib, HttpClientFactory httpClientFactory)
BaseApi
init
in interface OpacApi
init
in class BaseApi
lib
- The library the Api is initialized forhttpClientFactory
- A HttpClientFactory instance that will be used for instantiating
HTTP clients. This factory is pluggable because we want to use
platform-specific code on Android.public SearchRequestResult search(java.util.List<SearchQuery> query) throws java.io.IOException, OpacApi.OpacErrorException, org.json.JSONException
OpacApi
List<SearchQuery>
contains the
search criteria. See documentation on SearchResult
for details.
This function is always called from a background thread, you can use blocking network
operations in it. See documentation on DetailledItem for details.search
in interface OpacApi
query
- see aboveorg.json.JSONException
java.io.IOException
OpacApi.OpacErrorException
SearchResult
public SearchRequestResult volumeSearch(java.util.Map<java.lang.String,java.lang.String> query) throws java.io.IOException, OpacApi.OpacErrorException
OpacApi
DetailledItem.getVolumesearch()
.
This function is always called from a background thread, you can use blocking network
operations in it. See documentation on DetailledItem for details.volumeSearch
in interface OpacApi
volumeSearch
in class BaseApi
query
- see abovejava.io.IOException
OpacApi.OpacErrorException
SearchResult
public SearchRequestResult searchGetPage(int page) throws java.io.IOException, OpacApi.OpacErrorException
OpacApi
page
of the search performed last with OpacApi.search(java.util.List<de.geeksfactory.opacclient.searchfields.SearchQuery>)
.
This function is always called from a background thread, you can use blocking network
operations in it. See documentation on DetailledItem for details.searchGetPage
in interface OpacApi
page
- page number to fetchjava.io.IOException
OpacApi.OpacErrorException
OpacApi.search(List)
,
SearchResult
protected SearchRequestResult parse_search_wrapped(java.lang.String html, int page) throws java.io.IOException, OpacApi.OpacErrorException
java.io.IOException
OpacApi.OpacErrorException
protected SearchRequestResult parse_search(java.lang.String html, int page) throws OpacApi.OpacErrorException, java.io.IOException, java.io.IOException, TouchPoint.SingleResultFound
OpacApi.OpacErrorException
java.io.IOException
TouchPoint.SingleResultFound
public DetailledItem getResultById(java.lang.String id, java.lang.String homebranch) throws java.io.IOException
OpacApi
getResultById
in interface OpacApi
id
- id of object to fetchhomebranch
- The users "home branch". "Home" library branch. Some library systems
require this information at search request time to determine where book
reservations should be placed. If in doubt, set to null
.java.io.IOException
DetailledItem
public DetailledItem getResult(int nr) throws java.io.IOException
OpacApi
position
from last OpacApi.search(java.util.List<de.geeksfactory.opacclient.searchfields.SearchQuery>)
or OpacApi.searchGetPage(int)
call.
We generally prefer OpacApi.getResultById(String, String)
, so if you implement
getResultById
AND every search result of your driver
has an id set, you can omit this method (respectively, return null).
This function is always called from a background thread, you can use blocking network
operations in it.getResult
in interface OpacApi
nr
- position of object in last searchjava.io.IOException
DetailledItem
protected DetailledItem parse_result(java.lang.String html) throws java.io.IOException
java.io.IOException
public OpacApi.ReservationResult reservation(DetailledItem item, Account acc, int useraction, java.lang.String selection) throws java.io.IOException
OpacApi
getResultById
or
getResult
for Account acc
. (if applicable)
This function is always called from a background thread, you can use blocking network
operations in it.reservation
in interface OpacApi
item
- The item to place a reservation for.acc
- Account to be useduseraction
- Identifier for the selection made by the user in selection
, if
a selection was made (see OpacApi.MultiStepResult.getActionIdentifier()
)
or 0, if no selection was required. If your last method call returned
CONFIRMATION_NEEDED
, this is set to
ACTION_CONFIRMATION
if the user positively confirmed the action.selection
- When the method is called for the first time or if useraction is
ACTION_CONFIRMATION
, this parameter is null. If you return
SELECTION
in your OpacApi.MultiStepResult.getStatus()
, this
method will be called again with the user's selection present in
selection.ReservationResult
object which has to have the status set.java.io.IOException
public OpacApi.ProlongResult prolong(java.lang.String a, Account account, int useraction, java.lang.String Selection) throws java.io.IOException
OpacApi
AccountData
)
This function is always called from a background thread, you can use blocking network
operations in it.prolong
in interface OpacApi
a
- Media identificationaccount
- Account to be useduseraction
- Identifier for the selection made by the user in selection
, if
a selection was made (see OpacApi.MultiStepResult.getActionIdentifier()
) or
0, if no selection was required. If your last method call returned
CONFIRMATION_NEEDED
, this is set to
ACTION_CONFIRMATION
if the user positively confirmed the action.Selection
- When the method is called for the first time or if useraction is
ACTION_CONFIRMATION
, this parameter is null. If you return
SELECTION
in your OpacApi.MultiStepResult.getStatus()
, this
method will be called again with the user's selection present in
selection.ProlongResult
object which has to have the status set.java.io.IOException
public OpacApi.CancelResult cancel(java.lang.String media, Account account, int useraction, java.lang.String selection) throws java.io.IOException, OpacApi.OpacErrorException
OpacApi
AccountData
)
This function is always called from a background thread, you can use blocking network
operations in it.cancel
in interface OpacApi
media
- Media identificationaccount
- Account to be useduseraction
- Identifier for the selection made by the user in selection
, if
a selection was made (see OpacApi.MultiStepResult.getActionIdentifier()
) or 0,
if no selection was required. If your last method call returned
CONFIRMATION_NEEDED
, this is set to
ACTION_CONFIRMATION
if the user positively confirmed the action.selection
- When the method is called for the first time or if useraction is
ACTION_CONFIRMATION
, this parameter is null. If you return
SELECTION
in your OpacApi.MultiStepResult.getStatus()
, this
method will be called again with the user's selection present in
selection.CancelResult
object which has to have the status set.java.io.IOException
OpacApi.OpacErrorException
public AccountData account(Account acc) throws java.io.IOException, org.json.JSONException, OpacApi.OpacErrorException
OpacApi
AccountData
)
This function is always called from a background thread, you can use blocking network
operations in it.account
in interface OpacApi
acc
- The account to displayjava.io.IOException
org.json.JSONException
OpacApi.OpacErrorException
AccountData
protected de.geeksfactory.opacclient.apis.TouchPoint.LoginResponse login(Account acc) throws OpacApi.OpacErrorException, java.io.IOException
OpacApi.OpacErrorException
java.io.IOException
public java.lang.String getShareUrl(java.lang.String id, java.lang.String title)
OpacApi
null
. If you
library only accepts direkt links when a session is open, get in touch with me
(mail@raphaelmichel.de) to get it integrated in the opacapp.de proxy.getShareUrl
in interface OpacApi
id
- Media id of the item to be sharedtitle
- Title of the item to be sharedpublic int getSupportFlags()
OpacApi
getSupportFlags
in interface OpacApi
SUPPORT_FLAG_*
constantspublic OpacApi.ProlongAllResult prolongAll(Account account, int useraction, java.lang.String selection) throws java.io.IOException
OpacApi
OpacApi.getSupportFlags()
implementation's return value contains the OpacApi.SUPPORT_FLAG_ACCOUNT_PROLONG_ALL
flag. If you don't support the feature, just implement a
stub method, like return false;
This function is always called from a background thread, you can use blocking network
operations in it.prolongAll
in interface OpacApi
ProlongAllResult
object which has to have the status set.java.io.IOException
OpacApi.prolong(String, Account, int, String)
,
AccountData
public SearchRequestResult filterResults(Filter filter, Filter.Option option) throws java.io.IOException, OpacApi.OpacErrorException
OpacApi
OpacApi.search(List)
implementation puts something different from null
into SearchRequestResult.setFilters(List)
, this will be called to apply a filter to
the last search request.
If your OpacApi.search(List)
implementation does not set SearchRequestResult.setFilters(List)
, this wil never be called. Just return
null
.
This function is always called from a background thread, you can use blocking network
operations in it. See documentation on DetailledItem for details.filterResults
in interface OpacApi
filter
- The filter to be applied.option
- The filters option to be applied. If the option.isApplied()
returns true
, the filter is to be removed!java.io.IOException
OpacApi.OpacErrorException
SearchResult
,
Filter
public void checkAccountData(Account account) throws java.io.IOException, org.json.JSONException, OpacApi.OpacErrorException
OpacApi
OpacApi.account(Account)
function because just checking the login can be much faster than retrieving all the account
data.
This function is always called from a background thread, you can use blocking network
operations in it.checkAccountData
in interface OpacApi
account
- The account to checkOpacApi.OpacErrorException
- when the login data is invalid or there's another error message
from the OPAC systemjava.io.IOException
org.json.JSONException
public void setLanguage(java.lang.String language)
OpacApi
setLanguage
in interface OpacApi
language
- the language to usepublic java.util.Set<java.lang.String> getSupportedLanguages() throws java.io.IOException
OpacApi
getSupportedLanguages
in interface OpacApi
java.io.IOException