|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.workingdogs.village.Record
A Record represents a row in the database. It contains a collection of Values which are the individual contents of each column in the row.
Field Summary | |
private boolean[] |
isClean
a 1 To 1 relationship between Values and whether they are clean or not |
private int |
numberOfColumns
number of columns in this Record |
private DataSet |
parentDataSet
the parent DataSet for this Record |
private int |
saveType
this is the state of this record |
private Schema |
schema
a saved copy of the schema for this Record |
private boolean |
status
the status of a record |
private Value[] |
values
an array of Value objects, this is 1 based |
Constructor Summary | |
|
Record()
This isn't used and doesn't do anything. |
|
Record(DataSet ds)
Creates a new Record and sets the parent dataset to the passed in value. |
(package private) |
Record(DataSet ds,
boolean addRecord)
This is a special case method for Record. |
Method Summary | |
java.lang.String |
asFormattedString(java.lang.String valueseparator,
int[] maxwidths)
return the value of each column as a string. |
private void |
createValues(java.sql.ResultSet rs)
Creates the value objects for this Record. |
DataSet |
dataset()
Gets the DataSet for this Record |
private java.lang.String |
getDeleteSaveString()
Builds the SQL DELETE statement for this Record |
private java.lang.String |
getInsertSaveString()
Builds the SQL INSERT statement for this Record |
java.lang.String |
getRefreshQueryString()
This builds the SELECT statement in order to refresh the contents of this Record. |
java.lang.String |
getSaveString()
Gets the appropriate SQL string for this record. |
(package private) int |
getSaveType()
gets the internal save type as one of the defined privates (ie: ZOMBIE) |
private java.lang.String |
getUpdateSaveString()
Builds the SQL UPDATE statement for this Record |
Value |
getValue(int i)
gets the value at index i |
Value |
getValue(java.lang.String columnName)
|
private void |
initializeRecord()
Performs initialization for this Record. |
boolean |
isAZombie()
Determines if this record is a Zombie. |
void |
markForInsert()
Marks this record to be inserted when a save is executed. |
void |
markForUpdate()
Marks this record to be updated when a save is executed. |
void |
markRecordClean()
Marks all the values in this record as clean. |
Record |
markToBeDeleted()
Marks this record to be deleted when a save is executed. |
void |
markValueClean(int pos)
marks a value at a given position as clean. |
void |
markValueClean(java.lang.String columnName)
marks a value with a given column name as clean. |
void |
markValueDirty(int pos)
marks a value at a given position as dirty. |
void |
markValueDirty(java.lang.String columnName)
marks a value with a given column name as dirty. |
boolean |
needsToBeSaved()
If the record is not clean, needs to be saved with an Update, Delete or Insert, it returns true. |
boolean |
recordIsClean()
Goes through all the values in the record to determine if it is clean or not. |
void |
refresh(java.sql.Connection connection)
This method refreshes this Record's Value's. |
int |
save()
Saves the data in this Record to the database. |
int |
save(java.sql.Connection connection)
Saves the data in this Record to the database. |
private int |
saveWithDelete(java.sql.Connection connection)
Saves the data in this Record to the database with an DELETE statement |
private int |
saveWithInsert(java.sql.Connection connection)
Saves the data in this Record to the database with an INSERT statement |
void |
saveWithoutStatusUpdate()
|
private int |
saveWithUpdate(java.sql.Connection connection)
Saves the data in this Record to the database with an UPDATE statement |
Schema |
schema()
Gets the schema for the parent DataSet |
(package private) void |
setParentDataSet(DataSet ds)
Sets the parent DataSet for this record. |
(package private) void |
setSaveType(int type)
sets the internal save type as one of the defined privates (ie: ZOMBIE) |
Record |
setValue(int pos,
java.math.BigDecimal value)
sets the value at pos with a BigDecimal |
Record |
setValue(int pos,
boolean value)
sets the value at pos with a boolean |
Record |
setValue(int pos,
byte[] value)
sets the value at pos with a byte[] |
Record |
setValue(int pos,
java.util.Date value)
sets the value at pos with a java.util.Date |
Record |
setValue(int pos,
java.sql.Date value)
sets the value at pos with a java.sql.Date |
Record |
setValue(int pos,
double value)
sets the value at pos with a double |
Record |
setValue(int pos,
float value)
sets the value at pos with a float |
Record |
setValue(int pos,
int value)
sets the value at pos with a int |
Record |
setValue(int pos,
long value)
sets the value at pos with a long |
Record |
setValue(int pos,
java.lang.String value)
sets the value at pos with a String |
Record |
setValue(int pos,
java.sql.Time value)
sets the value at pos with a java.sql.Time |
Record |
setValue(int pos,
java.sql.Timestamp value)
sets the value at pos with a java.sql.Timestamp |
Record |
setValue(int pos,
Value value)
sets the value at pos with a Value |
Record |
setValue(java.lang.String columnName,
java.math.BigDecimal value)
sets the value at column name with a BigDecimal |
Record |
setValue(java.lang.String columnName,
boolean value)
sets the value at column name with a boolean |
Record |
setValue(java.lang.String columnName,
byte[] value)
sets the value at column name with a byte[] |
Record |
setValue(java.lang.String columnName,
java.util.Date value)
sets the value at column name with a java.util.Date |
Record |
setValue(java.lang.String columnName,
java.sql.Date value)
sets the value at column name with a java.sql.Date |
Record |
setValue(java.lang.String columnName,
double value)
sets the value at column name with a double |
Record |
setValue(java.lang.String columnName,
float value)
sets the value at column name with a float |
Record |
setValue(java.lang.String columnName,
int value)
sets the value at column name with a int |
Record |
setValue(java.lang.String columnName,
long value)
sets the value at column name with a long |
Record |
setValue(java.lang.String columnName,
java.lang.String value)
sets the value at column name with a String |
Record |
setValue(java.lang.String columnName,
java.sql.Time value)
sets the value at column name with a java.sql.Time |
Record |
setValue(java.lang.String columnName,
java.sql.Timestamp value)
sets the value at column name with a java.sql.Timestamp |
Record |
setValue(java.lang.String columnName,
Value value)
sets the value at column name with a Value |
Record |
setValueNull(int pos)
sets the value at pos with a NULL |
Record |
setValueNull(java.lang.String columnName)
sets the value at column name with a NULL |
int |
size()
the number of columns in this object |
boolean |
toBeSavedWithDelete()
whether or not this Record is to be saved with an SQL delete statement |
boolean |
toBeSavedWithInsert()
whether or not this Record is to be saved with an SQL insert statement |
boolean |
toBeSavedWithUpdate()
whether or not this Record is to be saved with an SQL update statement |
java.lang.String |
toString()
This returns a representation of this Record |
Record |
unmarkToBeDeleted()
Unmarks a record that has been marked for deletion. |
void |
updateStatus()
Updates the status of a Record after a saveWithoutStatusUpdate() |
boolean |
valueIsClean(int i)
Determines whether or not a value stored in the record is clean. |
(package private) boolean |
valueIsClean(java.lang.String column)
Determines whether or not a value stored in the record is clean. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private Value[] values
private boolean[] isClean
private DataSet parentDataSet
private int numberOfColumns
private int saveType
private Schema schema
private boolean status
Constructor Detail |
public Record()
public Record(DataSet ds) throws DataSetException, java.sql.SQLException
Record(DataSet ds, boolean addRecord) throws DataSetException, java.sql.SQLException
This method is a package method only because it is really not useful outside of the package.
ds
- the datasetaddRecord
- whether or not this method is being called from DataSet.addRecord()Method Detail |
private void initializeRecord() throws DataSetException
private void createValues(java.sql.ResultSet rs) throws DataSetException, java.sql.SQLException
DataSetException
- java.sql.SQLException
- public int save() throws DataSetException, java.sql.SQLException
public int save(java.sql.Connection connection) throws DataSetException, java.sql.SQLException
private int saveWithDelete(java.sql.Connection connection) throws DataSetException, java.sql.SQLException
private int saveWithUpdate(java.sql.Connection connection) throws DataSetException, java.sql.SQLException
private int saveWithInsert(java.sql.Connection connection) throws DataSetException, java.sql.SQLException
private java.lang.String getUpdateSaveString() throws DataSetException
private java.lang.String getDeleteSaveString() throws DataSetException
private java.lang.String getInsertSaveString() throws DataSetException
public java.lang.String getSaveString() throws DataSetException
public Value getValue(int i) throws DataSetException
public Value getValue(java.lang.String columnName) throws DataSetException
public int size()
public boolean toBeSavedWithInsert()
public boolean toBeSavedWithUpdate()
public boolean toBeSavedWithDelete()
public void markRecordClean() throws DataSetException
public void markForInsert() throws DataSetException
public void markForUpdate() throws DataSetException
public Record markToBeDeleted() throws DataSetException
public Record unmarkToBeDeleted() throws DataSetException
WARNING: You must reset the save type before trying to save this record again.
markForUpdate()
,
markForInsert()
,
markToBeDeleted()
public void markValueClean(int pos) throws DataSetException
public void markValueClean(java.lang.String columnName) throws DataSetException
public void markValueDirty(int pos) throws DataSetException
public void markValueDirty(java.lang.String columnName) throws DataSetException
void setSaveType(int type)
int getSaveType()
public Record setValue(int pos, java.math.BigDecimal value) throws DataSetException
public Record setValue(int pos, boolean value) throws DataSetException
public Record setValue(int pos, byte[] value) throws DataSetException
public Record setValue(int pos, java.util.Date value) throws DataSetException
public Record setValue(int pos, java.sql.Date value) throws DataSetException
public Record setValue(int pos, double value) throws DataSetException
public Record setValue(int pos, float value) throws DataSetException
public Record setValue(int pos, int value) throws DataSetException
public Record setValue(int pos, long value) throws DataSetException
public Record setValue(int pos, java.lang.String value) throws DataSetException
public Record setValue(int pos, java.sql.Time value) throws DataSetException
public Record setValue(int pos, java.sql.Timestamp value) throws DataSetException
public Record setValue(int pos, Value value) throws DataSetException
public Record setValue(java.lang.String columnName, java.math.BigDecimal value) throws DataSetException
public Record setValue(java.lang.String columnName, boolean value) throws DataSetException
public Record setValue(java.lang.String columnName, byte[] value) throws DataSetException
public Record setValue(java.lang.String columnName, java.util.Date value) throws DataSetException
public Record setValue(java.lang.String columnName, java.sql.Date value) throws DataSetException
public Record setValue(java.lang.String columnName, double value) throws DataSetException
public Record setValue(java.lang.String columnName, float value) throws DataSetException
public Record setValue(java.lang.String columnName, int value) throws DataSetException
public Record setValue(java.lang.String columnName, long value) throws DataSetException
public Record setValue(java.lang.String columnName, java.lang.String value) throws DataSetException
public Record setValue(java.lang.String columnName, java.sql.Time value) throws DataSetException
public Record setValue(java.lang.String columnName, java.sql.Timestamp value) throws DataSetException
public Record setValue(java.lang.String columnName, Value value) throws DataSetException
public Record setValueNull(int pos) throws DataSetException
public Record setValueNull(java.lang.String columnName) throws DataSetException
public boolean isAZombie()
public boolean needsToBeSaved()
public boolean valueIsClean(int i)
boolean valueIsClean(java.lang.String column) throws DataSetException
public boolean recordIsClean()
public void refresh(java.sql.Connection connection) throws DataSetException, java.sql.SQLException
connection
- DataSetException
- java.sql.SQLException
- public java.lang.String getRefreshQueryString() throws DataSetException
DataSetException
- public void saveWithoutStatusUpdate() throws DataSetException
public Schema schema() throws DataSetException
public DataSet dataset()
void setParentDataSet(DataSet ds)
public java.lang.String asFormattedString(java.lang.String valueseparator, int[] maxwidths) throws DataSetException
valueseparator
- maxwidths
- DataSetException
- public java.lang.String toString()
toString
in class java.lang.Object
public void updateStatus() throws java.sql.SQLException, DataSetException
java.sql.SQLException
- DataSetException
-
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |