00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package collections.ship.factory;
00011
00012 import java.io.Serializable;
00013
00014 import com.sleepycat.bind.tuple.MarshalledTupleKeyEntity;
00015 import com.sleepycat.bind.tuple.TupleInput;
00016 import com.sleepycat.bind.tuple.TupleOutput;
00017
00034 public class Supplier implements Serializable, MarshalledTupleKeyEntity {
00035
00036 static final String CITY_KEY = "city";
00037
00038 private transient String number;
00039 private String name;
00040 private int status;
00041 private String city;
00042
00043 public Supplier(String number, String name, int status, String city) {
00044
00045 this.number = number;
00046 this.name = name;
00047 this.status = status;
00048 this.city = city;
00049 }
00050
00051 public final String getNumber() {
00052
00053 return number;
00054 }
00055
00056 public final String getName() {
00057
00058 return name;
00059 }
00060
00061 public final int getStatus() {
00062
00063 return status;
00064 }
00065
00066 public final String getCity() {
00067
00068 return city;
00069 }
00070
00071 public String toString() {
00072
00073 return "[Supplier: number=" + number +
00074 " name=" + name +
00075 " status=" + status +
00076 " city=" + city + ']';
00077 }
00078
00079
00080
00081 public void marshalPrimaryKey(TupleOutput keyOutput) {
00082
00083 keyOutput.writeString(this.number);
00084 }
00085
00086 public void unmarshalPrimaryKey(TupleInput keyInput) {
00087
00088 this.number = keyInput.readString();
00089 }
00090
00091 public boolean marshalSecondaryKey(String keyName, TupleOutput keyOutput) {
00092
00093 if (keyName.equals(CITY_KEY)) {
00094 if (this.city != null) {
00095 keyOutput.writeString(this.city);
00096 return true;
00097 } else {
00098 return false;
00099 }
00100 } else {
00101 throw new UnsupportedOperationException(keyName);
00102 }
00103 }
00104
00105 public boolean nullifyForeignKey(String keyName) {
00106
00107 throw new UnsupportedOperationException(keyName);
00108 }
00109 }