Ejemplo n.º 1
0
 private static void createOverdueLoanForCopy(Library library, Copy copy, int position)
     throws IllegalLoanOperationException {
   Loan l = library.createAndAddLoan(getCustomer(library, position), copy);
   GregorianCalendar pickup = l.getPickupDate();
   pickup.add(GregorianCalendar.MONTH, -1);
   pickup.add(GregorianCalendar.DAY_OF_MONTH, -position % 15);
   l.setPickupDate(pickup);
 }
Ejemplo n.º 2
0
 private static void createLoansForCopy(Library library, Copy copy, int position, int count)
     throws IllegalLoanOperationException {
   // Create Loans in the past
   for (int i = count; i > 1; i--) {
     Loan l = library.createAndAddLoan(getCustomer(library, position + i), copy);
     GregorianCalendar pickup = l.getPickupDate();
     pickup.add(GregorianCalendar.MONTH, -i);
     pickup.add(GregorianCalendar.DAY_OF_MONTH, position % 10);
     l.setPickupDate(pickup);
     GregorianCalendar ret = (GregorianCalendar) pickup.clone();
     ret.add(GregorianCalendar.DAY_OF_YEAR, position % 10 + i * 2);
     l.returnCopy(ret);
   }
   // Create actual open loans
   if (position % 2 == 0) {
     Loan l = library.createAndAddLoan(getCustomer(library, position), copy);
     GregorianCalendar pickup = l.getPickupDate();
     pickup.add(GregorianCalendar.DAY_OF_MONTH, -position % 10);
     l.setPickupDate(pickup);
   }
 }