Ontimize 5.2072EN

com.ontimize.db
Class CacheTableEntity

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended bycom.ontimize.db.TableEntity
                  extended bycom.ontimize.db.CacheTableEntity
All Implemented Interfaces:
AdvancedEntity, AdvancedQueryEntity, Entity, EntityDataChangeNotifier, FileManagementEntity, IdentifiedEntity, PrivilegedSecurityEntity, java.rmi.Remote, SecureEntity, java.io.Serializable, TransactionalEntity

public abstract class CacheTableEntity
extends TableEntity

Implementation for an entity with cache. By the moment the query method not accept SearchValue.

Title:

Description:

Copyright: Copyright (c) 2003

Company:

Version:
1.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.ontimize.db.TableEntity
TableEntity.AttachmentReceiving, TableEntity.Receiving
 
Field Summary
protected  EntityResult data
           
 
Fields inherited from class com.ontimize.db.TableEntity
alias, aliasPropertiesParser, aliasReverse, ASTERISK, ATTACHMENT_FILE_DESCRIPTION_COLUMN, ATTACHMENT_FILE_NAME_COLUMN, ATTACHMENT_FILE_NAME_KEYS, ATTACHMENT_FILE_ORIGINAL_NAME_COLUMN, ATTACHMENT_FILE_ORIGINAL_PATH_COLUMN, ATTACHMENT_FILE_PATH, ATTACHMENT_FILE_SIZE_COLUMN, ATTACHMENT_SEPARATOR, ATTACHMENT_TABLE, attachmentFileNameColumn, attachmentFileNameKeys, attachmentFilePath, attachmentFileSizeColumn, attachTable, AUTOCONFIGURATION, AUTONUMERICAL, autonumericalColumn, calendar, checkOperationResult, columnNames, COLUMNS, connectionRequestTime, dataChangeListeners, dBLocalErrorMessage, DEBUG, DEBUG_DETAILS, DEBUG_TIMES, DEFAULT_MAX_CONNECTION_WAIT_TIME, defaultEntityScriptManagerClassName, DELETE_ACTION, DELETE_KEYS, deleteKeys, descendantColumnsOrder, descriptionAttachmentFileColumn, enableScripting, entitiesPropertiesParser, entitiesTableAttribute, entityName, entityScripting, FETCH_SIZE, fetchSize, FILE_COLUMNS, fileInfoList, FORCE_DISTINCT, forceDistinct, INSERT_ACTION, INSERT_AUTOMATICLY_ATTACHMENT, INSERT_COLUMNS, INSERT_KEYS, insertAttachmentAutomatically, insertColumn, insertKeys, INTERROG, keys, KEYS, LIMIT_QUERY_OTHERS_ENTITIES, limitQueryOthersEntities, locator, LOG_KEYS, logDelete, logInsert, logkeys, logQuery, logUpdate, M_ERROR_OPERATION, M_IT_HAS_NOT_CHANGED_ANY_RECORD, M_LICENSE_PERMISSION_ERROR, M_TEMPORALY_RESTRICTED_BY_PERMISSION_ACTION, M_YOU_DO_NOT_HAVE_PERMISSION_TO_EXECUTE_ACTION, manager, maxConnectionWaitTime, oneToOneMode, orderColumns, originalAttachmentFileNameColumn, originalAttachmentFilePathColumn, OTHER_ENTITIES, othersEntities, PERCENT, PRINCIPAL_COLUMNS, PRINCIPAL_KEYS, PRINCIPAL_TABLE, principalColumnNames, principalKeyName, principalTable, privilegedId, properties, propertiesPath, QUERY_ACTION, QUERY_TABLE, queryTable, receivedAttachmentFile, receivedTempFiles, RECORD_OPERATIONS, registeredDispatcher, REPORT_ADVANCED_QUERY_COLUMNS, REPORT_ADVANCED_QUERY_TYPES, reportAvancedQueryColumns, reportAvancedQueryTypes, SECONDARY_COLUMNS, SECONDARY_KEYS, SECONDARY_TABLE, secondaryColumnsNames, secondaryKeyName, secondaryTable, sendAttachmentFile, SORT, SORT_DESC, table, TABLE, TABLE_ATTRIBUTE_ENTITIES, tempFiles, TIME_BETWEEN_DEFAULT_CONNECTION_REQUEST, TRUNCATE_DATE_DEFAULT_VALUE, TRUNCATE_DATES, truncateDates, UNDERSCORE, UPDATE_ACTION, UPDATE_COLUMNS, UPDATE_KEYS, updateColumn, updateKeys, USE_SETSTRING_LONG_STRINGS, useAlwaysTableAttributeEntities, WILDCARD_COLUMNS, wildcardColumns
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
CacheTableEntity(EntityReferenceLocator referenceLocator, DatabaseConnectionManager connectionManager, int port)
           
 
Method Summary
protected abstract  void dataDeleted(java.util.Hashtable kv)
           
protected abstract  void dataInserted(java.util.Hashtable av)
           
protected abstract  void dataUpdated(java.util.Hashtable kv)
           
 EntityResult delete(java.util.Hashtable keys, int sessionId)
          This method must implement a standard delete operation over the set of records defined by keysValues.
protected  void initData()
           
 EntityResult insert(java.util.Hashtable values, int sessionId)
          This method implements a standard database insert operation with the data contained in attributesValues parameter.
 EntityResult query(java.util.Hashtable keysValues, java.util.Vector attributes, int sessionId)
          This method implements a standard query operation returning the set of data that matches the conditions specified by the keysValues parameter.
 AdvancedEntityResult query(java.util.Hashtable keysValues, java.util.Vector attributes, int currentIndex, int number, java.lang.String orderBy, int sessionId)
           
 EntityResult update(java.util.Hashtable values, java.util.Hashtable keys, int sessionId)
          This method implements a standard update operation with the data specified in attributesValues over the set of records defined by keysValues.
 
Methods inherited from class com.ontimize.db.TableEntity
addEntityDataChangeListener, buildConditionsString, cancelReceiving, checkDeleteKeys, checkFinishedSession, checkInsertKeys, checkOrderColumns, checkPermissions, checkUpdateKeys, configureReverseAlias, connect, connect, createAdvancedEntityResultForSessionId, createAdvancedEntityResultForSessionId, createEntityResultForSessionId, createEntityResultForSessionId, createEntityResultForSessionId, createEntityResultForSessionId, createEntityResultForSessionId, createEntityScriptManager, delete, deleteAttachmentFile, deleteAttachmentFile, deleteMultipleTableAttributesColumns, disconnect, disconnect, dispatcherAttribute, executePreparedStatement, executePreparedStatement, executePreparedStatement, executePreparedStatement, executePreparedStatement, executePreparedStatement, executePreparedStatement, executeStatement, finishReceiving, fireDataChangeEvent, fireDataChangeEvent, fireTransactionDataChangeEvent, fireTransactionDataChangeEvent, generateRandomId, getActions, getAliasForColumn, getAttachmentFileNameForKeys, getAttachmentFilePath, getAttachmentFilePath, getAutonumericalColumn, getBytes, getColumnForAlias, getColumnListForAvancedQuery, getColumns, getDatabaseConnectionManager, getDescOrderColumns, getDescription, getEntityPrivilegedId, getEntityReference, getErrorMessage, getExtendedAliasPropertiesName, getExtendedPropertiesName, getExtension, getName, getOrderColumns, getPrivilegedId, getPropertiesPath, getQueryRecordNumber, getQueryTable, getSize, getSQLTypesFromMetaData, getStringsOn, getSubGroupValues, getSubGroupValues, getTable, getUpdateColumns, getUser, getValidAttributes, getValidDeletingKeysValues, getValidInsertingAttributesValues, getValidQueryingKeysValues, getValidUpdatingAttributesValues, getValidUpdatingKeysValues, getWildCardColumns, insert, insertAutonumericalAlias, isBinaryType, loadAliasFile, loadAliasFile, logToLogKeys, logUpdate, parseStringValue, performExtendedAliasProperties, performExtendedProperties, postDelete, postInsert, postUpdate, preDelete, preInsert, prepareToReceive, prepareToReceive, prepareToReceive, prepareToTransfer, prepareToTransfer, preUpdate, processFileColumnsAttributes, processFileColumnsAttributes, processFileResults, processingMultipleValueAttributes, processingReferenceDataFieldAttributes, processingReferenceDataFieldAttributes, processMultipleAttributeKey, processMultipleTableAttribute, processMultipleTableAttribute, putBytes, query, query, query, query, queryOtherEntities, readProperties, readProperties, readProperties, registerAttributeDispatcher, reloadScripts, removeEntityDataChangeListener, replaceAliasByColumn, replaceAliasByColumn, replaceAliasByColumn, replaceAliasByColumn, replaceAliasByColumn, replaceColumnByAlias, replaceColumnByAlias, replaceColumnByAlias, replaceColumnByAlias, replaceColumnByAliasKeepColumns, resultSetToEntityResult, resultSetToEntityResult, resultSetToEntityResult, setLimitQueryOthersEntities, setName, setObject, setObject, setPrivilegedId, toVectorOfBooleans, truncateDataToHour_00_00_00, truncateDateToMinutes, update, updateAttachmentValues, vectorToStringSeparateBySemicolon
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected EntityResult data
Constructor Detail

CacheTableEntity

public CacheTableEntity(EntityReferenceLocator referenceLocator,
                        DatabaseConnectionManager connectionManager,
                        int port)
                 throws java.lang.Exception
Method Detail

initData

protected void initData()

query

public AdvancedEntityResult query(java.util.Hashtable keysValues,
                                  java.util.Vector attributes,
                                  int currentIndex,
                                  int number,
                                  java.lang.String orderBy,
                                  int sessionId)
                           throws java.lang.Exception
Throws:
java.lang.Exception

query

public EntityResult query(java.util.Hashtable keysValues,
                          java.util.Vector attributes,
                          int sessionId)
                   throws java.lang.Exception
Description copied from class: TableEntity
This method implements a standard query operation returning the set of data that matches the conditions specified by the keysValues parameter. The attributes defines which attributes (or columns if data is obtained from a database) must be recovered, and keysValues specifies which set of records must be recovered.

This entity maps a table in the database, so all the hashtable keys must correspond to table columns, generally using column names as strings, but also other objects are processed.

This method ask for a connection and calls the following methods:

Then, if the result returned by query has no error, the TableEntity.queryOtherEntities(Vector , EntityResult , int ) method is called.
After that, this entity logs the operation if logQuery is true.
If an SQLException is thrown, the TableEntity.getErrorMessage(SQLException) method is called and the resulting messsage is set as the message in the EntityResult returned by this entity.

The result returned by TableEntity.query(Hashtable , Vector , int , Connection) method is returned by this method if no error ocurrs.

Specified by:
query in interface Entity
Overrides:
query in class TableEntity
Parameters:
keysValues - a Hashtable specifying conditions that must comply the set of records returned. Cannot be null.
attributes - a list of columns that must be recovered for each record returned. Cannot be null. If empty, all attributes will be returned.
sessionId - a integer identifying the user or session that performs the action.
Returns:
a EntityResult with the resulting set of data. This result can be empty if no results exist, and if an error has occurred this will be indicated in the result.
Throws:
java.lang.Exception - if any non handled exception occurs
See Also:
TableEntity.query(Hashtable, Vector, int, Connection)

insert

public EntityResult insert(java.util.Hashtable values,
                           int sessionId)
                    throws java.lang.Exception
Description copied from class: TableEntity
This method implements a standard database insert operation with the data contained in attributesValues parameter.

This entity maps a table in the database, so all the hashtable keys must correspond to table columns, generally using column names as strings, but also other objects are processed.

This method ask for a connection, set autocommit to false, so operations are processed in a transaction, and calls the following methods:

After this, commit is executed and if no error is produced a DataChangeEvent.INSERT_EVENT is thrown.
Also, if logInsert is true the operation is logged.

If an SQLException is thrown, the TableEntity.getErrorMessage(SQLException) method is called and the resulting message is set as the message in the EntityResult returned by this entity.

The result returned by TableEntity.insert(Hashtable , int , Connection) method is returned by this method if no error occurs.

If an autonumerical is defined for this entity and no error occurs, the value used in the insert operation is returned in the result as a pair or key-value where key is the column name, and value is the value used in the insert operation.

Specified by:
insert in interface Entity
Overrides:
insert in class TableEntity
Parameters:
values - a Hashtable specifying pairs of key-value corresponding to the attribute (or column of a table in a database) and the value that must be stored.
sessionId - a integer identifying the user or session that performs the action.
Returns:
an EntityResult with the operation result code and optional error message
Throws:
java.lang.Exception
See Also:
TableEntity.insert(Hashtable , int , Connection)

update

public EntityResult update(java.util.Hashtable values,
                           java.util.Hashtable keys,
                           int sessionId)
                    throws java.lang.Exception
Description copied from class: TableEntity
This method implements a standard update operation with the data specified in attributesValues over the set of records defined by keysValues. So, only the records that comply with the conditions specified by keysValues will be updated to the new values specified by attributesValues.

This entity maps a table in the database, so all the hashtable keys must correspond to table columns, generally using column names as strings, but also other objects are processed.

This method ask for a connection, set autocommit to false, so operations are processed in a transaction, and calls the following methods:

After this, commit is executed and if no error is produced a DataChangeEvent.UPDATE_EVENT is thrown.
Also, if logInsert is true the operation is logged.

If an SQLException is thrown, the TableEntity.getErrorMessage(SQLException) method is called and the resulting message is set as the message in the EntityResult returned by this entity.

Specified by:
update in interface Entity
Overrides:
update in class TableEntity
Parameters:
values - the data for updating the records to. The keys specify the attributes (or columns) and the values, the values for these columns.
keys - the conditions that the records to be updated must fulfill. The keys specify the attributes (or columns) and the values, the values for these columns.
sessionId - a integer identifying the user or session that performs the action.
Returns:
a EntityResult. This result will have an error code if error has occurred.
Throws:
java.lang.Exception - if any exception occurs
See Also:
TableEntity.update(Hashtable, Hashtable , int , Connection)

delete

public EntityResult delete(java.util.Hashtable keys,
                           int sessionId)
                    throws java.lang.Exception
Description copied from class: TableEntity
This method must implement a standard delete operation over the set of records defined by keysValues. So, only the records that comply with the conditions specified by keysValues will be deleted.

This entity maps a table in the database, so all the hashtable keys must correspond to table columns, generally using column names as strings, but also other objects are processed.

This method ask for a connection, set autocommit to false, so operations are processed in a transaction, and calls the following methods:

After this, commit is executed and if no error is produced a DataChangeEvent.DELETE_EVENT is thrown.
Also, if logInsert is true the operation is logged.

If an SQLException is thrown, the TableEntity.getErrorMessage(SQLException) method is called and the resulting message is set as the message in the EntityResult returned by this entity.

Specified by:
delete in interface Entity
Overrides:
delete in class TableEntity
Parameters:
keys - the conditions that the records to be deleted must fulfill. The keys specify the attributes (or columns) and the values, the values for these columns.
sessionId - a integer identifying the user or session that performs the action.
Returns:
a EntityResult. This result will have an error code if error has occurred.
Throws:
java.lang.Exception - if any exception occurs
See Also:
TableEntity.delete(Hashtable, int , Connection)

dataDeleted

protected abstract void dataDeleted(java.util.Hashtable kv)

dataUpdated

protected abstract void dataUpdated(java.util.Hashtable kv)

dataInserted

protected abstract void dataInserted(java.util.Hashtable av)

Ontimize