Interface BookBatchAdminSession
- All Superinterfaces:
AutoCloseable, BookAdminSession, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes Books in bulk. The
data for create and update is provided by the consumer via the form
object. OsidForms are requested for each create or update and may
not be reused.
Create and update operations differ in their usage. To create an
Book , an BookForm is requested using
getBookFormsForCreate() specifying the desired record Types or
none if no record Types are needed. Each of the returned
BookForms will indicate that it is to be used with a create operation and
can be used to examine metdata or validate data prior to creation. Once an
BookForm is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each BookForm corresponds to an attempted transaction.
The BookForms returned from getBookFormsForCreate()
may be linked to the originating request through the peer Ids of
the BookForm . In the case where there may be duplicates, any
BookForm of the same peer Ids may be used for a create
operation.
Once a batch of BookForms are submitted for create, a
CreateResponse is returned for each BookForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createBooks() , errors specific to an
individual BookForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
BookForm through the BookForm Id .
For updates, BookForms are requested to the Book
Id that is to be updated using getBookFormsForUpdate()
where the reference Id in the BookForm may be used to link
the request. Similarly, the BookForm has metadata about the data
that can be updated and it can perform validation before submitting the
update. The BookForm can only be used once for a successful update
and cannot be reused.
Once a batch of BookForms are submitted for update, an
UpdateResponse is returned for each BookForm , although the
ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateBooks() , errors specific to an
individual BookForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
BookForm through the BookForm Id .
The delete operations delete Books in bulk. Bulk delete
operations return the results in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasBooks(AliasRequestList aliasRequests) Adds anIdto anBookfor the purpose of creating compatibility.createBooks(BookBatchFormList bookForms) Creates a new set ofBooks.Deletes allBooks.deleteBooks(IdList bookIds) Deletes books for the givenIds.getBookFormsForCreate(long number, Type[] bookRecordTypes) Gets the book forms for creating a bunch of new books.getBookFormsForUpdate(IdList bookIds) Gets the book forms for updating an existing set of books.updateBooks(BookBatchFormList bookForms) Updates existing books.Methods inherited from interface BookAdminSession
aliasBook, canCreateBooks, canCreateBookWithRecordTypes, canDeleteBooks, canManageBookAliases, canUpdateBooks, createBook, deleteBook, getBookFormForCreate, getBookFormForUpdate, updateBookModifier and TypeMethodDescriptionvoidAdds anIdto aBookfor the purpose of creating compatibility.booleanTests if this user can createBooks.booleancanCreateBookWithRecordTypes(Type[] bookRecordTypes) Tests if this user can create a singleBookusing the desired record types.booleanTests if this user can deleteBooksA return of true does not guarantee successful authorization.booleanTests if this user can manageIdaliases forBooks.booleanTests if this user can updateBooks.createBook(BookForm bookForm) Creates a newBook.voiddeleteBook(Id bookId) Deletes aBook.getBookFormForCreate(Type[] bookRecordTypes) Gets the book form for creating new books.getBookFormForUpdate(Id bookId) Gets the book form for updating an existing book.voidupdateBook(BookForm bookForm) Updates an existing book.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getBookFormsForCreate
BookBatchFormList getBookFormsForCreate(long number, Type[] bookRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the book forms for creating a bunch of new books.- Parameters:
number- the number of forms to retrievebookRecordTypes- array of book record types to be included in each create operation or an empty list if none- Returns:
- the book forms
- Throws:
NullArgumentException-bookRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createBooks
CreateResponseList createBooks(BookBatchFormList bookForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofBooks. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
bookForms- the book forms- Returns:
- the create responses
- Throws:
NullArgumentException-bookFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBookFormsForUpdate
BookBatchFormList getBookFormsForUpdate(IdList bookIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the book forms for updating an existing set of books. A new book form should be requested for each update transaction.- Parameters:
bookIds- theIdsof theBook- Returns:
- the book form
- Throws:
NotFoundException- anbookIdis not foundNullArgumentException-bookIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateBooks
UpdateResponseList updateBooks(BookBatchFormList bookForms) throws OperationFailedException, PermissionDeniedException Updates existing books. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
bookForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-bookFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllBooks
Deletes allBooks.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteBooks
DeleteResponseList deleteBooks(IdList bookIds) throws OperationFailedException, PermissionDeniedException Deletes books for the givenIds.- Parameters:
bookIds- theIdsof the books to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-bookIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasBooks
AliasResponseList aliasBooks(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto anBookfor the purpose of creating compatibility. The primaryIdof theBookis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another book, it is reassigned to the given entryId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-