Modifier and Type | Interface and Description |
---|---|
static class |
OpacApi.CancelResult
The result of a
cancel(String, Account, int, String) call |
static class |
OpacApi.MultiStepResult
The result of a multi-step-supporting method call.
|
static class |
OpacApi.OpacErrorException
A general exception containing a human-readable error message
|
static class |
OpacApi.ProlongAllResult
The result of a
prolongAll(Account, int, String) call |
static class |
OpacApi.ProlongResult
The result of a
prolong(String, Account, int, String) call |
static class |
OpacApi.ReservationResult
The result of a
reservation(DetailledItem, Account, int, String) call |
Modifier and Type | Field and Description |
---|---|
static int |
SUPPORT_FLAG_ACCOUNT_PROLONG_ALL
Availability of the "prolong all lent items" feature
Flag to be present in the result of
getSupportFlags() . |
static int |
SUPPORT_FLAG_CHANGE_ACCOUNT
Allow account change on reservation click.
|
static int |
SUPPORT_FLAG_ENDLESS_SCROLLING
When the results are shown as an endless scrolling list, will reload the page the selected
result is located on if this flag is not present.
|
static int |
SUPPORT_FLAG_QUICKLINKS
Availability of the "quicklinks" feature
Flag to be present in the result of
getSupportFlags() . |
static int |
SUPPORT_FLAG_WARN_PROLONG_FEES
Asks the user responsibly about prolong fees
|
static int |
SUPPORT_FLAG_WARN_RESERVATION_FEES
Asks the user responsibly about reservation fees
Flag to be present in the result of
getSupportFlags() . |
Modifier and Type | Method and Description |
---|---|
AccountData |
account(Account account)
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
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 position)
Get details for the item at
position from last search(java.util.List<de.geeksfactory.opacclient.searchfields.SearchQuery>) or searchGetPage(int) call. |
DetailledItem |
getResultById(java.lang.String id,
java.lang.String homebranch)
Get details for the item with unique ID id.
|
java.util.List<SearchField> |
getSearchFields()
Returns a list of search criteria which are supported by this OPAC and should be visible in
the search activity.
|
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 library,
HttpClientFactory httpClientFactory)
Is called whenever a new API object is created.
|
OpacApi.ProlongResult |
prolong(java.lang.String media,
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 account,
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 search(java.util.List<de.geeksfactory.opacclient.searchfields.SearchQuery>) . |
void |
setLanguage(java.lang.String language)
Set the language to use.
|
void |
setStringProvider(StringProvider stringProvider)
Sets the StringProvider to use for error messages etc.
|
void |
start()
May be called on application startup and you are free to call it in our
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.
|
static final int SUPPORT_FLAG_ACCOUNT_PROLONG_ALL
getSupportFlags()
.static final int SUPPORT_FLAG_QUICKLINKS
getSupportFlags()
.static final int SUPPORT_FLAG_ENDLESS_SCROLLING
getSupportFlags()
.static final int SUPPORT_FLAG_CHANGE_ACCOUNT
getSupportFlags()
.static final int SUPPORT_FLAG_WARN_RESERVATION_FEES
getSupportFlags()
.static final int SUPPORT_FLAG_WARN_PROLONG_FEES
void start() throws java.io.IOException
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.java.io.IOException
- if network connection failedNotReachableException
- may throw this if the library couldn't be reachedvoid init(Library library, HttpClientFactory httpClientFactory)
library
- 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.SearchRequestResult search(java.util.List<SearchQuery> query) throws java.io.IOException, OpacApi.OpacErrorException, org.json.JSONException
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.query
- see aboveorg.json.JSONException
java.io.IOException
OpacApi.OpacErrorException
SearchResult
SearchRequestResult volumeSearch(java.util.Map<java.lang.String,java.lang.String> query) throws java.io.IOException, OpacApi.OpacErrorException
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.query
- see abovejava.io.IOException
OpacApi.OpacErrorException
SearchResult
SearchRequestResult filterResults(Filter filter, Filter.Option option) throws java.io.IOException, OpacApi.OpacErrorException
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 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.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
SearchRequestResult searchGetPage(int page) throws java.io.IOException, OpacApi.OpacErrorException, org.json.JSONException
page
of the search performed last with 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.page
- page number to fetchjava.io.IOException
OpacApi.OpacErrorException
org.json.JSONException
search(List)
,
SearchResult
DetailledItem getResultById(java.lang.String id, java.lang.String homebranch) throws java.io.IOException, OpacApi.OpacErrorException
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
OpacApi.OpacErrorException
DetailledItem
DetailledItem getResult(int position) throws java.io.IOException, OpacApi.OpacErrorException
position
from last search(java.util.List<de.geeksfactory.opacclient.searchfields.SearchQuery>)
or searchGetPage(int)
call.
We generally prefer 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.position
- position of object in last searchjava.io.IOException
OpacApi.OpacErrorException
DetailledItem
OpacApi.ReservationResult reservation(DetailledItem item, Account account, int useraction, java.lang.String selection) throws java.io.IOException
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.item
- The item to place a reservation for.account
- 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
OpacApi.ProlongResult prolong(java.lang.String media, Account account, int useraction, java.lang.String selection) throws java.io.IOException
AccountData
)
This function is always called from a background thread, you can use blocking network
operations in it.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.ProlongResult
object which has to have the status set.java.io.IOException
OpacApi.ProlongAllResult prolongAll(Account account, int useraction, java.lang.String selection) throws java.io.IOException
getSupportFlags()
implementation's return value contains the 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.ProlongAllResult
object which has to have the status set.java.io.IOException
prolong(String, Account, int, String)
,
AccountData
OpacApi.CancelResult cancel(java.lang.String media, Account account, int useraction, java.lang.String selection) throws java.io.IOException, OpacApi.OpacErrorException
AccountData
)
This function is always called from a background thread, you can use blocking network
operations in it.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
AccountData account(Account account) throws java.io.IOException, org.json.JSONException, OpacApi.OpacErrorException
AccountData
)
This function is always called from a background thread, you can use blocking network
operations in it.account
- The account to displayjava.io.IOException
org.json.JSONException
OpacApi.OpacErrorException
AccountData
void checkAccountData(Account account) throws java.io.IOException, org.json.JSONException, OpacApi.OpacErrorException
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.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
java.util.List<SearchField> getSearchFields() throws java.io.IOException, OpacApi.OpacErrorException, org.json.JSONException
OpacApi.OpacErrorException
org.json.JSONException
java.io.IOException
search(java.util.List<de.geeksfactory.opacclient.searchfields.SearchQuery>)
java.lang.String getShareUrl(java.lang.String id, java.lang.String title)
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.id
- Media id of the item to be sharedtitle
- Title of the item to be sharedint getSupportFlags()
SUPPORT_FLAG_*
constantsvoid setStringProvider(StringProvider stringProvider)
stringProvider
- the StringProvider to usejava.util.Set<java.lang.String> getSupportedLanguages() throws java.io.IOException
java.io.IOException
void setLanguage(java.lang.String language)
language
- the language to use