de.h_da.library.reminder.usecase
Interface Reminding


public interface Reminding

[usecase] This use case comprises all functionality concerned with the reminding / dunning process of the library.


Method Summary
 void closeReminder(int invoiceId)
          [command] Closes a reminder, e.g. due to the reception of the reminder fee.
 void sendReminders()
          [command] Daily batch to detect all overdue loans, generate reminders and corresponding invoices.
 

Method Detail

closeReminder

void closeReminder(int invoiceId)
[command] Closes a reminder, e.g. due to the reception of the reminder fee.

Parameters:
invoiceId - id of the invoice sent due to the reminder
     [pre exists Reminder r: r.invoiceId == invoiceId
      pre r.status == ReminderStatus.ACTIVE
      post r.status == ReminderStatus.CLOSED
     ]
 

sendReminders

void sendReminders()
[command] Daily batch to detect all overdue loans, generate reminders and corresponding invoices.
    [post 
       foreach Loan l (l.dueDate < current date // book is overdue
         && !exists Reminder rem: rem.loan.equals(l)):  // and not yet reminded  
         exists new Invoice i:  // has been newly created by this method
           i.date is current date 
           && i.subject.equals("Library Reminder")
           && i.name.equals(l.customer.name)
           && i.address.equals(l.customer.address)
           && i.amount == 300  // EUR 3,00 reminder fee per book
         && exists new Reminder r: // has been newly created by this method
           r.loan == l  // the loan that caused the reminder
           && r.fee == 300  // EUR 3,00 reminder fee per book
           && r.issueDate is current date
           && r.dueDate is current date + 20 days
           && r.invoiceId == i.id
           && r.status == ReminderStatus.ACTIVE
    ]