com.sibvisions.rad.model.remote
Class RemoteDataBook

java.lang.Object
  extended by com.sibvisions.rad.model.mem.DataRow
      extended by com.sibvisions.rad.model.mem.ChangeableDataRow
          extended by com.sibvisions.rad.model.mem.MemDataBook
              extended by com.sibvisions.rad.model.remote.RemoteDataBook
All Implemented Interfaces:
Serializable, Comparable<IDataRow>, IChangeableDataRow, IDataBook, IDataPage, IDataRow, INamedObject

public class RemoteDataBook
extends MemDataBook

The RemoteDataBook is a storage independent table, and handles all operations based on the the MemDatabook base class. It communicates to the IStorage and uses the storage methods to fetch, insert update, delete the data on server.

See Also:
MemDataBook, IDataPage, IDataBook, IRowDefinition, IChangeableDataRow, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.rad.model.IDataBook
IDataBook.SelectionMode, IDataBook.WriteBackIsolationLevel
 
Field Summary
 
Fields inherited from class com.sibvisions.rad.model.mem.ChangeableDataRow
DELETING, DETAILS_CHANGED, INSERTING, INTERNAL_OFFSET, UPDATING, WRITABLE_COLUMN_CHANGED
 
Fields inherited from class com.sibvisions.rad.model.mem.DataRow
oaStorage, rdRowDefinition
 
Constructor Summary
RemoteDataBook()
          Creates a new instance of RemoteDataBook.
 
Method Summary
 void close()
          Closes the IDataBook.
protected  MemDataPage createDataPage(IDataRow pMasterDataRow)
          It constructs a new MemDataPage.
protected  void executeDelete()
          Its called when the deleting DataRow (delete row) should be deleted.
protected  void executeInsert()
          Its called when the inserting DataRow (new row) should be inserted.
protected  void executeLockAndRefetch()
          Its called before the DataRow (existing row) will be changed.
protected  void executeRefresh()
          It will be called, when the MemDataBook will be completely refreshed.
protected  void executeUpdate()
          Its called when the updating DataRow (changed row) should be updated Derived classed should override this to implemented the needed functionality.
 String[] getBlockFetchColumnNames()
          Returns the block fetch columns.
protected  AbstractConnection getConnection()
          Returns the AbstractConnection of the RemoteDataSource for this StorageDataSource.
 RemoteDataSource getDataSource()
          Returns the IDataSource for this IDataBook.
protected  int[] getFetchColumnIndexes()
          Returns the correct column indexes of the fetched data, after opening the data book.
protected  int getFetchedRowsForBlock(IDataRow pMasterDataRow)
          Returns the amount of fetched rows per block.
protected  int[] getMasterColumnIndexesForBlock()
          Returns the correct master column indexes of the fetched data, after opening the data book.
protected  String[] getMetaDataColumnNames()
          Returns the server meta data column names.
protected  boolean isCachingStorage()
          Returns whether the server storage is a cached storage or a storage without cache.
protected  boolean isDataPageRefetchPossible()
          This function is used for rehashing data pages after insert of the master row.
 boolean isMemFilter()
          Returns true if the filter is handled in memory.
 boolean isMemSort()
          Returns true if the sort is handled in memory.
 boolean isMetaDataCacheEnabled()
          Gets whether metadata cache is enabled.
 boolean isWritebackEnabled()
          Returns true if this data book should write its changes to the storage.
 void open()
          Opens the IDataBook.
 void setBlockFetchColumnNames(String[] pBlockFetchColumnNames)
          Sets the block fetch columns.
 void setDataSource(IDataSource pDataSource)
          Sets the IDataSource for this IDataBook.
protected  void setFetchedRowsForBlock(IDataRow pMasterDataRow, int pFetchedRows)
          Sets the amount of fetched rows per block.
 void setMemFilter(boolean pMemFilter)
          Sets if the sort is handled in memory.
 void setMemSort(boolean pMemSort)
          Sets if the sort is handled in memory.
 void setMetaDataCacheEnabled(boolean pCacheEnabled)
          Sets the metadata cache enabled.
 void setWritebackEnabled(boolean pWritebackEnabled)
          Sets if this data book should write back its changes to the storage.
 
Methods inherited from class com.sibvisions.rad.model.mem.MemDataBook
addDetailDataBook, clear, clearFilterSortInMemDataPages, delete, deleteAllDataRows, eventAfterColumnSelected, eventAfterDeleted, eventAfterDeleting, eventAfterInserted, eventAfterInserting, eventAfterReload, eventAfterRestore, eventAfterRowSelected, eventAfterUpdated, eventAfterUpdating, eventBeforeColumnSelected, eventBeforeDeleted, eventBeforeDeleting, eventBeforeInserted, eventBeforeInserting, eventBeforeReload, eventBeforeRestore, eventBeforeRowSelected, eventBeforeUpdated, eventBeforeUpdating, fetchAll, finalize, getChangedDataRows, getDataBook, getDataPage, getDataPage, getDataPage, getDataPage, getDataPageWithRootRow, getDataRow, getDetailDataBooks, getEstimatedRowCount, getFilter, getMasterDataRow, getMasterReference, getName, getOnlyIUDChangedDataRows, getOriginalRow, getReadAhead, getRootReference, getRowCount, getRowIndex, getSelectedColumn, getSelectedRow, getSelectionMode, getSort, getTreePath, getUID, getValue, getValues, getWritebackIsolationLevel, hasDataPage, hasDataPage, insert, isAllFetched, isDeleteAllowed, isDeleteCascade, isDeleteEnabled, isDeleting, isDetailChanged, isInsertAllowed, isInsertEnabled, isInserting, isLockAndRefetchEnabled, isOpen, isOutOfSync, isReadonly, isSelfJoined, isUpdateAllowed, isUpdateEnabled, isUpdating, isWritableColumnChanged, notifyDetailChanged, notifyMasterChanged, reload, reload, reloadDataPage, removeDataPage, removeDetailDataBook, restoreAllRows, restoreDataPage, restoreSelectedRow, saveAllRows, saveDataPage, saveSelectedRow, searchNext, searchNext, searchPrevious, searchPrevious, setDeleteCascade, setDeleteEnabled, setFilter, setInsertEnabled, setLockAndRefetchEnabled, setMasterReference, setName, setReadAhead, setReadOnly, setReadOnlyWithoutSave, setRootReference, setRowDefinition, setSelectedColumn, setSelectedRow, setSelectedRowInternal, setSelectionMode, setSort, setTreePath, setUpdateEnabled, setValue, setValues, setValuesInternal, setWritebackIsolationLevel, store, toString, update
 
Methods inherited from class com.sibvisions.rad.model.mem.ChangeableDataRow
restore, setDeleting, setDetailChanged, setInserting, setUID, setUpdating, setValueDRInternal
 
Methods inherited from class com.sibvisions.rad.model.mem.DataRow
addControl, cancelEditingControls, compareTo, compareTo, createDataRow, createEmptyRow, equals, equals, eventValuesChanged, getControls, getRowDefinition, getValue, getValueAsString, getValuesAsString, hashCode, invokeCancelEditingControls, invokeRepaintListeners, invokeSaveEditingControls, notifyRepaintControls, removeControl, saveEditingControls, setDefaultValues
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.model.IDataRow
addControl, compareTo, createDataRow, createEmptyRow, equals, eventValuesChanged, getControls, getRowDefinition, getValue, getValueAsString, getValuesAsString, removeControl
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

RemoteDataBook

public RemoteDataBook()
Creates a new instance of RemoteDataBook.

Method Detail

isDataPageRefetchPossible

protected boolean isDataPageRefetchPossible()
This function is used for rehashing data pages after insert of the master row. If it is true, the page is dropped, and therefore refetched, if needed.

Overrides:
isDataPageRefetchPossible in class MemDataBook
Returns:
true, the page is dropped, and therefore refetched, if needed.

createDataPage

protected MemDataPage createDataPage(IDataRow pMasterDataRow)
It constructs a new MemDataPage. Its every time used, when a new MemDataPage is necessary. Derived classed should override this and create the needed IDataPage.

Overrides:
createDataPage in class MemDataBook
Parameters:
pMasterDataRow - the master IDataRow for this IDataPage.
Returns:
the new MemDataPage to use.

setDataSource

public void setDataSource(IDataSource pDataSource)
                   throws ModelException
Sets the IDataSource for this IDataBook.
The IDataSource defines the access to the storage like DB, XML, ...

Specified by:
setDataSource in interface IDataBook
Overrides:
setDataSource in class MemDataBook
Parameters:
pDataSource - the IDataSource to use for load/save data
Throws:
ModelException - if the IDataBook is already opened. -> Not allowed
See Also:
IDataSource

getDataSource

public RemoteDataSource getDataSource()
Returns the IDataSource for this IDataBook.

Specified by:
getDataSource in interface IDataBook
Overrides:
getDataSource in class MemDataBook
Returns:
the IDataSource for this IDataBook.

open

public void open()
          throws ModelException
Opens the IDataBook. AbstractStorage oriented implementations should open the storage (DB, XML, File) and load the Meta data/defaulting the RowDefinition.

Specified by:
open in interface IDataBook
Overrides:
open in class MemDataBook
Throws:
ModelException - if the IDataBook couldn't be opened, because of empty storage unit name, empty IDataSource, missing RowDefinition or failed DataPage creation

close

public void close()
Closes the IDataBook. AbstractStorage oriented implementations should close the storage (DB, XML, file).

Specified by:
close in interface IDataBook
Overrides:
close in class MemDataBook

executeLockAndRefetch

protected void executeLockAndRefetch()
                              throws ModelException
Its called before the DataRow (existing row) will be changed. Derived classed should override this to implemented the needed functionality. e.g. lock and refetch the actual values of the row from storage

Overrides:
executeLockAndRefetch in class MemDataBook
Throws:
ModelException - if an ModelException occur during insert.

executeInsert

protected void executeInsert()
                      throws ModelException
Its called when the inserting DataRow (new row) should be inserted. Derived classed should override this to implemented the needed functionality. e.g. store the new row in the storage.

Overrides:
executeInsert in class MemDataBook
Throws:
ModelException - if an ModelException occur during insert.

executeUpdate

protected void executeUpdate()
                      throws ModelException
Its called when the updating DataRow (changed row) should be updated Derived classed should override this to implemented the needed functionality. e.g. update the old row with the new row in the storage.

Overrides:
executeUpdate in class MemDataBook
Throws:
ModelException - if an ModelException occur during update.

executeDelete

protected void executeDelete()
                      throws ModelException
Its called when the deleting DataRow (delete row) should be deleted. Derived classed should override this to implemented the needed functionality. e.g. delete the row in the storage.

Overrides:
executeDelete in class MemDataBook
Throws:
ModelException - if an ModelException occur during delete.

executeRefresh

protected void executeRefresh()
                       throws ModelException
It will be called, when the MemDataBook will be completely refreshed. In the MemDataBook, it does nothing, because all is in memory and not restoreable. Derived classes maybe want to clear the memory.

Overrides:
executeRefresh in class MemDataBook
Throws:
ModelException - if an ModelExcpetion happen during refresh

setMemSort

public void setMemSort(boolean pMemSort)
Sets if the sort is handled in memory.

Overrides:
setMemSort in class MemDataBook
Parameters:
pMemSort - true if the sort is handled in memory.

isMemSort

public boolean isMemSort()
Returns true if the sort is handled in memory.

Overrides:
isMemSort in class MemDataBook
Returns:
true if the sort is handled in memory.

setMemFilter

public void setMemFilter(boolean pMemFilter)
Sets if the sort is handled in memory.

Overrides:
setMemFilter in class MemDataBook
Parameters:
pMemFilter - true if the filter is handled in memory.

isMemFilter

public boolean isMemFilter()
Returns true if the filter is handled in memory.

Overrides:
isMemFilter in class MemDataBook
Returns:
true if the filter is handled in memory.

setWritebackEnabled

public void setWritebackEnabled(boolean pWritebackEnabled)
Sets if this data book should write back its changes to the storage.

Overrides:
setWritebackEnabled in class MemDataBook
Parameters:
pWritebackEnabled - determines if changes should be written to the store.

isWritebackEnabled

public boolean isWritebackEnabled()
Returns true if this data book should write its changes to the storage.

Overrides:
isWritebackEnabled in class MemDataBook
Returns:
true to write back all changes, false otherwise.

getBlockFetchColumnNames

public String[] getBlockFetchColumnNames()
Returns the block fetch columns. The block fetch columns have to be a subset of the master link columns. The rows are fetched with these columns, and sorted into the corresponding pages.

Returns:
the block fetch columns.

setBlockFetchColumnNames

public void setBlockFetchColumnNames(String[] pBlockFetchColumnNames)
                              throws ModelException
Sets the block fetch columns. The block fetch columns have to be a subset of the master link columns. The rows are fetched with these columns, and sorted into the corresponding pages.

Parameters:
pBlockFetchColumnNames - the block fetch columns.
Throws:
ModelException - if the data book is already open.

setMetaDataCacheEnabled

public void setMetaDataCacheEnabled(boolean pCacheEnabled)
Sets the metadata cache enabled. If it is disabled, every open performs a remote call.

Parameters:
pCacheEnabled - true to enable the cache

isMetaDataCacheEnabled

public boolean isMetaDataCacheEnabled()
Gets whether metadata cache is enabled.

Returns:
true if the cache is enabled, false otherwise

getMetaDataColumnNames

protected String[] getMetaDataColumnNames()
Returns the server meta data column names.

Returns:
the server meta data column names.

getFetchColumnIndexes

protected int[] getFetchColumnIndexes()
Returns the correct column indexes of the fetched data, after opening the data book.

Returns:
the correct column indexes of the fetched data, after opening the data book.

getMasterColumnIndexesForBlock

protected int[] getMasterColumnIndexesForBlock()
Returns the correct master column indexes of the fetched data, after opening the data book.

Returns:
the correct master column indexes of the fetched data, after opening the data book.

getFetchedRowsForBlock

protected int getFetchedRowsForBlock(IDataRow pMasterDataRow)
                              throws ModelException
Returns the amount of fetched rows per block.

Parameters:
pMasterDataRow - the master data row.
Returns:
the amount of fetched rows per block.
Throws:
ModelException - if it fails.

setFetchedRowsForBlock

protected void setFetchedRowsForBlock(IDataRow pMasterDataRow,
                                      int pFetchedRows)
                               throws ModelException
Sets the amount of fetched rows per block.

Parameters:
pMasterDataRow - the master data row.
pFetchedRows - the amount of fetched rows per block.
Throws:
ModelException - if it fails.

getConnection

protected AbstractConnection getConnection()
Returns the AbstractConnection of the RemoteDataSource for this StorageDataSource.

Returns:
the AbstractConnection of the RemoteDataSource for this StorageDataSource.

isCachingStorage

protected boolean isCachingStorage()
Returns whether the server storage is a cached storage or a storage without cache.

Returns:
true if the server storage uses a cache, false otherwise


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.