introduced boolean "virtual" field, though it's not used yet.

This commit is contained in:
hns 2001-08-01 00:10:52 +00:00
parent 94e086dfd8
commit d477e80128

View file

@ -10,7 +10,7 @@ import java.io.Serializable;
/** /**
* This is the internal representation of a database key. It is constructed * This is the internal representation of a database key. It is constructed
* out of the database URL, the table name, the user name and the database * out of the database URL, the table name, the user name and the database
* key of the node and unique within each HOP application. Currently only * key of the node and unique within each Helma application. Currently only
* single keys are supported. * single keys are supported.
*/ */
public class Key implements Serializable { public class Key implements Serializable {
@ -18,24 +18,27 @@ public class Key implements Serializable {
private String type; private String type;
private String id; private String id;
private int hash; private int hash;
private boolean virtual;
public Key (DbMapping dbmap, String id) { public Key (DbMapping dbmap, String id) {
this.type = dbmap == null ? null : dbmap.getStorageTypeName (); this.type = dbmap == null ? null : dbmap.getStorageTypeName ();
this.id = id; this.id = id;
hash = id.hashCode (); hash = id.hashCode ();
virtual = false;
} }
public Key (String type, String id) { public Key (String type, String id) {
this.type = type; this.type = type;
this.id = id; this.id = id;
hash = id.hashCode (); hash = id.hashCode ();
virtual = false;
} }
public boolean equals (Object what) { public boolean equals (Object what) {
try { try {
Key k = (Key) what; Key k = (Key) what;
return ((type == k.type || type.equals (k.type)) && (id == k.id || id.equals (k.id))); return (type == k.type || type.equals (k.type)) && (id == k.id || id.equals (k.id));
} catch (Exception x) { } catch (Exception x) {
return false; return false;
} }
@ -52,7 +55,9 @@ public class Key implements Serializable {
* a key that can't be mistaken for a relational db key. * a key that can't be mistaken for a relational db key.
*/ */
public Key getVirtualKey (String sid) { public Key getVirtualKey (String sid) {
return new Key ((String) null, makeVirtualID (type, id, sid)); Key k = new Key ((String) null, makeVirtualID (type, id, sid));
k.virtual = true;
return k;
} }
public String getVirtualID (String sid) { public String getVirtualID (String sid) {