org.persvr.datasource
Interface WritableDataSource

All Superinterfaces:
DataSource
All Known Implementing Classes:
DatabaseTableDataSource, DynaArrayDBSource, DynaFileDBSource, DynaFunctionDBSource, DynaObjectDBSource, DynaObjectDBSource, HttpJsonSource, LocalJsonFileSource, RootDataSource, WritableXmlSource, XmlFileSource

public interface WritableDataSource
extends DataSource

This interface should be implemented by data sources that have modifiable data

Author:
Kris Zyp

Method Summary
 void abortTransaction()
           
 void commitTransaction()
           
 void recordDelete(java.lang.String objectId)
          This is called when an object should be deleted
 NewObjectPersister recordNewObject(Persistable object)
          This is called when a new object is persisted
 void recordPropertyAddition(java.lang.String objectId, java.lang.String name, java.lang.Object value, int attributes)
          This is called when a new property is added to an object
 void recordPropertyChange(java.lang.String objectId, java.lang.String name, java.lang.Object value, int attributes)
          This is called when a property value is changed
 void recordPropertyRemoval(java.lang.String objectId, java.lang.String name)
          This is called when a property value is removed
 void startTransaction()
           
 
Methods inherited from interface org.persvr.datasource.DataSource
getFieldValue, getId, hiddenId, initParameters, mapObject, mapQuery, setId
 

Method Detail

recordPropertyAddition

void recordPropertyAddition(java.lang.String objectId,
                            java.lang.String name,
                            java.lang.Object value,
                            int attributes)
                            throws java.lang.Exception
This is called when a new property is added to an object

Parameters:
objectId -
name -
value - - The value should generally be an object one of the following classes: String, Boolean, Integer, Double, Date, ObjectId, or a null If the value is an ObjectId than it indicates that it is a reference to another object. The data source can check isPersisted to see if the object has been persisted yet. If it is true than it means it means it has already been persisted. If it is false, the object has not been persisted yet. If the data source can handle a new object at this point, it should call ObjectId.persist to persist the object
attributes - TODO
Throws:
java.lang.Exception

recordPropertyChange

void recordPropertyChange(java.lang.String objectId,
                          java.lang.String name,
                          java.lang.Object value,
                          int attributes)
                          throws java.lang.Exception
This is called when a property value is changed

Parameters:
objectId -
name -
value -
attributes - TODO
Throws:
java.lang.Exception

recordPropertyRemoval

void recordPropertyRemoval(java.lang.String objectId,
                           java.lang.String name)
                           throws java.lang.Exception
This is called when a property value is removed

Parameters:
objectId -
name -
Throws:
java.lang.Exception

recordDelete

void recordDelete(java.lang.String objectId)
                  throws java.lang.Exception
This is called when an object should be deleted

Parameters:
objectId -
name -
Throws:
java.lang.Exception

recordNewObject

NewObjectPersister recordNewObject(Persistable object)
                                   throws java.lang.Exception
This is called when a new object is persisted

Returns:
persister
Throws:
java.lang.Exception

startTransaction

void startTransaction()
                      throws java.lang.Exception
Throws:
java.lang.Exception

commitTransaction

void commitTransaction()
                       throws java.lang.Exception
Throws:
java.lang.Exception

abortTransaction

void abortTransaction()
                      throws java.lang.Exception
Throws:
java.lang.Exception