|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the interface for objects that hold the meta-data
for data tables.
Please note that only the "get" methods are meant to be used
by an application programmer.
All other methods are for DataSource's internal use only.
There can be zero, one or more
data tables associated with a MetaDataModel, thus it is more efficient
to store the meta-data only once.
In terms of JClass DataSource, each MetaDataModel is a node of the MetaTree. The MetaTree describes the hierarchacal relations between MetaDataModel objects.
Each MetaData has its own commit policy. The default is COMMIT_LEAVING_RECORD. A commit policy determines when changes will be written to the data source. There are three policies:
COMMIT_LEAVING_RECORD
COMMIT_LEAVING_ANCESTOR
COMMIT_MANUALLY
COMMIT_LEAVING_RECORD
(the default) modifications
to a row will be automatically written to the originating data source when
the cursor moves to any other row (see DataModel.movetoRow(..)).
In the case of delete, the row is immediately deleted.
When the policy is COMMIT_LEAVING_ANCESTOR
changes will be automatically
written to the originating data source when the cursor moves to a row which is not
in the same subtree as the current row. For example, in a master-detail relationship
where the master table is Orders and the details table is OrderDetails, the cursor
can be moved to any of the OrderDetail lines which correspond to the current
Order. As soon as the cursor is moved to a different Order or to an OrderDetail
line for a different Order, the previous edits will be automatically committed.
A policy of COMMIT_MANUALLY will never automatically commit changes. Any row changes will simply change the status of those rows (see DataTableModel.getRowStatus()). You must then call DataTableModel.commitRow(bookmark) or DataModel.updateAll() to make the changes permanent, or call DataTableModel.cancelRowChanges(bookmark) or DataModel.cancelAll() to undo the changes.
DataModel.moveToRow(com.klg.jclass.datasource.DataModelListener, com.klg.jclass.datasource.DataTableModel, long)
,
DataTableModel.getRowStatus(long)
,
DataTableModel.commitRow(com.klg.jclass.datasource.DataModelListener, long)
,
DataModel.updateAll(com.klg.jclass.datasource.DataModelListener)
,
DataModel.cancelAll(com.klg.jclass.datasource.DataModelListener)
Field Summary | |
static int |
COMMIT_LEAVING_ANCESTOR
Automatically save changes to originating data source when the new bookmark is not in the same subtree as the previous bookmark. |
static int |
COMMIT_LEAVING_RECORD
Automatically save changes to originating data source when cursor bookmark changes |
static int |
COMMIT_MANUALLY
No automatic commit. |
static int |
TYPE_BIG_DECIMAL
|
static int |
TYPE_BOOLEAN
Java data types used to map JDBC data types |
static int |
TYPE_BYTE
|
static int |
TYPE_BYTE_ARRAY
|
static int |
TYPE_DOUBLE
|
static int |
TYPE_FLOAT
|
static int |
TYPE_INTEGER
|
static int |
TYPE_LONG
|
static int |
TYPE_OBJECT
|
static int |
TYPE_SHORT
|
static int |
TYPE_SQL_DATE
|
static int |
TYPE_SQL_TIME
|
static int |
TYPE_SQL_TIMESTAMP
|
static int |
TYPE_STRING
|
static int |
TYPE_UTIL_DATE
|
Method Summary | |
void |
addColumn(com.klg.jclass.datasource.ColumnModel column)
Add a column to the list of column objects. |
void |
clear()
Change the query for this data control. |
void |
commitTransaction()
Commits transaction. |
boolean |
getAutoCommit()
Returns true if the transaction capabilities of the underlying data source should be used when saving modifications (transactions are supported and enabled). |
com.klg.jclass.datasource.BindingModel |
getBinding()
Return the Binding object associated with this MetaData level. |
boolean |
getCacheChildren()
Returns a boolean flag indicating whether subtrees of DataTables rooted at this level are eligible for deletion. |
int |
getColumnCount()
Returns the number of columns in this result set |
String |
getColumnIdentifier(int column_index)
Returns a string which uniquely identifies this column. |
int |
getColumnIndex(String name)
Given a column name, gets its index. |
com.klg.jclass.datasource.ColumnModel |
getColumnObject(String column_identifier)
Returns the ColumnModel for the given column. |
Vector |
getColumnObjects()
Returns the list of ColumnModel objects. |
int |
getCommitPolicy()
Returns the commit policy for this level. |
long |
getCurrentBookmark()
Returns the bookmark of the row currently in focus. |
com.klg.jclass.datasource.DataTableModel |
getCurrentDataTable()
Returns the data table which currently has focus. |
com.klg.jclass.datasource.DataModel |
getDataModel()
Return the DataModel which encapsulates this MetaDataModel. |
boolean |
getDeleteAllowed(String table)
Returns true if this table can be deleted, false otherwise. |
String |
getDescription()
Returns the user-assigned description of this instance, or "" if the description has not been set. |
boolean |
getInsertAllowed(String table)
Returns true if this table can be inserted into, false otherwise. |
int |
getJavaColumnType(String column_identifier)
Returns the Java Object type for a column as an enum. |
int |
getMaxRows()
Returns the maximum number of rows which can be returned by a query. |
int |
getMetaID()
Returns an int which uniquely identifies this instance of the MetaDataModel. |
Object |
getNativeMetaData()
Returns the native meta data object. |
com.klg.jclass.datasource.ProviderModel |
getProvider()
Get the provider (if any) for this level. |
boolean |
getShowDeletedRows()
Show logically deleted rows? |
Class |
getStoreClass()
Returns the class responsible for data storage and retrieval (implements StoreModel). |
boolean |
getUpdateAllowed(String table)
Returns true if this table can be updated. |
boolean |
isUpdateAllowedOnColumn(String column)
Do permissions on the model allow this column to be editied? |
void |
rollbackTransaction()
Rolls back the transaction. |
void |
setAutoCommit(boolean value)
Sets the auto commit flag. |
void |
setBinding(com.klg.jclass.datasource.BindingModel binding)
Set the Binding object associated with this MetaData level. |
void |
setCacheChildren(boolean cacheChildren)
Sets a boolean indicating whether subtrees of DataTables rooted at this level are eligible for deletion. |
void |
setCommitPolicy(int commit_policy)
Sets the commit policy for this level. |
void |
setCurrentBookmark(long currentBookmark)
|
void |
setCurrentDataTable(com.klg.jclass.datasource.DataTableModel currentDataTable)
|
void |
setDeleteAllowed(String table,
boolean v)
Sets a boolean indicating if rows in this table are allowed to be deleted. |
void |
setDescription(String description)
Sets the user-assigned description of this instance. |
void |
setInsertAllowed(String table,
boolean v)
Sets a boolean indicating if this table is allowed to be inserted into. |
void |
setMaxRows(int maxRows)
Sets the maximum number of rows a query at this level can return. |
void |
setMetaID(int id)
For internal use only. |
void |
setProviderClassName(String providerModelClassName)
Set the ProviderModel class name which will provide data for this level. |
void |
setShowDeletedRows(boolean value)
Indicates if logically deleted rows showld be shown. |
void |
setStoreClass(String storeClassName)
Sets an alternate class to handle data storage and retrieval responsibilities. |
void |
setUpdateAllowed(String table,
boolean v)
Sets a boolean indicating if this table is allowed to be updated. |
Methods inherited from interface javax.swing.tree.TreeNode |
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf |
Field Detail |
public static final int TYPE_BOOLEAN
public static final int TYPE_SQL_DATE
public static final int TYPE_DOUBLE
public static final int TYPE_FLOAT
public static final int TYPE_INTEGER
public static final int TYPE_STRING
public static final int TYPE_BIG_DECIMAL
public static final int TYPE_LONG
public static final int TYPE_SQL_TIME
public static final int TYPE_SQL_TIMESTAMP
public static final int TYPE_OBJECT
public static final int TYPE_BYTE
public static final int TYPE_SHORT
public static final int TYPE_BYTE_ARRAY
public static final int TYPE_UTIL_DATE
public static final int COMMIT_LEAVING_RECORD
public static final int COMMIT_LEAVING_ANCESTOR
public static final int COMMIT_MANUALLY
Method Detail |
public void clear()
public String getColumnIdentifier(int column_index) throws DataModelException
column_index
- an int indicating for which column
a unique identifier should be returned.
DataModelException
- If a column identifier cannot obtained.public int getColumnCount() throws DataModelException
DataModelException
- If getColumnCount() fails.public int getJavaColumnType(String column_identifier) throws DataModelException
column_identifier
- an String uniquely identifying a column
DataModelException
- If the Java column type cannot be found.public void setCommitPolicy(int commit_policy) throws DataModelException
When the policy is set to COMMIT_LEAVING_RECORD
(the default) modifications
to a row will be automatically written to the originating data source when
the cursor moves to any other row (see DataModel.movetoRow(..)).
In the case of delete, the row is immediately deleted.
When the policy is COMMIT_LEAVING_ANCESTOR
changes will be automatically
written to the originating data source when the cursor moves to a row which is not
in the same subtree as the current row. For example, in a master-detail relationship
where the master table is Orders and the details table is OrderDetails, the cursor
can be moved to any of the OrderDetail lines which correspond to the current
Order. As soon as the cursor is moved to a different Order or to an OrderDetail
line for a different Order, the previous edits will be automatically committed.
A policy of COMMIT_MANUALLY will never automatically commit changes. Any row changes will simply change the status of those rows (see DataTableModel.getRowStatus()). You must then call DataTableModel.commitRow(bookmark) or DataModel.updateAll() to make the changes permanent, or call DataTableModel.cancelRowChanges(bookmark) or DataModel.cancelAll() to undo the changes.
commit_policy
- an int, one of COMMIT_LEAVING_RECORD,
COMMIT_LEAVING_ANCESTOR, or COMMIT_MANUALLY
DataModelException
- If set fails.public int getCommitPolicy()
public com.klg.jclass.datasource.DataModel getDataModel()
public void setInsertAllowed(String table, boolean v)
table
- a String name of the tablepublic void setUpdateAllowed(String table, boolean v)
table
- a String name of the tablepublic void setDeleteAllowed(String table, boolean v)
table
- a String name of the tablepublic boolean getInsertAllowed(String table)
table
- a String name of the table
public boolean getUpdateAllowed(String table)
table
- a String name of the table
public boolean getDeleteAllowed(String table)
table
- a String name of the table
public int getMetaID()
setMetaID(int)
public void setMetaID(int id)
id
- an int which is the unique id for this instancegetMetaID()
public String getDescription()
public void setDescription(String description)
description
- a String which describles this instance.public boolean getAutoCommit() throws DataModelException
DataModelException
- If an error occurs getting commit flag.commitTransaction()
,
rollbackTransaction()
public void setAutoCommit(boolean value) throws DataModelException
value
- a boolean, true if transactions are to be used,
false otherwise.
DataModelException
- If an error occurs setting commit flag.public void rollbackTransaction() throws DataModelException
DataModelException
- If rollback fails.getAutoCommit()
public void commitTransaction() throws DataModelException
DataModelException
- If commit fails.public Vector getColumnObjects()
ColumnModel
public com.klg.jclass.datasource.ColumnModel getColumnObject(String column_identifier) throws DataModelException
column_identifier
- a String which uniquely identifies a column
DataModelException
- If get fails.public boolean isUpdateAllowedOnColumn(String column) throws DataModelException
DataModelException
- If the primary keys cannot be determined for
the update table.setUpdateAllowed(java.lang.String, boolean)
,
getUpdateAllowed(java.lang.String)
public void addColumn(com.klg.jclass.datasource.ColumnModel column) throws DataModelException
DataModelException
- If duplicate column found.ColumnModel
public Object getNativeMetaData()
public void setShowDeletedRows(boolean value) throws DataModelException
value
- a boolean: true to show rows, false otherwise
DataModelException
- If set fails.public boolean getShowDeletedRows()
public int getColumnIndex(String name) throws DataModelException
DataModelException
- If the operation fails.public void setMaxRows(int maxRows)
Does not apply to ide-specific implmentations. Set the max rows directly on the ide data object instead.
maxRows
- an int indicating the max rows to be returnedgetMaxRows()
public int getMaxRows()
Does not apply to ide-specific implmentations. Set the max rows directly on the ide data object instead.
setMaxRows(int)
public void setCacheChildren(boolean cacheChildren)
cacheChildren
- a boolean: true means children should be cached, false
means deleteCacheChildren should be called when a tree is collapsed.getCacheChildren()
,
DataTableModel.deleteCacheChildren(com.klg.jclass.datasource.DataModelListener)
public boolean getCacheChildren()
setCacheChildren(boolean)
,
DataTableModel.deleteCacheChildren(com.klg.jclass.datasource.DataModelListener)
public com.klg.jclass.datasource.DataTableModel getCurrentDataTable()
public long getCurrentBookmark()
public void setCurrentDataTable(com.klg.jclass.datasource.DataTableModel currentDataTable)
public void setCurrentBookmark(long currentBookmark)
public void setStoreClass(String storeClassName) throws DataModelException
If set, BaseDataTable instances will use this instances of this class rather than the default class ("Store") to store and retrieve data.
DataModelException
- If an error occurs loading the class.StoreModel
,
getStoreClass()
public Class getStoreClass() throws DataModelException
DataModelException
- If get fails.public com.klg.jclass.datasource.BindingModel getBinding()
public void setBinding(com.klg.jclass.datasource.BindingModel binding)
public com.klg.jclass.datasource.ProviderModel getProvider()
ProviderModel.getData(com.klg.jclass.datasource.DataModelListener, long, com.klg.jclass.datasource.MetaDataModel)
,
DataTableModel.createTable(com.klg.jclass.datasource.DataModelListener, long, javax.swing.tree.TreeNode)
,
DataTableModel.getTable(long, javax.swing.tree.TreeNode)
public void setProviderClassName(String providerModelClassName) throws DataModelException
DataModelException
- if the provider fails
to be instantiated.
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |