1 8 9 package collections.ship.factory; 10 11 import com.sleepycat.collections.StoredSortedMap; 12 import com.sleepycat.collections.StoredSortedValueSet; 13 import com.sleepycat.collections.TupleSerialFactory; 14 15 21 public class SampleViews { 22 23 private StoredSortedMap partMap; 24 private StoredSortedMap supplierMap; 25 private StoredSortedMap shipmentMap; 26 private StoredSortedMap shipmentByPartMap; 27 private StoredSortedMap shipmentBySupplierMap; 28 private StoredSortedMap supplierByCityMap; 29 30 33 public SampleViews(SampleDatabase db) { 34 35 TupleSerialFactory factory = db.getFactory(); 39 40 partMap = 45 factory.newSortedMap(db.getPartDatabase(), 46 PartKey.class, Part.class, true); 47 supplierMap = 48 factory.newSortedMap(db.getSupplierDatabase(), 49 SupplierKey.class, Supplier.class, true); 50 shipmentMap = 51 factory.newSortedMap(db.getShipmentDatabase(), 52 ShipmentKey.class, Shipment.class, true); 53 shipmentByPartMap = 54 factory.newSortedMap(db.getShipmentByPartDatabase(), 55 PartKey.class, Shipment.class, true); 56 shipmentBySupplierMap = 57 factory.newSortedMap(db.getShipmentBySupplierDatabase(), 58 SupplierKey.class, Shipment.class, true); 59 supplierByCityMap = 60 factory.newSortedMap(db.getSupplierByCityDatabase(), 61 String .class, Supplier.class, true); 62 } 63 64 71 74 public StoredSortedMap getPartMap() { 75 76 return partMap; 77 } 78 79 82 public StoredSortedMap getSupplierMap() { 83 84 return supplierMap; 85 } 86 87 90 public StoredSortedMap getShipmentMap() { 91 92 return shipmentMap; 93 } 94 95 98 public StoredSortedValueSet getPartSet() { 99 100 return (StoredSortedValueSet) partMap.values(); 101 } 102 103 106 public StoredSortedValueSet getSupplierSet() { 107 108 return (StoredSortedValueSet) supplierMap.values(); 109 } 110 111 114 public StoredSortedValueSet getShipmentSet() { 115 116 return (StoredSortedValueSet) shipmentMap.values(); 117 } 118 119 122 public StoredSortedMap getShipmentByPartMap() { 123 124 return shipmentByPartMap; 125 } 126 127 130 public StoredSortedMap getShipmentBySupplierMap() { 131 132 return shipmentBySupplierMap; 133 } 134 135 138 public StoredSortedMap getSupplierByCityMap() { 139 140 return supplierByCityMap; 141 } 142 } 143 | Popular Tags |