Previous detail | Up | Next detail |
Step 1.1 | Step 1 overview |
The record defined by the CDC doesn't include any key for storing records in a database nor any field indicating which to which patient a record belongs. These would be convenient fields to have in synthesized records. We'll add two new fields, record_id and patient_id, to hold record keys and foreign keys to patient ids.
These fields could be added directly to the definition of a CDC record. But in most cases, there may be a need for still more fields on a record that will be used only in the data generation process. It would be very artificial to force data synthesis fields onto the definition of an immunization record. A better approach is to define interfaces that generated and modifiable beans in general, and to keep all synthesis related operations isolated to these interfaces.
The GeneratedBean interface defines clone() and cloneBean() methods, as well as methods to set, get and remove property values.
package net.sf.adatagenerator.api; public interface GeneratedBean extends Cloneable { /** Overrides the default Object.clone() method */ Object clone() throws CloneNotSupportedException; /** A typesafe clone method */ GeneratedBean cloneGeneratedBean() throws CreationException; /** Returns a copy of this bean's properties */ Properties getProperties(); /** Sets a property value for this bean */ void setProperty(String pn, String pv); /** Removes a property from this bean */ void removeProperty(String pn); /** Returns the value of the specified property */ String getProperty(String pn); }
The GeneratedCdc1Record interface extends the core CDC interface and the GeneratedBean interface and defines the additional fields that we need for record_id and patient_id. In addition, we'll need to define a public class, GeneratedCdc1RecordBean, that implements GeneratedCdc1Record; see the adg-cdc1-example for details.
package net.sf.adatagenerator.ex.cdc1.api; import net.sf.adatagenerator.api.GeneratedBean; public interface GeneratedCdc1Record extends Cdc1Record, GeneratedBean { String getPatientId(); void setPatientId(String patientId); String getRecordId(); void setRecordId(String recordId); }
Previous detail | Up | Next detail |
Step 1.1 | Step 1 overview |