org.agileclick.genorm.runtime
Class GenOrmRecord

java.lang.Object
  extended by org.agileclick.genorm.runtime.GenOrmRecord
All Implemented Interfaces:
java.io.Serializable

public abstract class GenOrmRecord
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Constructor Summary
GenOrmRecord(java.lang.String tableName)
           
 
Method Summary
 void delete()
          Deletes this record
 boolean equals(java.lang.Object obj)
          Equality is based on the table name and values of the primary keys only
 boolean flush()
          Flush any changes made to this record.
 boolean flushIfNonTransaction()
          If there is a connection on the thread this will do nothing.
 java.util.List<GenOrmField> getDirtyFields()
          Returns all fields that have been modified
 GenOrmField getField(java.lang.String columnName)
          Returns the field specified field
abstract  java.lang.String getFieldEscapeString()
          Returns the plugin used to create the SQL for this set of generated objects.
 java.util.Iterator<GenOrmField> getFieldIterator()
          Returns an iterator of the GenOrmFields that are associated with this record.
 java.util.List<GenOrmField> getFields()
          Returns a read only list of the fields that are associated with this record.
abstract  java.util.List<GenOrmRecordKey> getForeignKeys()
          Returns a list of foreign keys for this record
abstract  GenOrmConnection getGenOrmConnection()
          This returns the GenOrmConnection object that is specific to the generated code.
 org.slf4j.Logger getLogger()
           
 GenOrmRecordKey getRecordKey()
           
 java.lang.String getTableName()
          Returns the name of the table this record is from
 int hashCode()
          Returns the combined hash code of all primary keys of this record
 boolean isDeleted()
          Returns if the record has been deleted by a previous call to delete()
 boolean isDirty()
          Returns if this record has been modified
 boolean isIgnored()
          Identifies if this record is ignored or not.
 boolean isNew()
          Identifies this record as a new record that needs to be added to the database
abstract  void setCTS()
          This method is called when a new record is created.
 void setDirty()
          Forces this record to be dirty which will cause all values to be commited to the database upon commit of the transaction
 void setFieldDirty(GenOrmField field)
          Marks the specified field as dirty for this record so it will be updated with the next flush.
 void setIgnored(boolean ignore)
          Sets this record to be ignored.
abstract  void setMTS()
          This method is called whenever a modification is made to this record.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenOrmRecord

public GenOrmRecord(java.lang.String tableName)
Method Detail

getRecordKey

public GenOrmRecordKey getRecordKey()

getLogger

public org.slf4j.Logger getLogger()

getTableName

public java.lang.String getTableName()
Returns the name of the table this record is from


getFieldIterator

public java.util.Iterator<GenOrmField> getFieldIterator()
Returns an iterator of the GenOrmFields that are associated with this record.


getFields

public java.util.List<GenOrmField> getFields()
Returns a read only list of the fields that are associated with this record.


getField

public GenOrmField getField(java.lang.String columnName)
Returns the field specified field


getDirtyFields

public java.util.List<GenOrmField> getDirtyFields()
Returns all fields that have been modified


isNew

public boolean isNew()
Identifies this record as a new record that needs to be added to the database


setMTS

public abstract void setMTS()
This method is called whenever a modification is made to this record. The purpose is for setting a modification timestamp.


setCTS

public abstract void setCTS()
This method is called when a new record is created. The purpose is to set a creation timestamp for this record.


getGenOrmConnection

public abstract GenOrmConnection getGenOrmConnection()
This returns the GenOrmConnection object that is specific to the generated code.


getFieldEscapeString

public abstract java.lang.String getFieldEscapeString()
Returns the plugin used to create the SQL for this set of generated objects.


delete

public void delete()
Deletes this record


isDeleted

public boolean isDeleted()
Returns if the record has been deleted by a previous call to delete()


isDirty

public boolean isDirty()
Returns if this record has been modified


setFieldDirty

public void setFieldDirty(GenOrmField field)
Marks the specified field as dirty for this record so it will be updated with the next flush.

Parameters:
field -

setDirty

public void setDirty()
Forces this record to be dirty which will cause all values to be commited to the database upon commit of the transaction


setIgnored

public void setIgnored(boolean ignore)
Sets this record to be ignored. Ignored records are not commited to the database.


isIgnored

public boolean isIgnored()
Identifies if this record is ignored or not.


getForeignKeys

public abstract java.util.List<GenOrmRecordKey> getForeignKeys()
Returns a list of foreign keys for this record


flushIfNonTransaction

public boolean flushIfNonTransaction()
If there is a connection on the thread this will do nothing. The idea is that if there is a connection this record will be flushed when the transaction is committed. If no connection exits then this record will be flushed

Returns:
Returns the same as flush

flush

public boolean flush()
Flush any changes made to this record. The record will be inserted if it is new.

Returns:
In all cases except a delete this will return true. In the case where the record is deleted it will return true if the record was in the db and false if it wasn't.

hashCode

public int hashCode()
Returns the combined hash code of all primary keys of this record

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Equality is based on the table name and values of the primary keys only

Overrides:
equals in class java.lang.Object