package rmrs.persist.test; import rmrs.persist.PersistentObject; import rmrs.persist.PersistenceBroker; import rmrs.persist.OID; import java.util.Date; public class Observation extends PersistentObject { String name; Interval value; String unit; Date time; // the idea was that this link be unidirectional from Patient // to Observation (admittedly artificial for the test.) Without // a field for the patient in the class, however, it's hard // to save the reference in the data base. Besides, this is the // more natural case to handle, so we require a TO-MANY link // to be navigable both ways. Patient patient; public Patient getPatient() { return patient; } public Observation() { } public Observation(String name, Interval value, String unit, Date time) { this.name = name; this.value = value; this.unit = unit; this.time = time; } public String toString() { StringBuffer buf = new StringBuffer("Observation[oid="); buf.append(getOID()); buf.append(",patient="); if(patient != null) buf.append(patient.getOID()); else buf.append("NULL"); buf.append(",value="); buf.append(name); buf.append(",value="); buf.append(value); buf.append(",unit="); buf.append(unit); buf.append(",time="); buf.append(time); buf.append("]"); return buf.toString(); } }