|
||||||||||
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.
Constructor Summary | |
---|---|
AbstractMemStorage()
Creates a new instance of AbstractMemStorage . |
Method Summary | |
---|---|
void |
close()
Closes the storage. |
protected BeanType |
createBeanType(String[] pColumnNames)
Creates a BeanType for the given column names. |
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 |
executeDelete(Object[] pDeleteDataRow)
This method has to be implemented in the Storage implementation and should have the functionality of the delete method. |
void |
executeDeleteAsBean(Object[] pDeleteDataRow)
This method will be used if AbstractStorage.delete(Object) was called. |
List<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. |
List<Object[]> |
executeFetchAsBean(ICondition pFilter,
SortDefinition pSort,
int pFromRow,
int pMinimumRowCount)
This method will be used if AbstractStorage.fetchBean(ICondition, SortDefinition, int, int) was called. |
MetaData |
executeGetMetaData()
This method has to be implemented in the Storage implementation and should have the functionality of the getMetaData method. |
Object[] |
executeInsert(Object[] pDataRow)
This method has to be implemented in the Storage implementation and should have the functionality of the insert method. |
Object[] |
executeInsertAsBean(Object[] pDataRow)
This method will be used if AbstractStorage.insert(Object) was called. |
Object[] |
executeRefetchRow(Object[] pDataRow)
This method has to be implemented in the Storage implementation and should have the functionality of the refetchRow method. |
Object[] |
executeRefetchRow(String[] pQueryColumns,
Object[] pDataRow)
Refetches data. |
Object[] |
executeRefetchRowAsBean(Object[] pDataRow)
This method will be used if AbstractStorage.refetch(Object) was called. |
Object[] |
executeUpdate(Object[] pOldDataRow,
Object[] pNewDataRow)
This method has to be implemented in the Storage implementation and should have the functionality of the update method. |
Object[] |
executeUpdateAsBean(Object[] pOldDataRow,
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. |
int |
getRowCount()
Gets the row count. |
abstract RowDefinition |
getRowDefinition()
Returns the row definition for the internal MemDataBook . |
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. |
abstract void |
update(DataBookEvent pEvent)
Updates an existing row. |
protected void |
validateWithMetaData(String[] pQueryColumns,
Object[] pRow)
Validates the given row with the meta data. |
void |
writeCSV(OutputStream pStream,
String[] pColumnNames,
String[] pLabels,
ICondition pFilter,
SortDefinition pSort,
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, 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, fetch, fetch, fetch, fetchBean, fetchBean, getAndInitBeanType, getMetaData, getName, info, insert, insert, refetch, refetchRow, setName, setPropertyNameForColumn, update, update, updateBean |
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, getMetaData, insert, refetchRow, update |
Constructor Detail |
---|
public AbstractMemStorage()
AbstractMemStorage
.
Method Detail |
---|
public void writeCSV(OutputStream pStream, String[] pColumnNames, String[] pLabels, ICondition pFilter, SortDefinition pSort, String pSeparator) throws Exception
writeCSV
in class AbstractStorage
pStream
- 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
Exception
- if the CSV output couldn't written to streampublic final MetaData executeGetMetaData() throws DataSourceException
executeGetMetaData
in class AbstractStorage
MetaData
DataSourceException
- if an Exception
occur during getting the meta data from the storageIStorage.getMetaData()
public final List<Object[]> executeFetch(ICondition pFilter, SortDefinition pSort, int pFromRow, int pMinimumRowCount) throws DataSourceException
executeFetch
in class AbstractStorage
pFilter
- 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)
public final List<Object[]> executeFetchAsBean(ICondition pFilter, SortDefinition pSort, int pFromRow, int pMinimumRowCount) throws DataSourceException
AbstractStorage.fetchBean(ICondition, SortDefinition, int, int)
was called.
executeFetchAsBean
in class AbstractStorage
pFilter
- 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)
public final Object[] executeRefetchRow(Object[] pDataRow) throws DataSourceException
executeRefetchRow
in class AbstractStorage
pDataRow
- the specified row as Object[]
.
Object[]
.
DataSourceException
- if an Exception
occur during interacting with the storage.IStorage.refetchRow(Object[])
public final Object[] executeRefetchRowAsBean(Object[] pDataRow) throws DataSourceException
AbstractStorage.refetch(Object)
was called.
executeRefetchRowAsBean
in class AbstractStorage
pDataRow
- the specified row as Object[]
.
Object[]
.
DataSourceException
- if an Exception
occur during interacting with the storage.IStorage.refetchRow(Object[])
public final Object[] executeInsert(Object[] pDataRow) throws DataSourceException
executeInsert
in class AbstractStorage
pDataRow
- the new row as Object[]
to insert.
DataSourceException
- if an Exception
occur during insert the row to the storageIStorage.insert(Object[])
public final Object[] executeInsertAsBean(Object[] pDataRow) throws DataSourceException
AbstractStorage.insert(Object)
was called.
executeInsertAsBean
in class AbstractStorage
pDataRow
- the new row as Object[]
to insert.
DataSourceException
- if an Exception
occur during insert the row to the storageIStorage.insert(Object[])
public final Object[] executeUpdate(Object[] pOldDataRow, Object[] pNewDataRow) throws DataSourceException
executeUpdate
in class AbstractStorage
pOldDataRow
- 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[])
public final Object[] executeUpdateAsBean(Object[] pOldDataRow, Object[] pNewDataRow) throws DataSourceException
AbstractStorage.update(Object)
was called.
executeUpdateAsBean
in class AbstractStorage
pOldDataRow
- 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[])
public final void executeDelete(Object[] pDeleteDataRow) throws DataSourceException
executeDelete
in class AbstractStorage
pDeleteDataRow
- 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 void executeDeleteAsBean(Object[] pDeleteDataRow) throws DataSourceException
AbstractStorage.delete(Object)
was called.
executeDeleteAsBean
in class AbstractStorage
pDeleteDataRow
- 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 createdpublic abstract void loadData(MemDataBook pBook, ICondition pFilter) throws ModelException
pBook
- the internal data bookpFilter
- the filter
ModelException
- if an error occurs during fillingpublic abstract void insert(DataBookEvent pEvent) throws ModelException
pEvent
- the data book event
ModelException
- if an insert error occurspublic abstract void update(DataBookEvent pEvent) throws ModelException
pEvent
- the data book event
ModelException
- if an update error occurspublic abstract void delete(DataBookEvent pEvent) throws ModelException
pEvent
- the data book event
ModelException
- if a delete error occurspublic void finalize() throws Throwable
finalize
in class Object
Throwable
protected BeanType createBeanType(String[] pColumnNames)
BeanType
for the given column names.
createBeanType
in class AbstractStorage
pColumnNames
- the column names which are allowed for beans
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
otherwisepublic final Object[] executeRefetchRow(String[] pQueryColumns, Object[] pDataRow) throws DataSourceException
pQueryColumns
- the query columnspDataRow
- the old data
DataSourceException
- if refetch failspublic void doInsert(DataBookEvent pEvent) throws ModelException
loadData(MemDataBook, ICondition)
.
pEvent
- the data book event
ModelException
- if an insert error occurspublic void doUpdate(DataBookEvent pEvent) throws ModelException
loadData(MemDataBook, ICondition)
.
pEvent
- the data book event
ModelException
- if an update error occurspublic void doDelete(DataBookEvent pEvent) throws ModelException
loadData(MemDataBook, ICondition)
.
pEvent
- the data book event
ModelException
- if a delete error occursprotected void validateWithMetaData(String[] pQueryColumns, Object[] pRow) throws ModelException
pQueryColumns
- the columns to checkpRow
- the column array ordered in the visible columns order
ModelException
- if the 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 failed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |