de.h_da.library.borrowing.usecase
Interface Borrowing


public interface Borrowing

[usecase] This use case comprises all library customer functionality for borrowing and returning books.


Method Summary
 int borrowBook(int bookOnStockId, int customerId)
          [command] Generates a new Loan object.
 void returnBook(int loanId)
          [command] Marks a Loan as being returned.
 

Method Detail

borrowBook

int borrowBook(int bookOnStockId,
               int customerId)
[command] Generates a new Loan object.

Parameters:
bookOnStockId - [in] id of BookOnStock to be borrowed
customerId - [in] id of Customer who borrows the book
Returns:
[out] id of generated Loan object
    [pre exists Customer c: c.id == customerId
     pre exists BookOnStock boS: boS.id == bookOnStockId
     post exists new Loan l:
       l.id == result
       && l.loanDate is current date
       && l.dueDate is current date plus 30 days
       && l.customer.id == customerId
       && l.bookOnStock.id == bookOnStockId
       && l.reminder == null
       && l.status == LoanStatus.BORROWED
     ]
 

returnBook

void returnBook(int loanId)
[command] Marks a Loan as being returned.

Parameters:
loanId - [in] id of Loan object
   [pre exists Loan l (l.id == loanId)
    pre l.status == LoanStatus.BORROWED
    post l.status == LoanStatus.RETURNED
   ]