Package org.datanucleus.store.excel
Class ExcelPersistenceHandler
- java.lang.Object
-
- org.datanucleus.store.AbstractPersistenceHandler
-
- org.datanucleus.store.excel.ExcelPersistenceHandler
-
- All Implemented Interfaces:
org.datanucleus.store.StorePersistenceHandler
public class ExcelPersistenceHandler extends org.datanucleus.store.AbstractPersistenceHandler
Persistence Handler for Excel datastores. Handles the insert/update/delete/fetch/locate operations by using Apache POI. Some notes about Apache POI utilisation :-- We have a Workbook, composed of a set of named Sheet objects.
- Each class is persisted to its own sheet.
- Insert of an object requires creation of a Row. Unless we are on the last row in the sheet in which case we have a row and just need to add cells. See "delete"
- Delete of an object will involve removal of the row, EXCEPT in the case of the final row in the sheet in which case we have to delete all cells since Apache POI doesn't seem to allow removal of the last row.
-
-
Constructor Summary
Constructors Constructor Description ExcelPersistenceHandler(org.datanucleus.store.StoreManager storeMgr)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
deleteObject(org.datanucleus.state.ObjectProvider op)
Deletes a persistent object from the database.void
fetchObject(org.datanucleus.state.ObjectProvider op, int[] fieldNumbers)
Fetches fields of a persistent object from the database.Object
findObject(org.datanucleus.ExecutionContext ec, Object id)
Accessor for the object with the specified identity (if present).void
insertObject(org.datanucleus.state.ObjectProvider op)
Method to insert the object into the datastore.void
locateObject(org.datanucleus.state.ObjectProvider op)
Method to locate if an object exists in the datastore.void
updateObject(org.datanucleus.state.ObjectProvider op, int[] fieldNumbers)
Method to handle the update of fields of an object in the datastore.-
Methods inherited from class org.datanucleus.store.AbstractPersistenceHandler
assertReadOnlyForUpdateOfObject, findObjectForUnique
-
-
-
-
Method Detail
-
close
public void close()
-
insertObject
public void insertObject(org.datanucleus.state.ObjectProvider op)
Method to insert the object into the datastore.- Parameters:
op
- ObjectProvider of the object
-
updateObject
public void updateObject(org.datanucleus.state.ObjectProvider op, int[] fieldNumbers)
Method to handle the update of fields of an object in the datastore.- Parameters:
op
- Object Provider for the objectfieldNumbers
- Absolute numbers of fields to be updated
-
deleteObject
public void deleteObject(org.datanucleus.state.ObjectProvider op)
Deletes a persistent object from the database.- Parameters:
op
- The Object Provider of the object to be deleted.- Throws:
org.datanucleus.exceptions.NucleusDataStoreException
- when an error occurs in the datastore communicationorg.datanucleus.exceptions.NucleusOptimisticException
- thrown if version checking fails on an optimistic transaction for this object
-
fetchObject
public void fetchObject(org.datanucleus.state.ObjectProvider op, int[] fieldNumbers)
Fetches fields of a persistent object from the database.- Parameters:
op
- The ObjectProvider of the object to be fetched.fieldNumbers
- The numbers of the fields to be fetched.- Throws:
org.datanucleus.exceptions.NucleusDataStoreException
- when an error occurs in the datastore communication
-
findObject
public Object findObject(org.datanucleus.ExecutionContext ec, Object id)
Accessor for the object with the specified identity (if present). Since we don't manage the memory instantiation of objects this just returns null.- Parameters:
ec
- execution contextid
- Identity of the object- Returns:
- The object
-
locateObject
public void locateObject(org.datanucleus.state.ObjectProvider op)
Method to locate if an object exists in the datastore. Goes through the rows in the worksheet and finds a row with the required identity.- Parameters:
op
- ObjectProvider of object to locate
-
-