|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sibvisions.rad.persist.AbstractStorage
com.sibvisions.rad.persist.AbstractCachedStorage
com.sibvisions.rad.persist.AbstractMemStorage
public abstract class AbstractMemStorage
The AbstractMemStorage is an AbstractCachedStorage and holds an internal MemDataBook
for the data. It implements all methods which are necessary that the client is able to receive data.
All data manipulation methods like insert/update/delete are abstract and have to be implemented.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.sibvisions.rad.persist.AbstractStorage |
|---|
AbstractStorage.AllFetchedList<E> |
| Constructor Summary | |
|---|---|
|
AbstractMemStorage()
Creates a new instance of AbstractMemStorage. |
protected |
AbstractMemStorage(MemDataBook pDataBook)
Creates a new instance of AbstractMemStorage with an
external data book. |
| Method Summary | |
|---|---|
void |
close()
Closes the storage. |
protected BeanType |
createBeanType(java.lang.String[] pColumnNames)
Creates a BeanType for the given column names. |
protected ColumnMetaData |
createColumnMetaData(ColumnDefinition pColumnDefinition)
It returns the ColumnMetaData to the corresponding ColumnDefinition. |
abstract void |
delete(DataBookEvent pEvent)
Deletes an existing row. |
void |
doDelete(DataBookEvent pEvent)
The delete notification method from the data book. |
void |
doInsert(DataBookEvent pEvent)
The insert notification method from the data book. |
void |
doUpdate(DataBookEvent pEvent)
The update notification method from the data book. |
void |
doValidate(DataBookEvent pEvent)
Validates the current record with metadata restrictions. |
protected void |
executeDelete(java.lang.Object[] pDeleteDataRow)
This method has to be implemented in the Storage implementation and should have the functionality of the delete method. |
protected void |
executeDeleteAsBean(java.lang.Object[] pDeleteDataRow)
This method will be used if AbstractStorage.delete(Object) was called. |
protected java.util.List<java.lang.Object[]> |
executeFetch(ICondition pFilter,
SortDefinition pSort,
int pFromRow,
int pMinimumRowCount)
This method has to be implemented in the Storage implementation and should have the functionality of the fetch method. |
protected java.util.List<java.lang.Object[]> |
executeFetchAsBean(ICondition pFilter,
SortDefinition pSort,
int pFromRow,
int pMinimumRowCount)
This method will be used if AbstractStorage.fetchBean(ICondition, SortDefinition, int, int) was called. |
protected java.lang.Object[] |
executeInsert(java.lang.Object[] pDataRow)
This method has to be implemented in the Storage implementation and should have the functionality of the insert method. |
protected java.lang.Object[] |
executeInsertAsBean(java.lang.Object[] pDataRow)
This method will be used if AbstractStorage.insert(Object) was called. |
protected java.lang.Object[] |
executeRefetchRow(java.lang.Object[] pDataRow)
This method has to be implemented in the Storage implementation and should have the functionality of the refetchRow method. |
protected java.lang.Object[] |
executeRefetchRow(java.lang.String[] pQueryColumns,
java.lang.Object[] pDataRow)
Refetches data. |
protected java.lang.Object[] |
executeRefetchRowAsBean(java.lang.Object[] pDataRow)
This method will be used if AbstractStorage.refetch(Object) was called. |
protected java.lang.Object[] |
executeUpdate(java.lang.Object[] pOldDataRow,
java.lang.Object[] pNewDataRow)
This method has to be implemented in the Storage implementation and should have the functionality of the update method. |
protected java.lang.Object[] |
executeUpdateAsBean(java.lang.Object[] pOldDataRow,
java.lang.Object[] pNewDataRow)
This method will be used if AbstractStorage.update(Object) was called. |
void |
finalize()
|
MemDataBook |
getDataBook()
Gets the internal MemDataBook. |
SortDefinition |
getDefaultSort()
Gets the default sort definition. |
int |
getEstimatedRowCount(ICondition pFilter)
Returns the number of rows in this AbstractStorage from the storage. |
MetaData |
getMetaData()
Returns the meta data for this AbstractStorage from the storage as MetaData. |
int |
getRowCount()
Gets the row count. |
abstract RowDefinition |
getRowDefinition()
Returns the row definition for the internal MemDataBook. |
protected ColumnMetaData |
initializeColumnMetaData(ColumnDefinition pColumnDefinition,
ColumnMetaData pColumnMetaData)
This initializes the ColumnMetaData with the given corresponding ColumnDefinition. |
protected ColumnMetaData |
initializeDataType(ColumnDefinition pColumnDefinition,
ColumnMetaData pColumnMetaData)
This initializes the column meta data with the data of the data type IDataType. |
abstract void |
insert(DataBookEvent pEvent)
Inserts a new row. |
boolean |
isOpen()
Returns whether the storage is open and ready to use. |
abstract void |
loadData(MemDataBook pBook,
ICondition pFilter)
Loads the relevant data into the internal data book. |
void |
open()
Opens the storage. |
void |
setDefaultSort(SortDefinition pSort)
Sets the default sort definition. |
void |
setDispatchEventsEnabled(boolean pEnabled)
Sets event dispatching en-/disabled for "before" events. |
abstract void |
update(DataBookEvent pEvent)
Updates an existing row. |
protected void |
validateWithMetaData()
Validates all columns. |
protected void |
validateWithMetaData(java.lang.String[] pColumns,
java.lang.Object[] pValues)
Validates the given row with the meta data. |
void |
writeCSV(java.io.OutputStream pStream,
java.lang.String[] pColumnNames,
java.lang.String[] pLabels,
ICondition pFilter,
SortDefinition pSort,
java.lang.String pSeparator)
Write the current storage with the specified filter and sort into the given output stream as CSV Format. |
| Methods inherited from class com.sibvisions.rad.persist.AbstractCachedStorage |
|---|
clearMetaData, clearMetaData, getMetaData, getMetaData, getMetaDataCacheGroups, getMetaDataCacheOption, getMetaDataFromCache, getMetaDataFromCache, isGlobalMetaDataCacheEnabled, isMetaDataCacheEnabled, putMetaDataToCache, removeMetaData, setGlobalMetaDataCacheEnabled, setMetaDataCacheOption |
| Methods inherited from class com.sibvisions.rad.persist.AbstractStorage |
|---|
createBean, createCSV, createCSV, createCSV, createEmptyBean, createPOJO, createPOJO, debug, delete, delete, error, eventAfterDelete, eventAfterInsert, eventAfterUpdate, eventBeforeDelete, eventBeforeInsert, eventBeforeUpdate, eventCalculateRow, eventInsteadOfDelete, eventInsteadOfInsert, eventInsteadOfUpdate, fetch, fetch, fetch, fetchBean, fetchBean, getAndInitBeanType, getBeanConverter, getName, getPropertyNameForColumn, hasInsteadOfDeleteEventHandler, hasInsteadOfInsertEventHandler, hasInsteadOfUpdateEventHandler, info, insert, insert, isLogEnabled, isRefetch, refetch, refetchRow, setName, setPropertyNameForColumn, setRefetch, update, update, update |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.rad.persist.IStorage |
|---|
delete, fetch, insert, refetchRow, update |
| Constructor Detail |
|---|
protected AbstractMemStorage(MemDataBook pDataBook)
AbstractMemStorage with an
external data book.
pDataBook - the data bookpublic AbstractMemStorage()
AbstractMemStorage.
| Method Detail |
|---|
public void writeCSV(java.io.OutputStream pStream,
java.lang.String[] pColumnNames,
java.lang.String[] pLabels,
ICondition pFilter,
SortDefinition pSort,
java.lang.String pSeparator)
throws java.lang.Exception
writeCSV in class AbstractStoragepStream - the output stream to use for the CSV streampColumnNames - the column names to include in the exportpLabels - the labels to show as header in the exportpFilter - the conditionpSort - the sort definitionpSeparator - the column separator
java.lang.Exception - if the CSV output couldn't written to stream
@Accessible
public final MetaData getMetaData()
throws DataSourceException
MetaData.
MetaData.
DataSourceException - if an Exception occur during getting the meta data from the storage.
protected final java.util.List<java.lang.Object[]> executeFetch(ICondition pFilter,
SortDefinition pSort,
int pFromRow,
int pMinimumRowCount)
throws DataSourceException
executeFetch in class AbstractStoragepFilter - the ICondition to use.pSort - the SortDefinition to use.pFromRow - the from row index to request from storage.pMinimumRowCount - the minimum row count to request, beginning from the pFromRow.
List[Object[]].
DataSourceException - if an Exception occur during interacting with the storage.IStorage.fetch(ICondition, SortDefinition, int, int)
protected final java.util.List<java.lang.Object[]> executeFetchAsBean(ICondition pFilter,
SortDefinition pSort,
int pFromRow,
int pMinimumRowCount)
throws DataSourceException
AbstractStorage.fetchBean(ICondition, SortDefinition, int, int) was called.
executeFetchAsBean in class AbstractStoragepFilter - the ICondition to use.pSort - the SortDefinition to use.pFromRow - the from row index to request from storage.pMinimumRowCount - the minimum row count to request, beginning from the pFromRow.
List[Object[]].
DataSourceException - if an Exception occur during interacting with the storage.IStorage.fetch(ICondition, SortDefinition, int, int)
protected final java.lang.Object[] executeRefetchRow(java.lang.Object[] pDataRow)
throws DataSourceException
executeRefetchRow in class AbstractStoragepDataRow - the specified row as Object[].
Object[].
DataSourceException - if an Exception occur during interacting with the storage.IStorage.refetchRow(Object[])
protected final java.lang.Object[] executeRefetchRowAsBean(java.lang.Object[] pDataRow)
throws DataSourceException
AbstractStorage.refetch(Object) was called.
executeRefetchRowAsBean in class AbstractStoragepDataRow - the specified row as Object[].
Object[].
DataSourceException - if an Exception occur during interacting with the storage.IStorage.refetchRow(Object[])
protected final java.lang.Object[] executeInsert(java.lang.Object[] pDataRow)
throws DataSourceException
executeInsert in class AbstractStoragepDataRow - the new row as Object[] to insert.
null if no insert operation was performed.
DataSourceException - if an Exception occur during insert the row to the storageIStorage.insert(Object[])
protected final java.lang.Object[] executeInsertAsBean(java.lang.Object[] pDataRow)
throws DataSourceException
AbstractStorage.insert(Object) was called.
executeInsertAsBean in class AbstractStoragepDataRow - the new row as Object[] to insert.
DataSourceException - if an Exception occur during insert the row to the storageIStorage.insert(Object[])
protected final java.lang.Object[] executeUpdate(java.lang.Object[] pOldDataRow,
java.lang.Object[] pNewDataRow)
throws DataSourceException
executeUpdate in class AbstractStoragepOldDataRow - the old row as Object[]pNewDataRow - the new row as Object[] to update
Object[]. null if no update operation was performed.
DataSourceException - if an Exception occur during updating the row.IStorage.update(Object[], Object[])
protected final java.lang.Object[] executeUpdateAsBean(java.lang.Object[] pOldDataRow,
java.lang.Object[] pNewDataRow)
throws DataSourceException
AbstractStorage.update(Object) was called.
executeUpdateAsBean in class AbstractStoragepOldDataRow - the old row as Object[]pNewDataRow - the new row as Object[] to update
Object[].
DataSourceException - if an Exception occur during updating the row.IStorage.update(Object[], Object[])
protected final void executeDelete(java.lang.Object[] pDeleteDataRow)
throws DataSourceException
executeDelete in class AbstractStoragepDeleteDataRow - the row as Object[] to delete.
DataSourceException - if an Exception occur during deleting the row or
if the storage isn't opened or the PrimaryKey is wrong and more/less
then one row is deleted.IStorage.delete(Object[])
protected void executeDeleteAsBean(java.lang.Object[] pDeleteDataRow)
throws DataSourceException
AbstractStorage.delete(Object) was called.
executeDeleteAsBean in class AbstractStoragepDeleteDataRow - the row as Object[] to delete.
DataSourceException - if an Exception occur during deleting the row or
if the storage isn't opened or the PrimaryKey is wrong and more/less
then one row is deleted.IStorage.delete(Object[])
public int getEstimatedRowCount(ICondition pFilter)
throws DataSourceException
ICondition to count the rows.
pFilter - the ICondition to use.
DataSourceException - if an Exception occur during interacting with the storage.
public abstract RowDefinition getRowDefinition()
throws ModelException
MemDataBook. The row definition will
be used to create and cache the meta data. The ColumnView will be used to detect
the column which will be used for meta data creation.
ModelException - if the row definition can not be created
public abstract void loadData(MemDataBook pBook,
ICondition pFilter)
throws ModelException
pBook - the internal data bookpFilter - the filter
ModelException - if an error occurs during filling
public abstract void insert(DataBookEvent pEvent)
throws ModelException
pEvent - the data book event
ModelException - if an insert error occurs
public abstract void update(DataBookEvent pEvent)
throws ModelException
pEvent - the data book event
ModelException - if an update error occurs
public abstract void delete(DataBookEvent pEvent)
throws ModelException
pEvent - the data book event
ModelException - if a delete error occurs
public void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwableprotected BeanType createBeanType(java.lang.String[] pColumnNames)
BeanType for the given column names.
createBeanType in class AbstractStoragepColumnNames - the column names which are allowed for beans
protected ColumnMetaData createColumnMetaData(ColumnDefinition pColumnDefinition)
ColumnDefinition.
pColumnDefinition - the ColumnDefinition to use.
ColumnDefinition.
protected ColumnMetaData initializeColumnMetaData(ColumnDefinition pColumnDefinition,
ColumnMetaData pColumnMetaData)
ColumnDefinition.
pColumnDefinition - the ColumnDefinition to use.pColumnMetaData - the ColumnMetaData.
protected ColumnMetaData initializeDataType(ColumnDefinition pColumnDefinition,
ColumnMetaData pColumnMetaData)
IDataType.
pColumnDefinition - the ColumnDefinition to use.pColumnMetaData - the ColumnMetaData.
public void open()
throws DataSourceException
DataSourceException - if the storage can not be openedpublic void close()
public boolean isOpen()
true if the storage is open, false otherwise
protected final java.lang.Object[] executeRefetchRow(java.lang.String[] pQueryColumns,
java.lang.Object[] pDataRow)
throws DataSourceException
pQueryColumns - the query columnspDataRow - the old data
DataSourceException - if refetch fails
public void doInsert(DataBookEvent pEvent)
throws ModelException
loadData(MemDataBook, ICondition).
pEvent - the data book event
ModelException - if an insert error occurs
public void doUpdate(DataBookEvent pEvent)
throws ModelException
loadData(MemDataBook, ICondition).
pEvent - the data book event
ModelException - if an update error occurs
public void doDelete(DataBookEvent pEvent)
throws ModelException
loadData(MemDataBook, ICondition).
pEvent - the data book event
ModelException - if a delete error occurs
public void doValidate(DataBookEvent pEvent)
throws ModelException
pEvent - the data book event
ModelException - if validation fails
protected void validateWithMetaData()
throws ModelException
ModelException - if validation failsvalidateWithMetaData(String[], Object[])
protected void validateWithMetaData(java.lang.String[] pColumns,
java.lang.Object[] pValues)
throws ModelException
pColumns - the columns to checkpValues - the column array ordered in the visible columns order
ModelException - if validation failspublic MemDataBook getDataBook()
MemDataBook.
public void setDefaultSort(SortDefinition pSort)
pSort - the default sort definitionpublic SortDefinition getDefaultSort()
setDefaultSort(SortDefinition)
public int getRowCount()
throws ModelException
ModelException - if data access failedpublic void setDispatchEventsEnabled(boolean pEnabled)
pEnabled - true to enable event dispatching, false to disable it
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||