00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package collections.ship.factory;
00011
00012 import com.sleepycat.collections.StoredSortedMap;
00013 import com.sleepycat.collections.StoredSortedValueSet;
00014 import com.sleepycat.collections.TupleSerialFactory;
00015
00022 public class SampleViews {
00023
00024 private StoredSortedMap partMap;
00025 private StoredSortedMap supplierMap;
00026 private StoredSortedMap shipmentMap;
00027 private StoredSortedMap shipmentByPartMap;
00028 private StoredSortedMap shipmentBySupplierMap;
00029 private StoredSortedMap supplierByCityMap;
00030
00034 public SampleViews(SampleDatabase db) {
00035
00036
00037
00038
00039 TupleSerialFactory factory = db.getFactory();
00040
00041
00042
00043
00044
00045 partMap =
00046 factory.newSortedMap(db.getPartDatabase(),
00047 PartKey.class, Part.class, true);
00048 supplierMap =
00049 factory.newSortedMap(db.getSupplierDatabase(),
00050 SupplierKey.class, Supplier.class, true);
00051 shipmentMap =
00052 factory.newSortedMap(db.getShipmentDatabase(),
00053 ShipmentKey.class, Shipment.class, true);
00054 shipmentByPartMap =
00055 factory.newSortedMap(db.getShipmentByPartDatabase(),
00056 PartKey.class, Shipment.class, true);
00057 shipmentBySupplierMap =
00058 factory.newSortedMap(db.getShipmentBySupplierDatabase(),
00059 SupplierKey.class, Shipment.class, true);
00060 supplierByCityMap =
00061 factory.newSortedMap(db.getSupplierByCityDatabase(),
00062 String.class, Supplier.class, true);
00063 }
00064
00065
00066
00067
00068
00069
00070
00071
00075 public StoredSortedMap getPartMap() {
00076
00077 return partMap;
00078 }
00079
00083 public StoredSortedMap getSupplierMap() {
00084
00085 return supplierMap;
00086 }
00087
00091 public StoredSortedMap getShipmentMap() {
00092
00093 return shipmentMap;
00094 }
00095
00099 public StoredSortedValueSet getPartSet() {
00100
00101 return (StoredSortedValueSet) partMap.values();
00102 }
00103
00107 public StoredSortedValueSet getSupplierSet() {
00108
00109 return (StoredSortedValueSet) supplierMap.values();
00110 }
00111
00115 public StoredSortedValueSet getShipmentSet() {
00116
00117 return (StoredSortedValueSet) shipmentMap.values();
00118 }
00119
00123 public StoredSortedMap getShipmentByPartMap() {
00124
00125 return shipmentByPartMap;
00126 }
00127
00131 public StoredSortedMap getShipmentBySupplierMap() {
00132
00133 return shipmentBySupplierMap;
00134 }
00135
00139 public StoredSortedMap getSupplierByCityMap() {
00140
00141 return supplierByCityMap;
00142 }
00143 }