1 8 9 package collections.ship.index; 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.StoredSortedMap; 16 17 23 public class SampleViews { 24 25 private StoredSortedMap partMap; 26 private StoredSortedMap supplierMap; 27 private StoredSortedMap shipmentMap; 28 private StoredSortedMap shipmentByPartMap; 29 private StoredSortedMap shipmentBySupplierMap; 30 private StoredSortedMap supplierByCityMap; 31 32 35 public SampleViews(SampleDatabase db) { 36 37 ClassCatalog catalog = db.getClassCatalog(); 43 EntryBinding partKeyBinding = 44 new SerialBinding(catalog, PartKey.class); 45 EntryBinding partDataBinding = 46 new SerialBinding(catalog, PartData.class); 47 EntryBinding supplierKeyBinding = 48 new SerialBinding(catalog, SupplierKey.class); 49 EntryBinding supplierDataBinding = 50 new SerialBinding(catalog, SupplierData.class); 51 EntryBinding shipmentKeyBinding = 52 new SerialBinding(catalog, ShipmentKey.class); 53 EntryBinding shipmentDataBinding = 54 new SerialBinding(catalog, ShipmentData.class); 55 EntryBinding cityKeyBinding = 56 new SerialBinding(catalog, String .class); 57 58 partMap = 64 new StoredSortedMap(db.getPartDatabase(), 65 partKeyBinding, partDataBinding, true); 66 supplierMap = 67 new StoredSortedMap(db.getSupplierDatabase(), 68 supplierKeyBinding, supplierDataBinding, true); 69 shipmentMap = 70 new StoredSortedMap(db.getShipmentDatabase(), 71 shipmentKeyBinding, shipmentDataBinding, true); 72 shipmentByPartMap = 73 new StoredSortedMap(db.getShipmentByPartDatabase(), 74 partKeyBinding, shipmentDataBinding, true); 75 shipmentBySupplierMap = 76 new StoredSortedMap(db.getShipmentBySupplierDatabase(), 77 supplierKeyBinding, shipmentDataBinding, true); 78 supplierByCityMap = 79 new StoredSortedMap(db.getSupplierByCityDatabase(), 80 cityKeyBinding, supplierDataBinding, true); 81 } 82 83 90 93 public final StoredSortedMap getPartMap() { 94 95 return partMap; 96 } 97 98 101 public final StoredSortedMap getSupplierMap() { 102 103 return supplierMap; 104 } 105 106 109 public final StoredSortedMap getShipmentMap() { 110 111 return shipmentMap; 112 } 113 114 117 public final StoredEntrySet getPartEntrySet() { 118 119 return (StoredEntrySet) partMap.entrySet(); 120 } 121 122 125 public final StoredEntrySet getSupplierEntrySet() { 126 127 return (StoredEntrySet) supplierMap.entrySet(); 128 } 129 130 133 public final StoredEntrySet getShipmentEntrySet() { 134 135 return (StoredEntrySet) shipmentMap.entrySet(); 136 } 137 138 141 public StoredSortedMap getShipmentByPartMap() { 142 143 return shipmentByPartMap; 144 } 145 146 149 public StoredSortedMap getShipmentBySupplierMap() { 150 151 return shipmentBySupplierMap; 152 } 153 154 157 public final StoredSortedMap getSupplierByCityMap() { 158 159 return supplierByCityMap; 160 } 161 } 162 | Popular Tags |