org.makumba.providers
Class CRUDOperationProvider

java.lang.Object
  extended by org.makumba.providers.CRUDOperationProvider
Direct Known Subclasses:
HibernateCRUDOperationProvider, MakumbaCRUDOperationProvider

public abstract class CRUDOperationProvider
extends Object

This interface describes the operations that a simple CRUD provider has to implement.

Version:
$Id: CRUDOperationProvider.java,v 1.1 01.11.2007 15:30:29 Manuel Exp $
Author:
Manuel Gay

Field Summary
protected  DataDefinitionProvider ddp
           
 
Constructor Summary
CRUDOperationProvider()
           
 
Method Summary
abstract  void checkInsert(Transaction t, String type, Dictionary<String,Object> fieldsToCheck, Dictionary<String,DataHolder> fieldsToIgnore, Dictionary<String,Object> allFields)
          Checks if a set of values can be updated in the database
protected  DataDefinition checkUpdate(String type, Dictionary<String,Object> fieldsToCheck, Dictionary<String,DataHolder> fieldsToIgnore)
           
abstract  void checkUpdate(Transaction t, String type, Pointer pointer, Dictionary<String,Object> fieldsToCheck, Dictionary<String,DataHolder> others, Dictionary<String,Object> allFields)
          Checks if a set of values can be updated in the database.
 void delete(Transaction t, Pointer ptr)
          Deletes a record
 void deleteSet(Transaction t, Pointer base, FieldDefinition fi)
          Deletes a set
abstract  Pointer insert(Transaction t, String type, Dictionary<String,Object> data)
          Inserts data of a given type
 Dictionary<String,Object> read(Transaction t, Pointer ptr, Object fields)
          Reads a record
 void update(Transaction t, Pointer ptr, Dictionary<String,Object> data)
          Updates a record with the given data
abstract  int update1(Transaction t, Pointer p, DataDefinition typeDef, Dictionary<String,Object> dic)
           
 void updateSet(Transaction t, Pointer base, FieldDefinition fi, Object val)
          Updates a set of values
 void updateSet1(Transaction t, Pointer base, FieldDefinition fi, Object val)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ddp

protected DataDefinitionProvider ddp
Constructor Detail

CRUDOperationProvider

public CRUDOperationProvider()
Method Detail

insert

public abstract Pointer insert(Transaction t,
                               String type,
                               Dictionary<String,Object> data)
Inserts data of a given type

Parameters:
t - the Transaction handling the insertion
type - the type of the object to be inserted
data - the data to be inserted
Returns:
a Pointer corresponding to the place where the record has been inserted

read

public Dictionary<String,Object> read(Transaction t,
                                      Pointer ptr,
                                      Object fields)
Reads a record

Parameters:
t - the Transaction used to read the record
ptr - the Pointer corresponding to the place at which we should read
fields - the fields to read
Returns:
a Dictionary holding the values of the fields

update

public void update(Transaction t,
                   Pointer ptr,
                   Dictionary<String,Object> data)
Updates a record with the given data

Parameters:
t - the Transaction handling the update
ptr - the Pointer corresponding to the place at which we should update
data - a Dictionary holding the the fields to be updated

delete

public void delete(Transaction t,
                   Pointer ptr)
Deletes a record

Parameters:
t - the Transaction handling the deletion
ptr - the Pointer to the record to be deleted

updateSet

public void updateSet(Transaction t,
                      Pointer base,
                      FieldDefinition fi,
                      Object val)
Updates a set of values

Parameters:
t - the Transaction handling the update
base - the Pointer to the base object which has the set
fi - the FieldDefinition corresponding to the set
val - the data to be updated, hold in a Vector

updateSet1

public void updateSet1(Transaction t,
                       Pointer base,
                       FieldDefinition fi,
                       Object val)

deleteSet

public void deleteSet(Transaction t,
                      Pointer base,
                      FieldDefinition fi)
Deletes a set

Parameters:
t - the Transaction handling the deletion
base - the base pointer to the object to be deleted
fi - the FieldDefinition of the field containing the set

checkInsert

public abstract void checkInsert(Transaction t,
                                 String type,
                                 Dictionary<String,Object> fieldsToCheck,
                                 Dictionary<String,DataHolder> fieldsToIgnore,
                                 Dictionary<String,Object> allFields)
Checks if a set of values can be updated in the database

Parameters:
t - the Transaction to be used
type - the type of the base object to insert to
fieldsToCheck - the values to be checked
fieldsToIgnore - the values of toCheck not to be checked
allFields - the entire data to be inserted

checkUpdate

public abstract void checkUpdate(Transaction t,
                                 String type,
                                 Pointer pointer,
                                 Dictionary<String,Object> fieldsToCheck,
                                 Dictionary<String,DataHolder> others,
                                 Dictionary<String,Object> allFields)
Checks if a set of values can be updated in the database.

Parameters:
t - the Transaction to be used
type - the type of the base object to insert to
pointer - the pointer to the record to be updated
fieldsToCheck - the values to be checked
others - the values of toCheck not to be checked
allFields - the entire data to be inserted

checkUpdate

protected DataDefinition checkUpdate(String type,
                                     Dictionary<String,Object> fieldsToCheck,
                                     Dictionary<String,DataHolder> fieldsToIgnore)

update1

public abstract int update1(Transaction t,
                            Pointer p,
                            DataDefinition typeDef,
                            Dictionary<String,Object> dic)