001 import sale.*; 002 import data.*; 003 import data.ooimpl.*; 004 import data.events.*; 005 import users.*; 006 007 008 /** 009 * Ein registrierter Kunde mitsamt seinem Videobestand. 010 */ 011 public class Customer extends User 012 { 013 014 //// attributes //////////////////////////////////////////////////////////// 015 016 private String customerID; // Kundennummer 017 private StoringStock customerStoringStock; // ausgeliehene Videos 018 019 020 //// constructor /////////////////////////////////////////////////////////// 021 022 /** 023 * Legt einen neuen Kunden an. 024 */ 025 public Customer(String customerID) 026 { 027 super(customerID); 028 029 this.customerID = customerID; 030 customerStoringStock = new StoringStockImpl(customerID, 031 (CatalogImpl)Shop.getTheShop().getCatalog("Video-Catalog")); 032 Shop.getTheShop().addStock(customerStoringStock); 033 } 034 035 036 //// public methods //////////////////////////////////////////////////////// 037 038 /** 039 * Liefert die Kunden-ID. 040 */ 041 public String getCustomerID() 042 { 043 return customerID; 044 } 045 046 /** 047 * Fügt die Kassette dem Bestand des Kunden hinzu. 048 */ 049 public void addVideoCassette(CassetteStoringStockItem cassette) 050 { 051 customerStoringStock.add(cassette, null); 052 } 053 054 /** 055 * Löscht die Kassette aus dem Bestand des Kunden. 056 */ 057 public void removeVideoCassette(CassetteStoringStockItem cassette) 058 { 059 try { 060 customerStoringStock.remove(cassette, null); 061 } 062 catch(VetoException ve) {} 063 } 064 065 /** 066 * Liefert den gesamten Videobestand des Kunden. 067 */ 068 public StoringStock getStoringStock() 069 { 070 return customerStoringStock; 071 } 072 073 }