Ontimize 5.2072EN

com.ontimize.db
Class DefaultTableEntity

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.DefaultTableEntity
All Implemented Interfaces:
AdvancedEntity, AdvancedQueryEntity, Entity, EntityDataChangeNotifier, FileManagementEntity, IdentifiedEntity, PrivilegedSecurityEntity, java.rmi.Remote, SecureEntity, java.io.Serializable, TransactionalEntity
Direct Known Subclasses:
DefaultNoticeDestinyEntity, NoticeEntity, StandardAttachmentEntity

public class DefaultTableEntity
extends TableEntity

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.ontimize.db.TableEntity
TableEntity.AttachmentReceiving, TableEntity.Receiving
 
Field Summary
protected  java.lang.String props
           
 
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
DefaultTableEntity(EntityReferenceLocator locator, DatabaseConnectionManager dbConnectionManager, int port, java.util.Properties prop, java.util.Properties aliasProp)
           
DefaultTableEntity(EntityReferenceLocator locator, DatabaseConnectionManager dbManager, int port, java.lang.String properties)
           
 
Method Summary
protected  java.lang.String getExtendedAliasPropertiesName()
          Gets the extended alias property file path.
protected  java.lang.String getExtendedPropertiesName()
          Gets the extended property file path.
 void loadAliasFile()
          Loads the alias properties.
 void readProperties()
          Loads the properties file for this entity.
 void setName(java.lang.String name)
           
 
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, 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, getExtension, getName, getOrderColumns, getPrivilegedId, getPropertiesPath, getQueryRecordNumber, getQueryTable, getSize, getSQLTypesFromMetaData, getStringsOn, getSubGroupValues, getSubGroupValues, getTable, getUpdateColumns, getUser, getValidAttributes, getValidDeletingKeysValues, getValidInsertingAttributesValues, getValidQueryingKeysValues, getValidUpdatingAttributesValues, getValidUpdatingKeysValues, getWildCardColumns, insert, insert, insertAutonumericalAlias, isBinaryType, 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, query, queryOtherEntities, readProperties, readProperties, registerAttributeDispatcher, reloadScripts, removeEntityDataChangeListener, replaceAliasByColumn, replaceAliasByColumn, replaceAliasByColumn, replaceAliasByColumn, replaceAliasByColumn, replaceColumnByAlias, replaceColumnByAlias, replaceColumnByAlias, replaceColumnByAlias, replaceColumnByAliasKeepColumns, resultSetToEntityResult, resultSetToEntityResult, resultSetToEntityResult, setLimitQueryOthersEntities, setObject, setObject, setPrivilegedId, toVectorOfBooleans, truncateDataToHour_00_00_00, truncateDateToMinutes, update, 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

props

protected java.lang.String props
Constructor Detail

DefaultTableEntity

public DefaultTableEntity(EntityReferenceLocator locator,
                          DatabaseConnectionManager dbManager,
                          int port,
                          java.lang.String properties)
                   throws java.lang.Exception

DefaultTableEntity

public DefaultTableEntity(EntityReferenceLocator locator,
                          DatabaseConnectionManager dbConnectionManager,
                          int port,
                          java.util.Properties prop,
                          java.util.Properties aliasProp)
                   throws java.lang.Exception
Method Detail

readProperties

public void readProperties()
                    throws java.lang.Exception
Description copied from class: TableEntity
Loads the properties file for this entity.
By default, the properties file name must be located in propertiesPath (by default 'prop') relative to this entity's class file, and named entityName.properties.

All the names specified in this file are considered database table columns, that is, should match exactly (case-sensitive) the columns of the database table/view.

The following table shows the parameters that can be defined in the properties file. For all parameters that define a list, the ';' character is used as separator.

Parameter Meaning Required
Table The database table name that this entity uses for query, insert, update, delete operations yes
QueryTable The database table or view name that this entity uses for query operations no
Columns Columns of the table specified in table parameter. Tipically it should be exactly all the table columns, but this is not strictly neccessary. These colums can be used in query, update, delete and insert operations (unless insert_columns parameter is defined) yes
InsertColumns Columns allowed in insert, update, delete operations. If not defined, columns is used instead no
Keys Columns that make the primary key for this entity. Usually matches the table primary key. yes
InsertKeys Columns required (non null) in insert operations. no
UpdateKeys Columns required in keysvalues (update method parameter). These columns, and only these, will be used in the WHERE clause of UPDATE SQL sentences. If not specified, keys is used. no
DeleteKeys Columns required in keysvalues (delete method parameter). These columns, and only these, will be used in the WHERE clause of DELETE SQL sentences. If not specified, keys is used.
UpdateColumns Columns that can be modified by update operations, calling update method. If not specified, no columns can be modified. no
Autonumerical Column that stores an integer generated by Autonumerical object when insert operations are performed. This column should never be specified in insert_keys parameter as is not provided to the method insert
but is generated internally in the method.
no
WildcardColumns Columns in whick special search characters are allowed for LIKE queries. If not specified, all columns are allowed. no
OtherEntities Entities (by name) that will be queried for data related with records of this entity, when specified in attribute list. If not specified, all entities will be queried. no
LimitQueryOtherEntities If there are multiple results for this entity, and other entity data is asked, then this entity will limit the number of records for which other entities are queried to this parameter. By default this value is 100 no
Sort List of column names to use in the ORDER BY clause, in the same order as they appear in this parameter. Since 5.2056EN-0.2, for specifying ascendant (ASC) and descendant (DESC) order individually for each column is accepted the syntax:
ASC[col1];DESC[col2];...;ASC[coln]
no
SortDesc Deprecated since 5.2056EN-0.2 (See Sort). List of column names to use in the ORDER BY DESC clause, in the same order as they appear in this parameter. If sort and sort_desc are specified, sort is used no
FetchSize The JDBC statement fetch size. By default this value is 0 no
LogKeys Specifies the keys for logging in this entity. These keys will be used for calling LogManager.getLogWriter(key) and then use resulting LogWriter for logging update, query, insert and delete operations no
FileColumns Specifies a list of columns for storing filename and file contents pairs, that this entity receives as com.ontimize.gui.DataFile objects.
This parameter is specified as a list of: attribute associated to file+':'+filename column+':'+file contents column, for each file to be stored.
e.g, your form contains two FileDataField with attr file1 and file2 and columns in database to store content for these ones are filecolumn1 and filecolumn2 and columns to store names are filenamecolumn1 and filenamecolumn2. So, configuration for this parameter would be:
FileColumns=file1:filenamecolumn1:filecolumn1;file2:filenamecolumn2:filecolumn2
no
ForceDistinct If this parameter is 'yes', then a DISTINCT keyword will be used in all queries performed by this entity. By default this value is 'no' no
TruncateDates If this value is 'yes' then the java.util.Date values will be set to 00:00:00 before being set in the statements. By default this value is 'no'. Default value can be configured with TRUNCATE_DATE_DEFAULT_VALUE field no
AttachmentFilePath Path in the file system in which the attached files for this entity will be stored. If this parameter is specified, then the parameter 'AttachmentFileNameColumn' also must be specified no
AttachmentFileNameColumn Column that stores the name of attached files. Must be String type. no
AttachmentFileOriginalNameColumn Column that stores original file names for attachments. no
AttachmentFileOriginalPathColumn Column that stores original file location (path) for attachments. This parameter is useful for custom code in the client no
AttachmentFileDescriptionColumn Column that stores optional attachment description. no
InsertAutomaticallyAttachment Defines if attachment records are inserted automatically. If false, a value for each key of this entity is required in the keysValues argument when calling to prepareToReceive method. These values will be used in the insert operation that is done in this method. Defined in 'InsertAutomaticallyAttachment' parameter. Default is false. no
AttachmentFileNameKeys Defines which column values are used when generating filenames for attachments, by calling getAttachmentFileNameForKeys() method. If this parameter is not specified, the columns defined in 'keys' are used. no
AttachmentFileSizeColumn Defines which column of the table is used for storing the attachment file size in bytes. Optional. no
TableAttributeEntities List of entity names for which the TableAttribute information (keys, attributes, ...) will be used when this entity queries another entities.

If an entity name is in this list, the columns of this entity defined as parentkeys in the TableAttribute, will be passed to the queried entity as filters.

no
Autoconfiguration If this parameter value is 'yes' then the configuration for this entity is automatically generated using the database metadata. Using this method, only a basic configuration can be obtained, and if possible, a properties file will be generated. no

When using attachments, the following basic actions must be granted for this entity:

Also, it is possible to define specific error messages for this entity when SQLExceptions ocurr. This can be done defining properties with the following format:
err_nnnn=error_message where nnnn is the SQLState associated with the exception. This method calls TableEntity.readProperties(String) with the standard location for this entity's properties file.

Overrides:
readProperties in class TableEntity
Throws:
java.lang.Exception

loadAliasFile

public void loadAliasFile()
Description copied from class: TableEntity
Loads the alias properties. By default, the alias properties file name is 'entityname'+'_alias.properties' and should be located on the same codebase as the properties file

Overrides:
loadAliasFile in class TableEntity

getExtendedAliasPropertiesName

protected java.lang.String getExtendedAliasPropertiesName()
Description copied from class: TableEntity
Gets the extended alias property file path. The extended alias property file must be in the same path that the alis property file.

Overrides:
getExtendedAliasPropertiesName in class TableEntity
Returns:
String with the file path.

getExtendedPropertiesName

protected java.lang.String getExtendedPropertiesName()
Description copied from class: TableEntity
Gets the extended property file path. The extended property file must be in the same path that the entity property file.

Overrides:
getExtendedPropertiesName in class TableEntity
Returns:
String with the file path.

setName

public void setName(java.lang.String name)
Specified by:
setName in interface IdentifiedEntity
Overrides:
setName in class TableEntity

Ontimize