Пример #1
0
 public void delete(MediaCopy copy) {
   for (Iterator iter = mediaCopies.values().iterator(); iter.hasNext(); ) {
     List list = (List) iter.next();
     if (list.remove(copy)) {
       return;
     }
   }
 }
Пример #2
0
 public int copyCount() {
   int count = 0;
   for (Iterator iter = mediaCopies.values().iterator(); iter.hasNext(); ) {
     List list = (List) iter.next();
     count += list.size();
   }
   return count;
 }
Пример #3
0
 public MediaCopy findCopyById(String copyId) {
   Collection listsOfCopies = mediaCopies.values();
   for (Iterator i = listsOfCopies.iterator(); i.hasNext(); ) {
     List copies = (List) i.next();
     for (int j = 0; j < copies.size(); j++) {
       MediaCopy mediaCopy = (MediaCopy) copies.get(j);
       if (mediaCopy.getId().equals(copyId)) return mediaCopy;
     }
   }
   return null;
 }
Пример #4
0
 public List findAllLoanReceiptsFor(String patronId) {
   List receipts = new LinkedList();
   Collection copyLists = mediaCopies.values();
   for (Iterator i = copyLists.iterator(); i.hasNext(); ) {
     List copyList = (List) i.next();
     for (int j = 0; j < copyList.size(); j++) {
       MediaCopy mediaCopy = (MediaCopy) copyList.get(j);
       LoanReceipt receipt = mediaCopy.getLoanReceipt();
       if (receipt != null && receipt.getBorrower().getId().equals(patronId))
         receipts.add(receipt);
     }
   }
   return receipts;
 }