public class LibraryTransactionDAO extends Object
| Constructor and Description |
|---|
LibraryTransactionDAO() |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelRequest(long reader,
String isbn)
Cancels a pending request by a reader for a book
|
long[] |
getCopies(String isbn,
long location)
Returns a list of ids of copies of the book with the given isbn
whose last known location is the given location.
|
long |
getLastLocation(long book)
Queries the transaction table to determine the last location where a book
was checked in or out.
|
long |
getPossessor(long book)
Queries the transaction table to determine the whereabouts of a book.
|
List<Long> |
getRequestors(String isbn,
long location)
Retrieves a List of requesters for a book (identified by isbn) in a given location.
|
List |
getTransactions(long book)
Gets the entire transaction history for a book and returns
a List of LibraryTransaction objects or empty if none found
|
void |
processCheckin(long reader,
long book,
long location)
Records a book checkin in the transaction table.
|
void |
processCheckout(long reader,
long book,
String isbn,
long location)
Records a book checkout in the transaction table.
|
void |
processRequest(long reader,
long book,
long location)
Records book request transaction.
|
boolean |
requestPending(long reader,
long book)
Returns whether a reader has a pending request for a particular book (id)
|
LibraryTransaction |
retrieve(long id)
Retrieves a LibraryTransaction using its transaction id.
|
void |
setDeleteReaderBookRequestActionTransactionSQL(String deleteReaderBookRequestActionTransactionSQL)
Used for Spring Dependency Injection
|
void |
setGetCopiesSQL(String getCopiesSQL) |
void |
setGetLastLocationSQL(String getLastLocationSQL) |
void |
setInsertReaderBookActionTransactionSQL(String insertReaderBookActionTransactionSQL)
Used for Spring Dependency Injection
|
void |
setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
Used for Spring Dependency Injection
|
void |
setResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource resourceBundleMessageSource)
Used for Spring Dependency Injection
|
void |
setSelectAllBookTransactionByBookIdSQL(String selectAllBookTransactionByBookIdSQL)
Used for Spring Dependency Injection
|
void |
setSelectReaderByBookIdActionIdSQL(String selectReaderByBookIdActionIdSQL)
Used for Spring Dependency Injection
|
void |
setSelectReaderISBNActionIdLocationIdSQL(String selectReaderISBNActionIdLocationIdSQL) |
void |
setSelectTransactionBookIdActionIdLocationIdSQL(String selectTransactionBookIdActionIdLocationIdSQL)
Used for Spring Dependency Injection
|
void |
setSelectTransactionBookIdNotActionIdSQL(String selectTransactionBookIdNotActionIdSQL)
Used for Spring Dependency Injection
|
void |
setSelectTransactionBytransactionIdReaderIdBookIdSQL(String selectTransactionBytransactionIdReaderIdBookIdSQL)
Used for Spring Dependency Injection
|
public void setSelectAllBookTransactionByBookIdSQL(String selectAllBookTransactionByBookIdSQL)
public void setSelectReaderByBookIdActionIdSQL(String selectReaderByBookIdActionIdSQL)
public void setSelectTransactionBookIdActionIdLocationIdSQL(String selectTransactionBookIdActionIdLocationIdSQL)
public void setSelectTransactionBookIdNotActionIdSQL(String selectTransactionBookIdNotActionIdSQL)
public void setDeleteReaderBookRequestActionTransactionSQL(String deleteReaderBookRequestActionTransactionSQL)
public void setSelectTransactionBytransactionIdReaderIdBookIdSQL(String selectTransactionBytransactionIdReaderIdBookIdSQL)
public void setInsertReaderBookActionTransactionSQL(String insertReaderBookActionTransactionSQL)
public void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
jdbcTemplate - The jdbcTemplate to set.public void setGetLastLocationSQL(String getLastLocationSQL)
getLastLocationSQL - the getLastLocationSQL to setpublic void setGetCopiesSQL(String getCopiesSQL)
getCopiesSQL - the getCopiesSQL to setpublic void setResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource resourceBundleMessageSource)
public void setSelectReaderISBNActionIdLocationIdSQL(String selectReaderISBNActionIdLocationIdSQL)
selectReaderISBNActionIdLocationIdSQL - the selectReaderISBNActionIdLocationIdSQL to setpublic LibraryTransaction retrieve(long id) throws LibraryException
id - the ID of the transaction to look upLibraryException - if there is a problem looking
up the transaction or the transaction does not existpublic void processCheckin(long reader,
long book,
long location)
throws LibraryException
book - the id of the book being checked inreader - the id of the reader checking in the booklocation - the id of the location of the transactionLibraryException - if an error occurs updating the transaction
tablepublic void processCheckout(long reader,
long book,
String isbn,
long location)
throws LibraryException
Records a book checkout in the transaction table. Inserts a checkout transaction and removes the pending request. Does not send notifications.
If the book is not checked in, throws LibraryException.
book - the id of the book being checked outreader - the id of the reader checking out the booklocation - the id of the location of the transactionisbn - of the bookLibraryException - if the book is not checked in, or an
error occurs recording the transactionpublic long getPossessor(long book)
throws LibraryException
Queries the transaction table to determine the whereabouts of a book.
Returns the id of the reader who is currently holding the book. If the book is "checked in", returns CHECKED_IN. If there are no transactions associated with the book, returns NO_TRANSACTIONS.
book - the id of the book being soughtLibraryException - if the book does not exist
or an SQL processing error occurspublic void processRequest(long reader,
long book,
long location)
throws LibraryException
book - = the id of the book being requestedreader - = the id of the reader making the requestLibraryException - if an error occurs updating the databasepublic List<Long> getRequestors(String isbn, long location) throws LibraryException
isbn - the isbn of the book being requestedlocation - the id of the locationLibraryException - if an error occurs accessing the databasepublic boolean requestPending(long reader,
long book)
throws LibraryException
book - = the id of the bookreader - = the id of the readerLibraryExceptionpublic void cancelRequest(long reader,
String isbn)
throws LibraryException
isbn - = the isbn of the book being requestedreader - = the id of the reader making the requestLibraryExceptionpublic List getTransactions(long book) throws LibraryException
book - = id of the book to retrieve transactions forLibraryExceptionpublic long getLastLocation(long book)
throws LibraryException
book - LibraryExceptionpublic long[] getCopies(String isbn, long location) throws LibraryException
isbn - ISBN of the book being soughtLibraryExceptionCopyright © 2003-2017 The Virtual Library Team. All Rights Reserved.