ReportMill 10 API

com.reportmill.datasource
Class RMJDBCDatum

java.lang.Object
  extended by com.reportmill.datasource.RMDatum
      extended by com.reportmill.datasource.RMJDBCDatum

public class RMJDBCDatum
extends RMDatum

This class represents a single row in a jdbc database. If any changes are made to the data-bearing object, it keeps a snapshot of the object's original state, so the row can be properly updated in the database. Relationships in the ER diagram are modeled by RMJoin objects. When a relationship is accessed, it gets faulted in via a database fetch.


Constructor Summary
RMJDBCDatum(java.lang.Object anObj, RMDataSource aDataSource, RMEntity anEntity, RMDatum aParent, java.lang.String aKey)
          Creates a new JDBC datum.
 
Method Summary
 java.lang.Object clone()
          Overridden to prevent RMJDBCDatums from being cloned.
 java.lang.Object getOriginalValue(java.lang.String aKey)
          Returns the value for the key before anything changed (taken from the snapshot).
 java.lang.Object getValue(java.lang.String aKey)
          Returns a value for given key.
 void releaseSnapshot()
          Forces a new snapshot to be taken the next time the object changes.
 void setValue(java.lang.String aKey, java.lang.Object aValue)
          Overridden from RMDatum to take a snapshot before something changes.
 void takeSnapshot()
          Takes a snapshot of the data-bearing object.
 java.lang.String toString()
           
 void updateRelationship(RMJoin join, java.lang.Object val)
          This method is called when an RMDatum is installed somewhere into the object graph.
 java.lang.Object validateDatum(java.lang.String key)
          Called before any data access on the object to make sure the row has been faulted in.
 
Methods inherited from class com.reportmill.datasource.RMDatum
getDataSet, getDataSource, getDatum, getEntity, getKey, getObject, getParent, getProperty, getPropertyType, valueForKey
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RMJDBCDatum

public RMJDBCDatum(java.lang.Object anObj,
                   RMDataSource aDataSource,
                   RMEntity anEntity,
                   RMDatum aParent,
                   java.lang.String aKey)
Creates a new JDBC datum.

Method Detail

takeSnapshot

public void takeSnapshot()
Takes a snapshot of the data-bearing object.


releaseSnapshot

public void releaseSnapshot()
Forces a new snapshot to be taken the next time the object changes. Used by saveChanges()


getValue

public java.lang.Object getValue(java.lang.String aKey)
Returns a value for given key.

Overrides:
getValue in class RMDatum

getOriginalValue

public java.lang.Object getOriginalValue(java.lang.String aKey)
Returns the value for the key before anything changed (taken from the snapshot).


setValue

public void setValue(java.lang.String aKey,
                     java.lang.Object aValue)
Overridden from RMDatum to take a snapshot before something changes.

Overrides:
setValue in class RMDatum

validateDatum

public java.lang.Object validateDatum(java.lang.String key)
Called before any data access on the object to make sure the row has been faulted in.


clone

public java.lang.Object clone()
Overridden to prevent RMJDBCDatums from being cloned. This is so that snapshots don't retain references to objects from a relationship. Also, since all data are unique, cloning one is bound to get you in trouble.

Overrides:
clone in class java.lang.Object

updateRelationship

public void updateRelationship(RMJoin join,
                               java.lang.Object val)
This method is called when an RMDatum is installed somewhere into the object graph. It sets the foreign keys of the relationship to establish the correct relationship between parent and child objects. This method is called automatically from setValue()


toString

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

ReportMill 10 API