org.rimudb
Class Record

java.lang.Object
  extended by org.rimudb.Record
All Implemented Interfaces:
java.io.Serializable

public class Record
extends java.lang.Object
implements java.io.Serializable

This bean class contains the data from a single record in a database table.

Author:
Simon Ritchie
See Also:
Serialized Form

Constructor Summary
Record()
           
Record(java.lang.Class<? extends DataObject> dataObjectClass)
          Create a Record
 
Method Summary
 void checkChangeOk()
          Check that the record can be changed.
 Record copy()
          Create a copy of this record with all the same property values.
 boolean equals(java.lang.Object obj)
          Returns true if the object parameters match this object's parameters.
 boolean exists()
          Return true if the record exists.
 java.lang.String[] getChangedProperties(Record record)
          Default implementation for getChangedProperties().
 java.lang.String getChangedPropertiesText(Record originalRecord)
          Return a list of the changed properties in comma delimited format.
 java.util.List<java.lang.String> getModifiedProperties()
          Return a List of modified property names.
 java.util.List<java.lang.String> getModifiedToNullProperties()
          Return a List of properties that are null.
 java.util.List<java.lang.String> getNulledProperties()
          Return a List of properties that are null.
 WhereList getPrimaryWhereList()
           
 java.lang.Object getValue(java.lang.String propertyName)
          Return the value for a property.
 int hashCode()
           
 void initValue(java.lang.String propertyName, java.lang.Object value, int keySequence)
          Initialize the record.
 boolean isModified(java.lang.String propertyName)
          Return true if the propertyName has been modified.
 boolean isMutable()
          Return true if the record can be changed.
 void setExists(boolean exists)
          Set if the record exists in the database table
 void setMutable(boolean newMutable)
          Set to true if the record is mutable.
 void setValue(java.lang.String propertyName, java.lang.Object value)
          Set the value for a property.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Record

public Record()

Record

public Record(java.lang.Class<? extends DataObject> dataObjectClass)
Create a Record

Method Detail

checkChangeOk

public void checkChangeOk()
                   throws java.lang.IllegalAccessError
Check that the record can be changed. This method will throw an IllegalAccessError if the record cannot be modified.

Throws:
java.lang.IllegalAccessError

getPrimaryWhereList

public WhereList getPrimaryWhereList()

isMutable

public boolean isMutable()
Return true if the record can be changed.

Returns:
boolean

exists

public boolean exists()
Return true if the record exists.

Returns:
boolean

setMutable

public void setMutable(boolean newMutable)
Set to true if the record is mutable.

Parameters:
newMutable - boolean

setExists

public void setExists(boolean exists)
Set if the record exists in the database table

Parameters:
exists - boolean

getChangedProperties

public java.lang.String[] getChangedProperties(Record record)
Default implementation for getChangedProperties(). This method returns an array of properties that have been changed between this instance and the incoming parameter.

Returns:
String[]

getChangedPropertiesText

public java.lang.String getChangedPropertiesText(Record originalRecord)
                                          throws RimuDBException
Return a list of the changed properties in comma delimited format. The string shows the current record values (from 'this' instance)and the original record values (from the 'originalRecord' instance');

Parameters:
originalRecord - Record
Returns:
String
Throws:
RimuDBException

copy

public Record copy()
Create a copy of this record with all the same property values.

Returns:
Record

getValue

public java.lang.Object getValue(java.lang.String propertyName)
Return the value for a property.

Parameters:
propertyName - String
Returns:
Object

isModified

public boolean isModified(java.lang.String propertyName)
Return true if the propertyName has been modified.

Returns:
boolean

setValue

public void setValue(java.lang.String propertyName,
                     java.lang.Object value)
              throws RimuDBException
Set the value for a property. This sets the modified flag for the column. If the property is not valid for this record, then a RimuDBException is thrown.

Parameters:
propertyName - String
value - Object
Throws:
RimuDBException

initValue

public void initValue(java.lang.String propertyName,
                      java.lang.Object value,
                      int keySequence)
Initialize the record.

Parameters:
propertyName - String
value - Object
keySequence - int

getModifiedProperties

public java.util.List<java.lang.String> getModifiedProperties()
Return a List of modified property names.

Returns:
List

equals

public boolean equals(java.lang.Object obj)
Returns true if the object parameters match this object's parameters.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Object
Returns:
boolean

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getNulledProperties

public java.util.List<java.lang.String> getNulledProperties()
Return a List of properties that are null.

Returns:
List

getModifiedToNullProperties

public java.util.List<java.lang.String> getModifiedToNullProperties()
Return a List of properties that are null.

Returns:
List


Copyright © 2008-2011 Simon Ritchie. All Rights Reserved.