00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package collections.ship.basic;
00011
00012 import com.sleepycat.bind.EntryBinding;
00013 import com.sleepycat.bind.serial.ClassCatalog;
00014 import com.sleepycat.bind.serial.SerialBinding;
00015 import com.sleepycat.collections.StoredEntrySet;
00016 import com.sleepycat.collections.StoredMap;
00017
00024 public class SampleViews {
00025
00026 private StoredMap partMap;
00027 private StoredMap supplierMap;
00028 private StoredMap shipmentMap;
00029
00033 public SampleViews(SampleDatabase db) {
00034
00035
00036
00037
00038
00039 ClassCatalog catalog = db.getClassCatalog();
00040 EntryBinding partKeyBinding =
00041 new SerialBinding(catalog, PartKey.class);
00042 EntryBinding partDataBinding =
00043 new SerialBinding(catalog, PartData.class);
00044 EntryBinding supplierKeyBinding =
00045 new SerialBinding(catalog, SupplierKey.class);
00046 EntryBinding supplierDataBinding =
00047 new SerialBinding(catalog, SupplierData.class);
00048 EntryBinding shipmentKeyBinding =
00049 new SerialBinding(catalog, ShipmentKey.class);
00050 EntryBinding shipmentDataBinding =
00051 new SerialBinding(catalog, ShipmentData.class);
00052
00053
00054
00055
00056
00057
00058 partMap =
00059 new StoredMap(db.getPartDatabase(),
00060 partKeyBinding, partDataBinding, true);
00061 supplierMap =
00062 new StoredMap(db.getSupplierDatabase(),
00063 supplierKeyBinding, supplierDataBinding, true);
00064 shipmentMap =
00065 new StoredMap(db.getShipmentDatabase(),
00066 shipmentKeyBinding, shipmentDataBinding, true);
00067 }
00068
00069
00070
00071
00072
00073
00074
00075
00079 public final StoredMap getPartMap() {
00080
00081 return partMap;
00082 }
00083
00087 public final StoredMap getSupplierMap() {
00088
00089 return supplierMap;
00090 }
00091
00095 public final StoredMap getShipmentMap() {
00096
00097 return shipmentMap;
00098 }
00099
00103 public final StoredEntrySet getPartEntrySet() {
00104
00105 return (StoredEntrySet) partMap.entrySet();
00106 }
00107
00111 public final StoredEntrySet getSupplierEntrySet() {
00112
00113 return (StoredEntrySet) supplierMap.entrySet();
00114 }
00115
00119 public final StoredEntrySet getShipmentEntrySet() {
00120
00121 return (StoredEntrySet) shipmentMap.entrySet();
00122 }
00123 }