1 8 9 package collections.ship.basic; 10 11 import com.sleepycat.bind.EntryBinding; 12 import com.sleepycat.bind.serial.ClassCatalog; 13 import com.sleepycat.bind.serial.SerialBinding; 14 import com.sleepycat.collections.StoredEntrySet; 15 import com.sleepycat.collections.StoredMap; 16 17 23 public class SampleViews { 24 25 private StoredMap partMap; 26 private StoredMap supplierMap; 27 private StoredMap shipmentMap; 28 29 32 public SampleViews(SampleDatabase db) { 33 34 ClassCatalog catalog = db.getClassCatalog(); 39 EntryBinding partKeyBinding = 40 new SerialBinding(catalog, PartKey.class); 41 EntryBinding partDataBinding = 42 new SerialBinding(catalog, PartData.class); 43 EntryBinding supplierKeyBinding = 44 new SerialBinding(catalog, SupplierKey.class); 45 EntryBinding supplierDataBinding = 46 new SerialBinding(catalog, SupplierData.class); 47 EntryBinding shipmentKeyBinding = 48 new SerialBinding(catalog, ShipmentKey.class); 49 EntryBinding shipmentDataBinding = 50 new SerialBinding(catalog, ShipmentData.class); 51 52 partMap = 58 new StoredMap(db.getPartDatabase(), 59 partKeyBinding, partDataBinding, true); 60 supplierMap = 61 new StoredMap(db.getSupplierDatabase(), 62 supplierKeyBinding, supplierDataBinding, true); 63 shipmentMap = 64 new StoredMap(db.getShipmentDatabase(), 65 shipmentKeyBinding, shipmentDataBinding, true); 66 } 67 68 75 78 public final StoredMap getPartMap() { 79 80 return partMap; 81 } 82 83 86 public final StoredMap getSupplierMap() { 87 88 return supplierMap; 89 } 90 91 94 public final StoredMap getShipmentMap() { 95 96 return shipmentMap; 97 } 98 99 102 public final StoredEntrySet getPartEntrySet() { 103 104 return (StoredEntrySet) partMap.entrySet(); 105 } 106 107 110 public final StoredEntrySet getSupplierEntrySet() { 111 112 return (StoredEntrySet) supplierMap.entrySet(); 113 } 114 115 118 public final StoredEntrySet getShipmentEntrySet() { 119 120 return (StoredEntrySet) shipmentMap.entrySet(); 121 } 122 } 123 | Popular Tags |