|
Ontimize 5.2072EN | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
com.ontimize.db.TableEntity
Abstract class that implements an Entity that represents a
database table.
This class provides basic functionalities and configuration parameters for automating database tables mapping.
readProperties(),
Entity,
Serialized Form| Nested Class Summary | |
protected class |
TableEntity.AttachmentReceiving
Object of this class are used internally for storing information for current transfers (attachments). |
protected class |
TableEntity.Receiving
Object of this class are used internally for storing information for current transfers (attachments). |
| Field Summary | |
protected java.util.Properties |
alias
Alias properties for this entity, if defined. |
protected static AliasPropertiesParser |
aliasPropertiesParser
|
protected java.util.Hashtable |
aliasReverse
Reverse Alias properties for this entity, if defined. |
static char |
ASTERISK
The '*' character. |
static java.lang.String |
ATTACHMENT_FILE_DESCRIPTION_COLUMN
AttachmentFileDescriptionColumn property. |
static java.lang.String |
ATTACHMENT_FILE_NAME_COLUMN
AttachmentFileNameColumn property. |
static java.lang.String |
ATTACHMENT_FILE_NAME_KEYS
AttachmentFileNameKeys property. |
static java.lang.String |
ATTACHMENT_FILE_ORIGINAL_NAME_COLUMN
AttachmentFileOriginalNameColumn property. |
static java.lang.String |
ATTACHMENT_FILE_ORIGINAL_PATH_COLUMN
AttachmentFileOriginalPathColumn property. |
static java.lang.String |
ATTACHMENT_FILE_PATH
AttachmentFilePath property. |
static java.lang.String |
ATTACHMENT_FILE_SIZE_COLUMN
AttachmentFileSizeColumn property. |
static java.lang.String |
ATTACHMENT_SEPARATOR
Character used for joining the keys while generating names for attachments in this entity. |
static java.lang.String |
ATTACHMENT_TABLE
AttachmentTable property. |
protected java.lang.String |
attachmentFileNameColumn
Column in the database table for storing the attachment filename. |
protected java.util.Vector |
attachmentFileNameKeys
Defines which column values are used when generating filenames for attachments, by calling getAttachmentFileNameForKeys()
method. |
protected java.lang.String |
attachmentFilePath
Path in the file system in which the attached files for this entity will be stored. |
protected java.lang.String |
attachmentFileSizeColumn
Defines which column in the table will store the file size. |
protected java.lang.String |
attachTable
Table name, used for query StandardAttachmentEntity to classify attachments by 'table name'+'table keys'. |
static java.lang.String |
AUTOCONFIGURATION
Autoconfiguration property. |
static java.lang.String |
AUTONUMERICAL
Autonumerical property. |
protected java.lang.String |
autonumericalColumn
Column in which numbers provided by Autonumerical object will be inserted in insert operations. |
protected static java.util.Calendar |
calendar
Calendar object used internally. |
static boolean |
checkOperationResult
|
protected java.util.Vector |
columnNames
List of columns defined by 'Columns' parameter. |
static java.lang.String |
COLUMNS
Columns property. |
protected int |
connectionRequestTime
Time between connection requests. |
protected java.util.Vector |
dataChangeListeners
Contains registered DataChangeListeners. |
protected DBLocalErrorMessages |
dBLocalErrorMessage
Used for customizing this entity's error messages. |
static boolean |
DEBUG
Debugging purposes variable. |
static boolean |
DEBUG_DETAILS
More debugging information. |
static boolean |
DEBUG_TIMES
Debugging times variable. |
static int |
DEFAULT_MAX_CONNECTION_WAIT_TIME
Default connection request timeout. |
static java.lang.String |
defaultEntityScriptManagerClassName
|
static java.lang.String |
DELETE_ACTION
Key string used for checking action permissions for delete operations. |
static java.lang.String |
DELETE_KEYS
DeleteKeys property. |
protected java.util.Vector |
deleteKeys
List of columns required as Keys-Values to perform delete operations. |
protected java.util.Vector |
descendantColumnsOrder
Columns used for specifying 'ORDER BY' SQL clause. |
protected java.lang.String |
descriptionAttachmentFileColumn
Column in the database table for storing the attachment user description. |
static boolean |
enableScripting
|
protected static EntitiesPropertiesParser |
entitiesPropertiesParser
|
protected java.util.Vector |
entitiesTableAttribute
List of entity names for which the TableAttribute information (keys, attributes, ...) will be used when this entity queries another entities. |
protected java.lang.String |
entityName
This entity name. |
protected IEntityScriptManager |
entityScripting
|
static java.lang.String |
FETCH_SIZE
FetchSize property. |
protected int |
fetchSize
Defines the JDBC statement fetch size. |
static java.lang.String |
FILE_COLUMNS
FileColumns property. |
protected com.ontimize.db.TableEntity.FileInfoList |
fileInfoList
List of FileInfo objects as defined by the 'file_columns' parameter. |
static java.lang.String |
FORCE_DISTINCT
ForceDistinct property. |
protected boolean |
forceDistinct
If true, a DISTINCT keyword will be added to all queries performed by this entity. |
static java.lang.String |
INSERT_ACTION
Key string used for checking action permissions for insert operations. |
static java.lang.String |
INSERT_AUTOMATICLY_ATTACHMENT
InsertAutomaticlyAttachment property. |
static java.lang.String |
INSERT_COLUMNS
InsertColumns property. |
static java.lang.String |
INSERT_KEYS
InsertKeys property. |
protected boolean |
insertAttachmentAutomatically
Defines if attachment records are inserted automatically. |
protected java.util.Vector |
insertColumn
List of columns valid insert operations. |
protected java.util.Vector |
insertKeys
List of columns required (not null) to perform insert operations. |
static char |
INTERROG
The '?' |
protected java.util.Vector |
keys
List of columns that define the primary key for this entity. |
static java.lang.String |
KEYS
Keys property. |
static java.lang.String |
LIMIT_QUERY_OTHERS_ENTITIES
LimitQueryOtherEntities property. |
protected int |
limitQueryOthersEntities
Maximum number of results of queries in this entity, for which related entities will be queried. |
protected EntityReferenceLocator |
locator
The EntityReferenceLocator for this entity. |
static java.lang.String |
LOG_KEYS
LogKeys property. |
protected boolean |
logDelete
Defines if delete operations will be logged using the default LogWriter, if defined, or log writers specified by 'log_keys'. |
protected boolean |
logInsert
Defines if insert operations will be logged using the default LogWriter, if defined, or log writers specified by 'log_keys'. |
protected java.util.Vector |
logkeys
String keys for logging in this entity. |
protected boolean |
logQuery
Defines if query operations will be logged using the default LogWriter, if defined, or log writers specified by 'log_keys'. |
protected boolean |
logUpdate
Defines if update operations will be logged using the default LogWriter, if defined, or log writers specified by 'log_keys'. |
static java.lang.String |
M_ERROR_OPERATION
Operation error messsage key. |
static java.lang.String |
M_IT_HAS_NOT_CHANGED_ANY_RECORD
No records changed message key. |
static java.lang.String |
M_LICENSE_PERMISSION_ERROR
License permission error mesage key. |
static java.lang.String |
M_TEMPORALY_RESTRICTED_BY_PERMISSION_ACTION
Operation restricted by time constraints message key. |
static java.lang.String |
M_YOU_DO_NOT_HAVE_PERMISSION_TO_EXECUTE_ACTION
User has not rights to perfom action message key. |
protected DatabaseConnectionManager |
manager
The DatabaseConnectionManager object, which provides DatabaseConnections to this entity. |
protected int |
maxConnectionWaitTime
Maximum connection request waiting time. |
protected boolean |
oneToOneMode
This mode is activated when the Entity models a 1-1 relation (One to One). |
protected java.util.Vector |
orderColumns
Columns used for specifying 'ORDER BY' SQL clause. |
protected java.lang.String |
originalAttachmentFileNameColumn
Column in the database table for storing the attachment original filename. |
protected java.lang.String |
originalAttachmentFilePathColumn
Column in the database table for storing the attachment original file path. |
static java.lang.String |
OTHER_ENTITIES
OtherEntities property. |
protected java.util.Vector |
othersEntities
Entities (by name) that will be queried for data related with records of this entity, when specified in attribute list. |
static char |
PERCENT
The '%' character. |
static java.lang.String |
PRINCIPAL_COLUMNS
principal_columns property. |
static java.lang.String |
PRINCIPAL_KEYS
principal_keys property. |
static java.lang.String |
PRINCIPAL_TABLE
principal_table property. |
protected java.util.Vector |
principalColumnNames
Column list for principal table when one2one mode is enabled. |
protected java.util.Vector |
principalKeyName
Columns that make the primary key for this entity's principal table. |
protected java.lang.String |
principalTable
principal table when one2one mode is enabled. |
protected int |
privilegedId
Privileged Id used for performing operations without checking permissions. |
protected java.util.Properties |
properties
Object for storing the properties of this entity. |
protected static java.lang.String |
propertiesPath
Default path used for looking properties file for this entity. |
static java.lang.String |
QUERY_ACTION
Key string used for checking action permissions for query operations. |
static java.lang.String |
QUERY_TABLE
QueryTable property. |
protected java.lang.String |
queryTable
The database table/view that this entity queries for data. |
protected java.util.Hashtable |
receivedAttachmentFile
Used internally for storing temporal AttachmentReceiving objects for current transfers. |
protected java.util.Hashtable |
receivedTempFiles
Used internally. |
static boolean |
RECORD_OPERATIONS
Specifies if standard operations are recorded by calling OperationRecorder.addOperation(). |
protected static java.util.Hashtable |
registeredDispatcher
|
static java.lang.String |
REPORT_ADVANCED_QUERY_COLUMNS
ReportAdvancedQueryColumns property. |
static java.lang.String |
REPORT_ADVANCED_QUERY_TYPES
report_advanced_query_types property. |
protected java.util.Vector |
reportAvancedQueryColumns
List of columns for making advanced queries. |
protected java.util.Vector |
reportAvancedQueryTypes
List of column types corresponding to columns defined in reportAvancedQueryColumns field. |
static java.lang.String |
SECONDARY_COLUMNS
secondary_columns property. |
static java.lang.String |
SECONDARY_KEYS
secondary_keys property. |
static java.lang.String |
SECONDARY_TABLE
secondary_table property. |
protected java.util.Vector |
secondaryColumnsNames
Column list for secondary table when one2one mode is enabled. |
protected java.util.Vector |
secondaryKeyName
Columns that make the primary key for this entity's secondary table. |
protected java.lang.String |
secondaryTable
secondary table when one2one mode is enabled. |
protected java.util.Hashtable |
sendAttachmentFile
Used internally for storing temporal AttachmentReceiving objects for current transfers. |
static java.lang.String |
SORT
Sort property. |
static java.lang.String |
SORT_DESC
SortDesc property. |
protected java.lang.String |
table
The database table this entity performs operations with. |
static java.lang.String |
TABLE
Table property. |
static java.lang.String |
TABLE_ATTRIBUTE_ENTITIES
Deprecated. |
protected java.util.Hashtable |
tempFiles
Used internally. |
static int |
TIME_BETWEEN_DEFAULT_CONNECTION_REQUEST
Default time between connection requests. |
static boolean |
TRUNCATE_DATE_DEFAULT_VALUE
Default value for truncate_date parameter. |
static java.lang.String |
TRUNCATE_DATES
TruncateDates property. |
protected boolean |
truncateDates
If true, Date objects will be set to 00:00:00 when calling to setObject method of this class. |
static char |
UNDERSCORE
The '_' character. |
static java.lang.String |
UPDATE_ACTION
Key string used for checking action permissions for update operations. |
static java.lang.String |
UPDATE_COLUMNS
UpdateColumns property. |
static java.lang.String |
UPDATE_KEYS
UpdateKeys property. |
protected java.util.Vector |
updateColumn
List of columns in which update operations are allowed. |
protected java.util.Vector |
updateKeys
List of columns required as Keys-Values to perform update operations. |
static boolean |
USE_SETSTRING_LONG_STRINGS
Sets which method will be used in JDBC prepared statements for setting parameters of type string and length > 255. |
static boolean |
useAlwaysTableAttributeEntities
|
static java.lang.String |
WILDCARD_COLUMNS
WildcardColumns property. |
protected java.util.Vector |
wildcardColumns
List of columns in which special metacharacters ('%' and '?') |
| Fields inherited from class java.rmi.server.RemoteObject |
ref |
| Constructor Summary | |
TableEntity(EntityReferenceLocator locator,
DatabaseConnectionManager dbConnectionManager,
int port)
Constructor for objects of this class. |
|
TableEntity(EntityReferenceLocator locator,
DatabaseConnectionManager dbConnectionManager,
int port,
java.util.Properties prop,
java.util.Properties aliasProp)
|
|
| Method Summary | |
void |
addEntityDataChangeListener(EntityDataChangeListener listener)
Registers a EntityDataChangeListener to this entity. |
java.lang.String |
buildConditionsString(java.util.Hashtable conditions,
java.util.Vector values)
Returns a string containing the conditions to use after the WHERE keyword in the SQL sentence. |
void |
cancelReceiving(java.lang.String receivingId,
int sessionId)
Cancells the transfer identified by receivingId.
|
void |
checkDeleteKeys(java.util.Hashtable keysValues)
Checks if keysValues contains a value for all columns defined
in 'delete_keys' parameter.
|
void |
checkFinishedSession(int sessionId)
Checks if the sessionId has an associated session. |
void |
checkInsertKeys(java.util.Hashtable attributesValues)
Checks if attributesValues contains a value for all columns
defined in 'insert_keys' parameter.
|
protected java.util.Vector |
checkOrderColumns(java.util.Vector order)
|
void |
checkPermissions(int sessionId,
java.lang.String action)
Checks if the user/session identified by sessionId has the
permission defined by action
This method calls ServerManager.getServerSecurityManager()
and then, if a manager exists, calls
manager.checkActionPermission(int, String, String) |
void |
checkUpdateKeys(java.util.Hashtable keysValues)
Checks if keysValues contains a value for all columns defined
in 'update_keys' parameter.
|
protected void |
configureReverseAlias()
|
OntimizeConnection |
connect()
Returns an OntimizeConnection by asking the DatabaseConnectionManager. |
OntimizeConnection |
connect(int userId)
Returns an OntimizeConnection by asking the DatabaseConnectionManager. |
AdvancedEntityResult |
createAdvancedEntityResultForSessionId(int cod,
int type,
int sessionId)
Utility method for creating an AdvancedEntityResult for the session identified by sessionId
. |
AdvancedEntityResult |
createAdvancedEntityResultForSessionId(int cod,
int type,
java.lang.String message,
int sessionId)
Utility method for creating an AdvancedEntityResult for the session identified by sessionId
. |
static EntityResult |
createEntityResultForSessionId(EntityReferenceLocator locator,
int cod,
int type,
java.lang.String message,
int sessionId)
Utility method for creating an EntityResult for the session identified by sessionId
. |
EntityResult |
createEntityResultForSessionId(int sessionId)
Utility method for creating an EntityResult for the session identified by sessionId
. |
EntityResult |
createEntityResultForSessionId(int cod,
int type,
int sessionId)
Utility method for creating an EntityResult for the session identified by sessionId
. |
EntityResult |
createEntityResultForSessionId(int cod,
int type,
java.lang.String message,
int sessionId)
Utility method for creating an EntityResult for the session identified by sessionId
. |
EntityResult |
createEntityResultForSessionId(int sessionId,
java.lang.String operationId)
Utility method for creating an EntityResult for the session identified by sessionId
. |
protected void |
createEntityScriptManager()
|
EntityResult |
delete(java.util.Hashtable keysValues,
int sessionId)
This method must implement a standard delete operation over the set of records defined by keysValues. |
EntityResult |
delete(java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
Executes a delete operation with the provided Connection. |
boolean |
deleteAttachmentFile(java.util.Hashtable keysValues,
int sessionId)
This method calls deleteAttachmentFile(Hashtable, int, Connection) |
boolean |
deleteAttachmentFile(java.util.Hashtable kv,
int sessionId,
java.sql.Connection con)
If attachmentFilePath is not null, this method executes a
query with conditions keysValues and then if one record is
found, searchs the column named attachmentFileNameColumn and
uses the file name found to delete the file in the file system.
|
protected EntityResult |
deleteMultipleTableAttributesColumns(EntityResult result,
java.util.Vector originalAttributes,
java.util.Vector processedMultipleAttributes)
Processes the EntityResult res creating TableMultipleValue
objects . |
void |
disconnect(OntimizeConnection connection)
Returns the connection to the DatabaseConnectionManager, by calling unlock(connection) method. |
void |
disconnect(OntimizeConnection connection,
java.lang.String lockKey)
Returns the connection to the DatabaseConnectionManager, by calling unlock(connection) method.
|
protected void |
dispatcherAttribute(java.lang.Object attribute,
EntityResult result,
int sessionId)
|
EntityResult |
executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values)
Executes a prepared statement defined by sqlSentence and
values.
|
EntityResult |
executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
java.sql.Connection con,
int sessionId)
Executes the SQL sentence sqlSentence with the parameter list
values.
|
EntityResult |
executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
int sessionId)
Executes a prepared statement defined by sqlSentence and
values.
|
EntityResult |
executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
int recordNumber,
int offset,
boolean delimited,
int sessionId)
Executes a prepared statement defined by sqlSentence and
values.
|
EntityResult |
executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
int recordNumber,
int offset,
boolean delimited,
OntimizeConnection con,
int sessionId)
Executes the SQL sentence sqlSentence with the parameter list
values.
|
EntityResult |
executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
OntimizeConnection con)
Executes a prepared statement defined by sqlSentence and values. |
EntityResult |
executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
OntimizeConnection con,
int sessionId)
Executes the SQL sentence sqlSentence with the parameter list
values.
|
protected EntityResult |
executeStatement(java.lang.String sqlSentence,
java.sql.Connection con)
Executes the query defined by the SQL sentence sqlSentence
using the connection con |
boolean |
finishReceiving(java.lang.String receivingId,
int sessionId)
Indicates to this entity that the transfer identified by receivingId has finished.
|
protected void |
fireDataChangeEvent(int type,
java.util.Hashtable keysValues,
java.util.Hashtable attributesValues)
Deprecated. Use fireDataChangeEvent(int, Hashtable, Hashtable, int) |
protected void |
fireDataChangeEvent(int type,
java.util.Hashtable keysValues,
java.util.Hashtable attributesValues,
int sessionId)
Notifies all EntityDataChangeListener objects registered as listeners of this entity, with a new DataChangeEvent with the type, keysValues and attributesValues information. |
protected void |
fireTransactionDataChangeEvent(int type,
java.util.Hashtable kv,
java.util.Hashtable av,
java.sql.Connection con)
Deprecated. Use fireTransactionDataChangeEvent(int, Hashtable, Hashtable, int, Connection) |
protected void |
fireTransactionDataChangeEvent(int type,
java.util.Hashtable kv,
java.util.Hashtable av,
int sessionId,
java.sql.Connection con)
Notifies all TransactionEntityDataChangeListener objects registered as listeners of this entity, with a new DataChangeEvent with the type, keysValues and attributesValues information. |
static int |
generateRandomId()
Generates a negative random int. |
java.util.Vector |
getActions()
Returns the actions that this entity can perform. |
java.lang.String |
getAliasForColumn(java.lang.String column)
Returns an alias for the column column if it has been
specified.
|
protected java.lang.String |
getAttachmentFileNameForKeys(java.lang.String fileName,
java.util.Hashtable keysValues)
Returns the attachment file name associated to the record identified by keysValues.
|
protected java.lang.String |
getAttachmentFilePath(java.util.Hashtable kv,
int sessionId)
|
protected java.lang.String |
getAttachmentFilePath(java.util.Hashtable kv,
int sessionId,
java.sql.Connection con)
|
java.lang.String |
getAutonumericalColumn()
Returns the autonumerical column name or null if nof defined |
BytesBlock |
getBytes(java.lang.String transferId,
int offset,
int length,
int sessionId)
Returns a BytesBlock object containing a byte array of length lengthstarting in offset offset for the
attachment identified by transferId
If offset+length is greater than the file size only file size-offset bytes
are returned.
|
java.lang.String |
getColumnForAlias(java.lang.String alias)
Returns the column for the alias alias if alias have been
defined and the alias specified corresponds to a column.
|
java.util.Map |
getColumnListForAvancedQuery(int sessionId)
Returns a map structure with the columns and sql types of this entity's table. |
java.util.Vector |
getColumns()
Returns the list of columns (by name) that may be used in operations in this entity. |
DatabaseConnectionManager |
getDatabaseConnectionManager()
|
java.util.Vector |
getDescOrderColumns()
Returns the list of columns (by name) to use in ORDER BY DESC clause |
java.lang.String |
getDescription()
Returns a description for this entity. |
static int |
getEntityPrivilegedId(Entity ent)
Gets the privileged identifier for the entity ent.
|
Entity |
getEntityReference(java.lang.String entityName)
Returns a reference to an Entity with name entityName.
|
java.lang.String |
getErrorMessage(java.sql.SQLException e)
Returns an error message corresponding to the exception e. |
protected java.lang.String |
getExtendedAliasPropertiesName()
Gets the extended alias property file path. |
protected java.lang.String |
getExtendedPropertiesName()
Gets the extended property file path. |
java.lang.String |
getExtension(java.lang.String transferId)
This method returns null |
java.lang.String |
getName()
Returns this entity's name. |
java.util.Vector |
getOrderColumns()
Returns the list of columns (by name) to use in ORDER BY clause |
int |
getPrivilegedId()
Returns the privileged identifier of this entity. |
static java.lang.String |
getPropertiesPath(java.lang.String className)
|
int |
getQueryRecordNumber(java.util.Hashtable keysValues,
int sessionId)
This method executes a count query against this entity's query table with the given conditions and for the session sessionId. |
java.lang.String |
getQueryTable()
Returns the name of the table/view used when performing queries, if defined. |
long |
getSize(java.lang.String transferId)
Returns the size of the attachment associated with the identifier transferId.
|
protected java.util.Map |
getSQLTypesFromMetaData(java.util.List columns,
int sessionId)
Obtains the DB Column metadata |
static java.util.Vector |
getStringsOn(java.lang.String s,
java.lang.String separator)
Parses the String s splitting it using separator
as delimiter. |
java.util.Hashtable |
getSubGroupValues(java.util.Hashtable fieldsValues,
java.util.Vector columns)
Deprecated. @see getSubGroupValues(Hashtable, Vector, int) |
java.util.Hashtable |
getSubGroupValues(java.util.Hashtable fieldsValues,
java.util.Vector columns,
int sessionid)
Creates a hashtable with the keys-values contained in fieldsValues that satisfy the condition that key is contained
in columns. |
java.lang.String |
getTable()
Returns the name of the table used when performing the four standard operations. |
java.util.Vector |
getUpdateColumns()
Returns the list of columns (by name) that can be updated in update operations |
protected java.lang.String |
getUser(int sessionId)
Returns the user name associated to the session identified by sessionId.
|
java.util.Vector |
getValidAttributes(java.util.Vector attributes)
Returns a list containing the valid attributes of those included in the vector attributes
If column names have been specified for this entity, only attributes
matching (case-sensitive) any of this column names are considered valid.
|
java.util.Hashtable |
getValidDeletingKeysValues(java.util.Hashtable keysValues)
Returns a hashtable containing a list of valid key-value pairs from those contained in the keysValues argument.
|
java.util.Hashtable |
getValidInsertingAttributesValues(java.util.Hashtable attributesValues)
Returns a hashtable containing a list of valid key-value pairs from those contained in the attributesValues argument.
|
java.util.Hashtable |
getValidQueryingKeysValues(java.util.Hashtable keysValues)
Returns a hashtable containing a list of valid key-value pairs from those contained in the keysValues argument.
|
java.util.Hashtable |
getValidUpdatingAttributesValues(java.util.Hashtable attributesValues)
Returns a hashtable containing a list of valid key-value pairs from those contained in the attributesValues argument.
|
java.util.Hashtable |
getValidUpdatingKeysValues(java.util.Hashtable keysValues)
Returns a hashtable containing a list of valid key-value pairs from those contained in the keysValues argument.
|
java.util.Vector |
getWildCardColumns()
Returns the list of columns (by name) which are allowed to use LIKE conditions in queries |
EntityResult |
insert(java.util.Hashtable attributesValues,
int sessionId)
This method implements a standard database insert operation with the data contained in attributesValues parameter. |
EntityResult |
insert(java.util.Hashtable attributesValues,
int sessionId,
java.sql.Connection con)
Executes an insert operation with the provided Connection. |
protected EntityResult |
insertAutonumericalAlias(EntityResult res)
Inserts the autonumerical column alias and the autonumerical value as key-value into the EntityResult res.
|
protected boolean |
isBinaryType(int type)
|
protected void |
loadAliasFile()
Loads the alias properties. |
protected void |
loadAliasFile(java.lang.String path)
Loads the alias properties file in path.
|
protected void |
logToLogKeys(java.lang.String s)
Logs the String s to the corresponding LogWriter. |
protected void |
logUpdate(java.util.Hashtable attributesValues,
java.util.Hashtable keysValues,
int sessionId)
Logs an update operation with keys-values keysValues and
attributes-values attributesValues
The log is only performed if logUpdate is true. |
static boolean |
parseStringValue(java.lang.String v,
boolean defaultValue)
Parses the string value as a boolean.
|
protected java.util.Properties |
performExtendedAliasProperties(java.util.Properties prop)
Performs the extended operation of alias property file. |
protected java.util.Properties |
performExtendedProperties(java.util.Properties prop)
Performs the extended operation of entity property file. |
void |
postDelete(EntityResult deleteResult,
java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
|
protected void |
postInsert(EntityResult insertResult,
java.util.Hashtable attributesValues,
int sessionId,
java.sql.Connection con)
|
void |
postUpdate(EntityResult updateResult,
java.util.Hashtable attributesValues,
java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
|
void |
preDelete(java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
|
protected void |
preInsert(java.util.Hashtable attributesValues,
int sessionId,
java.sql.Connection con)
|
java.lang.String |
prepareToReceive(java.util.Hashtable kv,
java.lang.String fileName,
java.lang.String fileDescription,
int sessionId)
This method calls prepareToReceive(Hashtable, String, String, String, int) with
null argument for originalFilePath |
java.lang.String |
prepareToReceive(java.util.Hashtable keysValues,
java.lang.String fileName,
java.lang.String originalFilePath,
java.lang.String fileDescription,
int sessionId)
Indicates to this entity that must be ready for receiving the contents of a file. |
java.lang.String |
prepareToReceive(java.lang.String column,
java.util.Hashtable keysValues,
int sessionId)
Indicates to this entity that must be ready for receiving the contents of a file. |
java.lang.String |
prepareToTransfer(java.util.Hashtable keysValues,
int sessionId)
Indicates to this entity that a transfer process is going to start. |
java.lang.String |
prepareToTransfer(java.lang.String column,
java.util.Hashtable keysValues,
int sessionId)
Indicates to this entity that a transfer process is going to start. |
void |
preUpdate(java.util.Hashtable attributesValues,
java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
|
protected java.util.Hashtable |
processFileColumnsAttributes(java.util.Hashtable av)
Processes the Hashtable av using the
fileInfoList information in this entity.
|
protected java.util.Vector |
processFileColumnsAttributes(java.util.Vector list)
Processes the Vector list using the information in
fileInfoList.
|
protected EntityResult |
processFileResults(EntityResult result)
Processes the result object using the information in
fileInfoList.
|
static java.util.Hashtable |
processingMultipleValueAttributes(java.util.Hashtable keysValues)
Processes the MultipleValue objects contained in keysValues.
|
static java.util.Hashtable |
processingReferenceDataFieldAttributes(java.util.Hashtable keysValues)
Processes the ReferenceFieldAttribute objects contained in keysValues.
|
static java.util.Vector |
processingReferenceDataFieldAttributes(java.util.Vector list)
Processes the ReferenceFieldAttribute objects contained in list.
|
java.util.Vector |
processMultipleAttributeKey(java.util.Vector list)
Processes MultipleReferenceDataFieldAttribute objects contained in list.
|
protected java.util.Hashtable |
processMultipleTableAttribute(java.util.Hashtable av)
Processes all the MultipleTableAttribute contained as keys ih the Hashtable av. |
protected java.util.Vector |
processMultipleTableAttribute(java.util.Vector list,
java.util.Vector processedMultipleAttributes)
Processes all the MultipleTableAttribute contained in the Vector list. |
void |
putBytes(java.lang.String receivingId,
BytesBlock bytesBlock,
int sessionId)
Adds the bytes contained in the bytesBlock object at the end
of the file associated with the transfer identified by
receivingId
. |
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. |
EntityResult |
query(java.util.Hashtable keysValues,
java.util.Vector attributes,
int sessionId,
java.sql.Connection con)
Executes a query operation using the provided Connection, with the conditions and attributes required. |
EntityResult |
query(java.util.Hashtable keysValues,
java.util.Vector attributes,
int sessionId,
java.sql.Connection con,
java.util.Vector orderColumns,
boolean ascending)
Executes a query using the provided connection. |
AdvancedEntityResult |
query(java.util.Hashtable filterKeys,
java.util.Vector attributes,
int sessionId,
int recordCounter,
int startIndex,
java.lang.String sortBy,
boolean desc)
Deprecated. |
AdvancedEntityResult |
query(java.util.Hashtable filterKeys,
java.util.Vector attributes,
int sessionId,
int recordNumber,
int startIndex,
java.util.Vector orderBy)
|
EntityResult |
queryOtherEntities(java.util.Vector attributes,
EntityResult result,
int sessionId)
This method performs a query for each object of any of the following types contained in the Vector attributes:
ReferenceFieldAttribute
TableAttribute
MultipleReferenceDataFieldAttribute
A query is performed for each record in the argument result.
|
protected void |
readProperties()
Loads the properties file for this entity. |
protected void |
readProperties(java.util.Properties prop,
java.net.URL uRLProp)
Loads and analyzes the properties prop. |
protected void |
readProperties(java.lang.String path)
Loads a Properties object located in path using
this.getClass().getClassLoader().getResource(path). |
static void |
registerAttributeDispatcher(java.lang.Class key,
AttributeDispatcher dispatcher)
|
void |
reloadScripts(boolean reloadNow)
|
void |
removeEntityDataChangeListener(EntityDataChangeListener listener)
Unregisters a EntityDataChangeListener to this entity. |
EntityResult |
replaceAliasByColumn(EntityResult res)
This method loops through the keys of the EntityResult assuming that this keys are alias, and replacing this alias by the associated column if exists or leaving them unmodified if not. |
java.util.Hashtable |
replaceAliasByColumn(java.util.Hashtable hash)
This method loops through the keys of the hashtable assuming that this keys are alias, and replacing this alias by the associated column if exists or leaving them unmodified if not. |
protected void |
replaceAliasByColumn(SQLStatementBuilder.BasicExpression bex)
|
java.util.Vector |
replaceAliasByColumn(java.util.Vector columns,
java.util.Hashtable changedColumns)
Replaces the aliases contained in the list columns by the
corresponding columns.
|
java.util.Vector |
replaceAliasByColumn(java.util.Vector columns,
java.util.Vector changedColumns)
Replaces the alias contained in the list columns by the
corresponding columns.
|
EntityResult |
replaceColumnByAlias(EntityResult res,
java.util.Hashtable replaceColumns)
This method loops through the keys of the EntityResult and replaces them accordingly to the mapping defined by replaceColumns.
|
EntityResult |
replaceColumnByAlias(EntityResult res,
java.util.Vector replaceColumns)
This method loops through the keys of the EntityResult assuming that this keys are columns, and replacing this columns by the associated alias if exists or leaving them unmodified if not. |
java.util.Hashtable |
replaceColumnByAlias(java.util.Hashtable hash)
This method loops through the keys of the hashtable assuming that this keys are columns, and replacing this columns by the associated alias if exists or leaving them unmodified if not. |
java.util.Vector |
replaceColumnByAlias(java.util.Vector columns)
Replaces the columns contained in the vector columns by the
corresponding aliases.
|
EntityResult |
replaceColumnByAliasKeepColumns(EntityResult res)
This method loops through the keys of the EntityResult assuming that this keys are alias, and replacing this alias by the associated column if exists or leaving them unmodified if not. |
static void |
resultSetToEntityResult(java.sql.ResultSet resultSet,
EntityResult entityResult)
Deprecated. You must use the resultSetToEntityResult for the specific statement handler instead (@see SQLStatementHandler |
void |
resultSetToEntityResult(java.sql.ResultSet resultSet,
EntityResult entityResult,
int recordNumber,
int offset,
boolean delimited)
|
void |
resultSetToEntityResult(java.sql.ResultSet resultSet,
EntityResult entityResult,
java.util.List columnNames)
|
void |
setLimitQueryOthersEntities(int lim)
Sets the limitQueryOthersEntities variable to
lim. |
void |
setName(java.lang.String name)
|
static void |
setObject(int index,
java.lang.Object value,
java.sql.PreparedStatement preparedStatement)
Sets a parameter values in a prepared statement, at index index |
static void |
setObject(int index,
java.lang.Object value,
java.sql.PreparedStatement preparedStatement,
boolean truncDates)
Sets a parameter value in a prepared statement, at index index
The methods used are:
setBlob for Blob objects
setClob for Clob objects
setBinaryStream for BytesBlock objects
setCharacterStream for com.ontimize.gui.LongString
setNull for com.ontimize.db.NullValue
setObject for all other object
|
void |
setPrivilegedId(int id)
Establishes the privileged identifier for this entity |
static java.util.Vector |
toVectorOfBooleans(java.util.Vector list)
This method returns a vector of Boolean objects corresponding to the objects contained in the vector list.
|
static java.sql.Timestamp |
truncateDataToHour_00_00_00(java.util.Date date)
Sets the following fields of the object date to zero:
Calendar.MILLISECOND,Calendar.SECOND,Calendar.MINUTE,Calendar.HOUR_OF_DAY
The default calendar (for the default locale and timezone) is used. |
static java.sql.Timestamp |
truncateDateToMinutes(java.util.Date date)
Sets the following fields of the object date to zero:
Calendar.MILLISECOND,Calendar.SECOND
The default calendar (for the default locale and timezone) is used. |
EntityResult |
update(java.util.Hashtable attributesValues,
java.util.Hashtable keysValues,
int sessionId)
This method implements a standard update operation with the data specified in attributesValues over the set of records defined by
keysValues. |
EntityResult |
update(java.util.Hashtable attributesValues,
java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
Executes an update operation with the provided Connection. |
protected void |
updateAttachmentValues(java.util.Hashtable keysValues,
java.util.Hashtable attributesValues,
int sessionId,
java.sql.Connection connection)
|
static java.lang.String |
vectorToStringSeparateBySemicolon(java.util.Vector list)
Generates a string containing the toString version of all the objects contained in the list list, separated by the ';' character |
| 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 |
public static boolean checkOperationResult
public static final java.lang.String LIMIT_QUERY_OTHERS_ENTITIES
public static final java.lang.String REPORT_ADVANCED_QUERY_TYPES
public static final java.lang.String REPORT_ADVANCED_QUERY_COLUMNS
public static final java.lang.String ATTACHMENT_FILE_DESCRIPTION_COLUMN
public static final java.lang.String ATTACHMENT_FILE_ORIGINAL_PATH_COLUMN
public static final java.lang.String ATTACHMENT_FILE_ORIGINAL_NAME_COLUMN
public static final java.lang.String ATTACHMENT_FILE_NAME_COLUMN
public static final java.lang.String INSERT_AUTOMATICLY_ATTACHMENT
public static final java.lang.String ATTACHMENT_FILE_NAME_KEYS
public static final java.lang.String ATTACHMENT_FILE_SIZE_COLUMN
public static final java.lang.String TABLE_ATTRIBUTE_ENTITIES
public static boolean useAlwaysTableAttributeEntities
public static final java.lang.String ATTACHMENT_FILE_PATH
public static final java.lang.String FILE_COLUMNS
public static final java.lang.String LOG_KEYS
public static final java.lang.String AUTONUMERICAL
public static final java.lang.String OTHER_ENTITIES
public static final java.lang.String SORT_DESC
public static final java.lang.String SORT
public static final java.lang.String WILDCARD_COLUMNS
public static final java.lang.String INSERT_COLUMNS
public static final java.lang.String UPDATE_COLUMNS
public static final java.lang.String UPDATE_KEYS
public static final java.lang.String DELETE_KEYS
public static final java.lang.String INSERT_KEYS
public static final java.lang.String KEYS
public static final java.lang.String COLUMNS
public static final java.lang.String AUTOCONFIGURATION
public static final java.lang.String TRUNCATE_DATES
public static final java.lang.String FORCE_DISTINCT
public static final java.lang.String ATTACHMENT_TABLE
public static final java.lang.String QUERY_TABLE
public static final java.lang.String FETCH_SIZE
public static final java.lang.String TABLE
public static char ASTERISK
public static char INTERROG
public static char PERCENT
public static char UNDERSCORE
public static java.lang.String ATTACHMENT_SEPARATOR
public static boolean TRUNCATE_DATE_DEFAULT_VALUE
public static boolean RECORD_OPERATIONS
public static final java.lang.String M_IT_HAS_NOT_CHANGED_ANY_RECORD
public static final java.lang.String M_ERROR_OPERATION
public static boolean DEBUG
public static boolean DEBUG_DETAILS
public static boolean DEBUG_TIMES
public static boolean USE_SETSTRING_LONG_STRINGS
setCharacterStream() will be used instead of
setString()
protected static EntitiesPropertiesParser entitiesPropertiesParser
protected static AliasPropertiesParser aliasPropertiesParser
public static final java.lang.String QUERY_ACTION
public static final java.lang.String INSERT_ACTION
public static final java.lang.String UPDATE_ACTION
public static final java.lang.String DELETE_ACTION
public static java.lang.String M_YOU_DO_NOT_HAVE_PERMISSION_TO_EXECUTE_ACTION
public static java.lang.String M_TEMPORALY_RESTRICTED_BY_PERMISSION_ACTION
public static java.lang.String M_LICENSE_PERMISSION_ERROR
protected java.util.Vector dataChangeListeners
protected java.lang.String table
queryTable variable is defined, it is used instead of
table
protected java.lang.String queryTable
protected java.lang.String attachTable
table.
protected java.util.Vector columnNames
protected java.util.Vector keys
protected java.util.Vector insertKeys
protected java.util.Vector deleteKeys
protected java.util.Vector updateKeys
protected java.util.Vector updateColumn
protected DatabaseConnectionManager manager
protected java.lang.String autonumericalColumn
protected java.util.Vector insertColumn
columnNames will be used instead. Defined in 'insert_columns'
parameter.
protected java.util.Vector wildcardColumns
protected java.util.Vector orderColumns
protected java.util.Vector descendantColumnsOrder
protected java.util.Vector othersEntities
protected EntityReferenceLocator locator
protected int limitQueryOthersEntities
protected java.util.Properties alias
protected java.util.Hashtable aliasReverse
protected java.lang.String entityName
protected int privilegedId
protected boolean forceDistinct
protected boolean truncateDates
protected static java.util.Calendar calendar
protected java.lang.String attachmentFilePath
protected java.lang.String attachmentFileNameColumn
protected java.lang.String originalAttachmentFileNameColumn
protected java.lang.String originalAttachmentFilePathColumn
protected java.lang.String descriptionAttachmentFileColumn
protected boolean insertAttachmentAutomatically
prepareToReceive method. These values will be
used in the insert operation that is done in this method. Defined in
'insert_automatically_attachment' parameter. Default is false.
protected java.util.Vector attachmentFileNameKeys
getAttachmentFileNameForKeys()
method. Defined in 'attachment_file_name_keys' parameter. By default, this
variable is null.
protected java.lang.String attachmentFileSizeColumn
protected java.util.Hashtable receivedAttachmentFile
protected java.util.Hashtable sendAttachmentFile
protected java.util.Vector reportAvancedQueryColumns
protected java.util.Vector reportAvancedQueryTypes
reportAvancedQueryColumns field. Defined in
'report_advanced_query_types' parameter.
protected java.util.Vector logkeys
protected int fetchSize
public static final java.lang.String PRINCIPAL_TABLE
public static final java.lang.String SECONDARY_TABLE
public static final java.lang.String PRINCIPAL_COLUMNS
public static final java.lang.String SECONDARY_COLUMNS
public static final java.lang.String PRINCIPAL_KEYS
public static final java.lang.String SECONDARY_KEYS
protected java.lang.String principalTable
protected java.lang.String secondaryTable
protected java.util.Vector principalColumnNames
protected java.util.Vector secondaryColumnsNames
protected java.util.Vector principalKeyName
protected java.util.Vector secondaryKeyName
protected DBLocalErrorMessages dBLocalErrorMessage
protected boolean oneToOneMode
protected java.util.Hashtable tempFiles
protected java.util.Hashtable receivedTempFiles
public static int DEFAULT_MAX_CONNECTION_WAIT_TIME
public static int TIME_BETWEEN_DEFAULT_CONNECTION_REQUEST
protected int maxConnectionWaitTime
protected int connectionRequestTime
protected boolean logQuery
protected boolean logInsert
protected boolean logUpdate
protected boolean logDelete
protected java.util.Properties properties
protected static java.lang.String propertiesPath
entityName
.properties, relative to this entity class file.
protected com.ontimize.db.TableEntity.FileInfoList fileInfoList
protected java.util.Vector entitiesTableAttribute
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.
Defined in 'TableAttributeEntities' parameter.
Default is null.
public static boolean enableScripting
public static java.lang.String defaultEntityScriptManagerClassName
protected IEntityScriptManager entityScripting
protected static java.util.Hashtable registeredDispatcher
| Constructor Detail |
public TableEntity(EntityReferenceLocator locator,
DatabaseConnectionManager dbConnectionManager,
int port)
throws java.lang.Exception
locator - The EntityReferenteLocator that this entity will use for getting
references to other entitiesdbConnectionManager - The DatabaseConnectionManager that provides database connectionsport - The RMI port this object listens on
java.lang.Exception - If creation of this object fails
public TableEntity(EntityReferenceLocator locator,
DatabaseConnectionManager dbConnectionManager,
int port,
java.util.Properties prop,
java.util.Properties aliasProp)
throws java.lang.Exception
| Method Detail |
protected void createEntityScriptManager()
public void reloadScripts(boolean reloadNow)
public OntimizeConnection connect()
throws java.lang.Exception
maxConnectionWaitTime if the
DatabaseConnectionManager don´t provide a connection in the first attemps.
java.lang.Exception - if the DatabaseConnectionManager can´t provide a connection
public OntimizeConnection connect(int userId)
throws java.lang.Exception
maxConnectionWaitTime if the
DatabaseConnectionManager don´t provide a connection in the first attemps.
userId - The userId to which the connection is related
java.lang.Exception - if the DatabaseConnectionManager can´t provide a connection
public void disconnect(OntimizeConnection connection,
java.lang.String lockKey)
unlock(connection) method.
The lockKey parameter must be equal to the connection lock key
connection - The connection to unlocklockKey - May be nullpublic void disconnect(OntimizeConnection connection)
unlock(connection) method.
connection -
public void resultSetToEntityResult(java.sql.ResultSet resultSet,
EntityResult entityResult,
int recordNumber,
int offset,
boolean delimited)
throws java.lang.Exception
java.lang.Exception
public void resultSetToEntityResult(java.sql.ResultSet resultSet,
EntityResult entityResult,
java.util.List columnNames)
throws java.lang.Exception
java.lang.Exception
public static void resultSetToEntityResult(java.sql.ResultSet resultSet,
EntityResult entityResult)
throws java.lang.Exception
SQLStatementHandler
EntityResult. The columns in the ResultSet are the keys in the
EntityResult, and the values for the columns are stored in Vector objects
corresponding to the keys in the EntityResult.
The following getxxxxx ResulSet methods are used for getting column data:
resultSet - the source ResultSetentityResult - the destination EntityResult. It has a Hashtable of Vectors
structure.
java.lang.Exception - if any error (database, etc.) occurs
public static void setObject(int index,
java.lang.Object value,
java.sql.PreparedStatement preparedStatement)
throws java.sql.SQLException
index
index - the index of the parametervalue - the value to setpreparedStatement - the prepared statement
java.sql.SQLExceptionsetObject
public static void setObject(int index,
java.lang.Object value,
java.sql.PreparedStatement preparedStatement,
boolean truncDates)
throws java.sql.SQLException
index
The methods used are:
index - value - preparedStatement - truncDates -
java.sql.SQLExceptionprotected void loadAliasFile()
protected void loadAliasFile(java.lang.String path)
path.
If file does not exist, no error is produced. If file exists, resulting
alias are loaded in alias and aliasReverse
fields.
path - the file location, relative to this entity's class file.protected void configureReverseAlias()
protected void readProperties()
throws java.lang.Exception
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 |
Deprecated since 5.2056EN-0.2 (See Sort). 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
readProperties(String) with the standard location for this
entity's properties file.
java.lang.Exceptionpublic static java.lang.String getPropertiesPath(java.lang.String className)
protected void readProperties(java.lang.String path)
throws java.lang.Exception
path using
this.getClass().getClassLoader().getResource(path).readProperties(Properties, URL)
path - path from which the properties will be loaded
java.lang.Exceptionprotected java.lang.String getExtendedPropertiesName()
String with the file path.protected java.lang.String getExtendedAliasPropertiesName()
String with the file path.protected java.util.Properties performExtendedProperties(java.util.Properties prop)
prop - Entity property file.
protected java.util.Properties performExtendedAliasProperties(java.util.Properties prop)
prop - Alias property file.
protected void readProperties(java.util.Properties prop,
java.net.URL uRLProp)
throws java.lang.Exception
prop. The parameters for
this entity are read from the properties and this entity is configured
according to them.uRLProp protocol is 'file', then a properties file is
generated located in uRLProp.getPath()
prop - the properties objectuRLProp - the properties file URL
java.lang.Exception
public EntityResult query(java.util.Hashtable keysValues,
java.util.Vector attributes,
int sessionId)
throws java.lang.Exception
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:
#processMultipleTableAttribute(Vector)processMultipleAttributeKey(Vector)query(Hashtable , Vector , int , Connection)
Then, if the result returned by query has no error, the
queryOtherEntities(Vector , EntityResult , int ) method is
called.
After that, this entity logs the operation if logQuery is
true.
If an SQLException is thrown, the 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 query(Hashtable , Vector , int , Connection)
method is returned by this method if no error ocurrs.
query in interface EntitykeysValues - 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.
java.lang.Exception - if any non handled exception occursquery(Hashtable, Vector, int, Connection)
public AdvancedEntityResult query(java.util.Hashtable filterKeys,
java.util.Vector attributes,
int sessionId,
int recordNumber,
int startIndex,
java.util.Vector orderBy)
throws java.lang.Exception
query in interface AdvancedEntityfilterKeys - 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.recordNumber - a integer establishing the number of records that will be returned.startIndex - a integer establishing the position of the first record that will be returned.orderBy - a Vector of String or SQLStatementBuilder.SQLOrder objects in where the column orderer is established.
java.lang.Exception
public AdvancedEntityResult query(java.util.Hashtable filterKeys,
java.util.Vector attributes,
int sessionId,
int recordCounter,
int startIndex,
java.lang.String sortBy,
boolean desc)
throws java.lang.Exception
query in interface AdvancedEntityfilterKeys - attributes - sessionId - recordCounter - startIndex - sortBy - desc -
java.lang.Exception
public EntityResult insert(java.util.Hashtable attributesValues,
int sessionId)
throws java.lang.Exception
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.
If an SQLException is thrown, the 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 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.
insert in interface EntityattributesValues - 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.
java.lang.Exceptioninsert(Hashtable , int , Connection)
public EntityResult update(java.util.Hashtable attributesValues,
java.util.Hashtable keysValues,
int sessionId)
throws java.lang.Exception
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.
If an SQLException is thrown, the getErrorMessage(SQLException)
method is called and the resulting message is set as the message in the
EntityResult returned by this entity.
update in interface EntityattributesValues - the data for updating the records to. The keys specify the
attributes (or columns) and the values, the values for these
columns.keysValues - 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.
java.lang.Exception - if any exception occursupdate(Hashtable, Hashtable , int , Connection)
public EntityResult delete(java.util.Hashtable keysValues,
int sessionId)
throws java.lang.Exception
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.
If an SQLException is thrown, the getErrorMessage(SQLException)
method is called and the resulting message is set as the message in the
EntityResult returned by this entity.
delete in interface EntitykeysValues - 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.
java.lang.Exception - if any exception occursdelete(Hashtable, int , Connection)public java.lang.String getErrorMessage(java.sql.SQLException e)
e.getMessage() is
returned.
e - the exception
public java.lang.String buildConditionsString(java.util.Hashtable conditions,
java.util.Vector values)
processingReferenceDataFieldAttributes(Hashtable)processingMultipleValueAttributes(Hashtable)getValidQueryingKeysValues(Hashtable)SQLStatementBuilder.createQueryConditionsWithoutWhere(Hashtable, Vector,
Vector)
conditions - values -
public static java.util.Vector toVectorOfBooleans(java.util.Vector list)
list.
For each position in the vector:
The list must contain only Boolean objects, Number objects or
nulls.
list -
public void setLimitQueryOthersEntities(int lim)
limitQueryOthersEntities variable to
lim.
lim - limitQueryOthersEntitiespublic java.util.Vector getValidAttributes(java.util.Vector attributes)
attributes
If column names have been specified for this entity, only attributes matching (case-sensitive) any of this column names are considered valid.
If no columns have been defined, all attributes will be considered valid.
attributes -
public java.util.Hashtable getValidQueryingKeysValues(java.util.Hashtable keysValues)
keysValues argument.
A key-value pair is valid if the key is valid.
If column names have been specified for this entity, only keys matching
(case-sensitive) any of this column names are considered valid. Also, the
special key
SQLStatementBuilder.ExtendedSQLConditionValuesProcessor.EXPRESSION_KEY
is always considered valid.
If no columns have been defined, all keys will be considered valid.
keysValues -
public java.util.Hashtable getValidInsertingAttributesValues(java.util.Hashtable attributesValues)
attributesValues argument.
A key-value pair is valid if the key is valid.
If insert columns have not been specified for this entity,
getValidQueryingKeysValues(Hashtable) method is called and result
is returned.
If not, the following is used:
Only keys matching (case-sensitive) any of this insert column names are considered valid.
attributesValues -
public java.util.Hashtable getValidUpdatingAttributesValues(java.util.Hashtable attributesValues)
attributesValues argument.
A key-value pair is valid if the key is valid.
If column names have been specified for this entity, only keys matching (case-sensitive) any of this column names and any of the columns defined by the 'update_columns' parameter are considered valid.
If no columns have been defined, all keys contained in the update columns defined for this entity, will be considered valid.
attributesValues -
public java.util.Hashtable getValidUpdatingKeysValues(java.util.Hashtable keysValues)
keysValues argument.
A key-value pair is valid if the key is valid.
Only keys matching (case-sensitive) any of the columns defined by the 'update_keys' parameter are considered valid.
keysValues -
public java.util.Hashtable getValidDeletingKeysValues(java.util.Hashtable keysValues)
keysValues argument.
A key-value pair is valid if the key is valid.
Only keys matching (case-sensitive) any of the columns defined by the 'delete_keys' parameter are considered valid.
keysValues -
public EntityResult executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values)
throws java.lang.Exception
sqlSentence and
values.
This method ask for a connection and then calls
executePreparedStatement(String, Vector, OntimizeConnection)
returning the result.
sqlSentence - the SQL sentencevalues - a list of values for the parameters in the SQL sentence
java.lang.Exception
public EntityResult executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
int sessionId)
throws java.lang.Exception
sqlSentence and
values.
This method ask for a connection, calling connect(int) with
sessionId, and then calls
executePreparedStatement(String, Vector, OntimizeConnection)
returning the result.
sqlSentence - the SQL sentencevalues - a list of values for the parameters in the SQL sentencesessionId -
java.lang.Exception
public EntityResult executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
int recordNumber,
int offset,
boolean delimited,
int sessionId)
throws java.lang.Exception
sqlSentence and
values.
This method ask for a connection, calling connect(int) with
sessionId, and then calls
executePreparedStatement(String, Vector, OntimizeConnection)
returning the result.
sqlSentence - the SQL sentencevalues - a list of values for the parameters in the SQL sentencerecordNumber - number of record to retrieveoffset - index of the record to retrievesessionId -
java.lang.Exception
public EntityResult executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
OntimizeConnection con)
throws java.lang.Exception
sqlSentence and values.This method calls {@link #executePreparedStatement(String, Vector, OntimizeConnection, int) returning the result.
sqlSentence - the SQL sentencevalues - a list of values for the parameters in the SQL sentencecon -
java.lang.Exception
public EntityResult executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
int recordNumber,
int offset,
boolean delimited,
OntimizeConnection con,
int sessionId)
throws java.lang.Exception
sqlSentence with the parameter list
values.
This method uses the supplied connection con but does not
disconnect it.
Creates a PreparedStatement, sets the parameters by calling
setObject(int, Object, PreparedStatement, boolean), and executes
the statement.
If the operation produces a ResultSet, then this ResultSet is read by
calling resultSetToEntityResult(ResultSet, EntityResult) and the
EntityResult is returned.
If the sessionId has a compression threshold associated, then it is set in the returned result.
If the operation does not produce a ResultSet the statement is queried for update count and if the result is zero, a warning message (M_IT_HAS_NOT_CHANGED_ANY_RECORD) is set in an empty EntityResult that is returned.
Finally this method closes the PreparedStatement.
sqlSentence - the sentence to executevalues - the corresponding parameter valuescon - the connection to use when creating the PreparedStatementsessionId - the user identifier
java.lang.Exception - if an error occurs
public EntityResult executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
OntimizeConnection con,
int sessionId)
throws java.lang.Exception
sqlSentence with the parameter list
values.
This method uses the supplied connection con but does not
disconnect it.
Creates a PreparedStatement, sets the parameters by calling
setObject(int, Object, PreparedStatement, boolean), and executes
the statement.
If the operation produces a ResultSet, then this ResultSet is read by
calling resultSetToEntityResult(ResultSet, EntityResult) and the
EntityResult is returned.
If the sessionId has a compression threshold associated, then it is set in the returned result.
If the operation does not produce a ResultSet the statement is queried for update count and if the result is zero, a warning message (M_IT_HAS_NOT_CHANGED_ANY_RECORD) is set in an empty EntityResult that is returned.
Finally this method closes the PreparedStatement.
sqlSentence - the sentence to executevalues - the corresponding parameter valuescon - the connection to use when creating the PreparedStatementsessionId - the user identifier
java.lang.Exception - if an error ocurrs
public EntityResult executePreparedStatement(java.lang.String sqlSentence,
java.util.Vector values,
java.sql.Connection con,
int sessionId)
throws java.lang.Exception
sqlSentence with the parameter list
values.
This method uses the supplied connection con but does not
disconnect it.
Creates a PreparedStatement, sets the parameters by calling
setObject(int, Object, PreparedStatement, boolean), and executes
the statement.
If the operation produces a ResultSet, then this ResultSet is read by
calling resultSetToEntityResult(ResultSet, EntityResult) and the
EntityResult is returned.
If the sessionId has a compression threshold associated, then it is set in the returned result.
If the operation does not produce a ResultSet the statement is queried for update count and if the result is zero, a warning message (M_IT_HAS_NOT_CHANGED_ANY_RECORD) is set in an empty EntityResult that is returned.
Finally this method closes the PreparedStatement.
sqlSentence - the sentence to executevalues - the corresponding parameter valuescon - the connection to use when creating the PreparedStatementsessionId - the user identifier
java.lang.Exception - if an error ocurrs
public EntityResult queryOtherEntities(java.util.Vector attributes,
EntityResult result,
int sessionId)
attributes:
A query is performed for each record in the argument result.
For ReferenceFieldAttribute and MultipleReferenceDataFieldAttribute objects, the object information (entity, columns, cods, attrs) is used to perform the query.
For TableAttribute objects, if the entity specified in the object is
defined in this entity's 'TableAttributeEntities' parameter, then the
TableAttribute object information ( parentkeys) is used when performed the
query, that is, the keysValues passed to the Entity's query method will
contain for each record in result the values for each column
in the parentkeys.
If the entity specified in the TableAttribute object is not defined in 'TableAttributeEntities', then the keys of this entity are used.
Also, for TableAttribute objects, if 'other_entities' parameter is
defined, only those objects with entity name matches any of the names
defined by this parameter, will lead to a query execution. If the
result contains more records than the value of
limitQueryOthersEntities field, only the first
limitQueryOthersEntities will be queried.
When querying other entities, if this and these entities are instances of PrivilegedSecurityEntity, and this entity is queried with a privileged Id, a privileged Id is set and used with other entities when querying.
The resulting data is added to the result object using as
keys, the associated objects in attributes.
So, if a ReferenteFieldAttribute is found, a query is performed and the
result is added to result using as key the
ReferenceFieldAttribute.
attributes - result - With the column names without the alias. If there is no data for
column names then use the alias values.sessionId -
result object received as argument with
additional dataTableAttribute,
ReferenceFieldAttribute
public static void registerAttributeDispatcher(java.lang.Class key,
AttributeDispatcher dispatcher)
protected void dispatcherAttribute(java.lang.Object attribute,
EntityResult result,
int sessionId)
public void checkInsertKeys(java.util.Hashtable attributesValues)
throws java.lang.Exception
attributesValues contains a value for all columns
defined in 'insert_keys' parameter.
attributesValues -
java.lang.Exception - if any of the columns defined in 'insert_keys' is not found as
key in attributesValues
public void checkUpdateKeys(java.util.Hashtable keysValues)
throws java.lang.Exception
keysValues contains a value for all columns defined
in 'update_keys' parameter.
keysValues -
java.lang.Exception - if any of the columns defined in 'update_keys' is not found as
key in keysValues
public void checkDeleteKeys(java.util.Hashtable keysValues)
throws java.lang.Exception
keysValues contains a value for all columns defined
in 'delete_keys' parameter.
keysValues -
java.lang.Exception - if any of the columns defined in 'delete_keys' is not found as
key in keysValuespublic java.lang.String getAliasForColumn(java.lang.String column)
column if it has been
specified.
column -
public java.lang.String getColumnForAlias(java.lang.String alias)
alias if alias have been
defined and the alias specified corresponds to a column.
alias -
alias or null if no
column has this alias.public java.util.Hashtable replaceAliasByColumn(java.util.Hashtable hash)
hash -
protected void replaceAliasByColumn(SQLStatementBuilder.BasicExpression bex)
public java.util.Hashtable replaceColumnByAlias(java.util.Hashtable hash)
hash -
public EntityResult replaceAliasByColumn(EntityResult res)
res -
public EntityResult replaceColumnByAlias(EntityResult res,
java.util.Vector replaceColumns)
Only the columns contained in replaceColumns are replaced in
the result.
res - replaceColumns -
public EntityResult replaceColumnByAlias(EntityResult res,
java.util.Hashtable replaceColumns)
replaceColumns.
So, if any of the keys of result is found in
replaceColumns, it is replaced by the value associated
(replaceColumns.get(key))
res - replaceColumns -
public EntityResult replaceColumnByAliasKeepColumns(EntityResult res)
The original keys (and values) are also copied to the result.
res -
public java.util.Vector replaceAliasByColumn(java.util.Vector columns,
java.util.Vector changedColumns)
columns by the
corresponding columns.
The replaced columns (not the alias) are added to the vector
changedColumns
columns - changedColumns -
columns and the columns corresponding to
alias contained in columns, if any.
public java.util.Vector replaceAliasByColumn(java.util.Vector columns,
java.util.Hashtable changedColumns)
columns by the
corresponding columns.
The replaced columns and alias are added to the hashtable
changedColumns as a key-value pair in the form
column-alias
columns - changedColumns -
columns and the columns corresponding to
alias contained in columns, if any.public java.util.Vector replaceColumnByAlias(java.util.Vector columns)
columns by the
corresponding aliases.
The objects with no corresponding aliases are added with no changes.
columns -
public void checkFinishedSession(int sessionId)
throws GeneralSecurityException
sessionId - the identifier to check
GeneralSecurityException - if a session is not found for identifier sessionId
public void checkPermissions(int sessionId,
java.lang.String action)
throws NotInPeriodException,
GeneralSecurityException,
SessionNotFoundException
sessionId has the
permission defined by action
This method calls ServerManager.getServerSecurityManager()
and then, if a manager exists, calls
manager.checkActionPermission(int, String, String)
sessionId - the identifier to checkaction - the action to check
NotInPeriodException - if the action is restricted by time constraints
GeneralSecurityException - it the action is not allowed
SessionNotFoundException - if the identifier sessionId has not an associated
session.public void setPrivilegedId(int id)
setPrivilegedId in interface PrivilegedSecurityEntityid - the identifier that will be the privileged one. Must be < 0, but
this is not imposed in this method.public int getPrivilegedId()
getPrivilegedId in interface PrivilegedSecurityEntity
public java.util.Vector getActions()
throws java.lang.Exception
getActions in interface SecureEntityjava.lang.Exception
public java.lang.String getName()
throws java.lang.Exception
entityName
getName in interface SecureEntityjava.lang.Exception
public java.lang.String getDescription()
throws java.lang.Exception
getName()
getDescription in interface SecureEntityjava.lang.Exceptionpublic java.lang.String getQueryTable()
public java.lang.String getTable()
public static java.util.Hashtable processingReferenceDataFieldAttributes(java.util.Hashtable keysValues)
keysValues.
Returns a hashtable containing all the objects contained in the argument
keysValues except in the case of keys that are
ReferenceFieldAttribute objects, which are replaced by
((ReferenceFieldAttribute)object).getAttr()
keysValues - the keysValues to process
public static java.util.Vector processingReferenceDataFieldAttributes(java.util.Vector list)
list.
Returns a Vector containing all the objects in the argument
list except in the case of keys that are
ReferenceFieldAttribute objects, which are maintained but also
((ReferenceFieldAttribute)object).getAttr() is added
list - the list to process
public int getQueryRecordNumber(java.util.Hashtable keysValues,
int sessionId)
throws java.lang.Exception
sessionId.
keysValues - the conditions that the records must fulfillsessionId - the session identifier
java.lang.Exception - if a database error ocurrs
public long getSize(java.lang.String transferId)
throws java.lang.Exception
transferId.
getSize in interface FileManagementEntitytransferId -
java.lang.Exception - if a transfer for the identifier is not found
public java.lang.String getExtension(java.lang.String transferId)
throws java.lang.Exception
null
getExtension in interface FileManagementEntitytransferId -
java.lang.Exception
public java.lang.String prepareToTransfer(java.util.Hashtable keysValues,
int sessionId)
throws java.lang.Exception
keysValues identify the record that has associated the file,
and the sessionId identifies the caller user/session.
A checkPermissions() with TableEntity.QUERY_ACTION is
executed, so this action must be granted to the caller.
prepareToTransfer in interface FileManagementEntitykeysValues - the keys-values that identify the record to which the file is
linkedsessionId - the session identifier
java.lang.Exception - if an error ocurrs
public java.lang.String prepareToTransfer(java.lang.String column,
java.util.Hashtable keysValues,
int sessionId)
throws java.lang.Exception
keysValues identify the record that will have associated the
transferred object, and the sessionId identifies the caller
user/session.
A checkPermissions() with TableEntity.QUERY_ACTION is
executed, so this action must be granted to the caller.
prepareToTransfer in interface FileManagementEntitycolumn - the table column that stores the file contents. Must be
VARBINARY or LONGVARBINARY typekeysValues - the keys-values that identify the record to which the file must
be linkedsessionId - the session identifier
java.lang.Exception - if an error ocurrsprotected boolean isBinaryType(int type)
public java.lang.String prepareToReceive(java.lang.String column,
java.util.Hashtable keysValues,
int sessionId)
throws java.lang.Exception
keysValues. The method returns a String identifier for use
when sending new bytes.
prepareToReceive in interface FileManagementEntitycolumn - the table column that will store the file, if it must be stored
in the database, or null if it must be stored in file systemkeysValues - the keys-values that identify the record to which the file is
linkedsessionId - the caller id
java.lang.Exception - in an error ocurrs.
protected java.lang.String getAttachmentFileNameForKeys(java.lang.String fileName,
java.util.Hashtable keysValues)
throws java.lang.Exception
keysValues.
The file name is generated concatenating the values of this entity's keys
(in the same order as they were defined) in the record identified by
keysValues separated by ATTACHMENT_SEPARATOR
plus a '.' and the extension part of the name fileName.
fileName - the base file name. Cannot be nullkeysValues - the keys-values that identify a record
java.lang.Exception - if fileName is null, keysValues is null or empty or a key has
not value in the record
public java.lang.String prepareToReceive(java.util.Hashtable kv,
java.lang.String fileName,
java.lang.String fileDescription,
int sessionId)
throws java.lang.Exception
prepareToReceive(Hashtable, String, String, String, int) with
null argument for originalFilePath
prepareToReceive in interface FileManagementEntityjava.lang.Exception
public java.lang.String prepareToReceive(java.util.Hashtable keysValues,
java.lang.String fileName,
java.lang.String originalFilePath,
java.lang.String fileDescription,
int sessionId)
throws java.lang.Exception
keysValues. The method returns a String identifier for use
when sending new bytes.
This method performs a query, so QUERY_ACTION must be granted to the caller.
If insertAttachmentAutomatically is true, then a new record
is automatically inserted using the values contained in
keysValues. (So, INSERT_ACTION must be granted.)
The supplied fileName, originalFilePath and
fileDescription will be used when inserting if not null and
attachmentFileNameColumn,
originalAttachmentFileNameColumn and
descriptionAttachmentFileColumn are not null.
If insertAttachmentAutomatically is false, a record must
exist.
prepareToReceive in interface FileManagementEntitykeysValues - the keys-values that identify the record or the new values for
the new recordfileName - the attachment file name. The resulting file name will be the
generated by a call to getAttachmentFileNameForKeys. May be nulloriginalFilePath - may be nullfileDescription - an optional file description. May be nullsessionId - the caller id
java.lang.Exception - if attachment file path or attachment filename column are null
for this entity, or an error ocurrs
public BytesBlock getBytes(java.lang.String transferId,
int offset,
int length,
int sessionId)
throws java.lang.Exception
lengthstarting in offset offset for the
attachment identified by transferId
If offset+length is greater than the file size only file size-offset bytes are returned.
getBytes in interface FileManagementEntitytransferId - the transfer identifieroffset - the start offsetlength - the number of bytes to returnsessionId - the caller identifier
java.lang.Exception - if a transfer for transferId is not found.
public void putBytes(java.lang.String receivingId,
BytesBlock bytesBlock,
int sessionId)
throws java.lang.Exception
bytesBlock object at the end
of the file associated with the transfer identified by
receivingId
. If a write error ocurrs, the transfer identified by
receivingId is cancelled.
putBytes in interface FileManagementEntityreceivingId - bytesBlock - sessionId -
java.lang.Exception - if a transfer for receivingId is not found or a
transfer or write error ocurrs
public boolean finishReceiving(java.lang.String receivingId,
int sessionId)
throws java.lang.Exception
receivingId has finished.
This means that the file is complete and the table record associated to this transfer must be updated with the file information (file name, size, etc.)
The transfer identifier is removed from current transfers. If an error ocurrs, the transfer is cancelled.
If the file must be stored in the table this update operation will include also the file contents.
If the record has a previous attachment, this attachment is deleted.
An UPDATE_ACTION must be granted to the caller.
finishReceiving in interface FileManagementEntityreceivingId - the transfer identifiersessionId - the caller identifier
java.lang.Exception - if an error ocurrs.
protected void updateAttachmentValues(java.util.Hashtable keysValues,
java.util.Hashtable attributesValues,
int sessionId,
java.sql.Connection connection)
throws java.lang.Exception
java.lang.Exception
public void cancelReceiving(java.lang.String receivingId,
int sessionId)
throws java.lang.Exception
receivingId.
An UPDATE_ACTION and DELETE_ACTION (if record was created when the transfer started) must be granted to the caller.
The temporal file is deleted and if a record was created is also deleted
cancelReceiving in interface FileManagementEntityreceivingId - the transfer identifiersessionId -
java.lang.Exception - if an error ocurrs or if the user has not the rights to perform
the actionprotected java.lang.String getUser(int sessionId)
sessionId.
This method calls the SecureReferenceLocator getUser(int) method if the locator for this entity is a SecureReferenceLocator. If not, if locator is ReferenceLocator, getUser() is called.
sessionId -
public AdvancedEntityResult createAdvancedEntityResultForSessionId(int cod,
int type,
int sessionId)
sessionId
. Basically this method creates an AdvancedEntityResult and sets its compression threshold.
cod - type - sessionId -
public AdvancedEntityResult createAdvancedEntityResultForSessionId(int cod,
int type,
java.lang.String message,
int sessionId)
sessionId
. Basically this method creates an AdvancedEntityResult and sets its compression threshold.
cod - type - message - sessionId -
public EntityResult createEntityResultForSessionId(int cod,
int type,
java.lang.String message,
int sessionId)
sessionId
. Basically this method creates an EntityResult and sets its compression threshold.
cod - type - message - sessionId -
public static EntityResult createEntityResultForSessionId(EntityReferenceLocator locator,
int cod,
int type,
java.lang.String message,
int sessionId)
sessionId
. Basically this method creates an EntityResult and sets its compression threshold.
This method uses the suppied EntityReferenceLocator for getting the
compression threshold for the session sessionId
locator - cod - type - message - sessionId -
public EntityResult createEntityResultForSessionId(int cod,
int type,
int sessionId)
sessionId
. Basically this method creates an EntityResult and sets its compression threshold.
cod - type - sessionId -
public EntityResult createEntityResultForSessionId(int sessionId)
sessionId
. Basically this method creates an EntityResult and sets its compression threshold.
sessionId -
public EntityResult createEntityResultForSessionId(int sessionId,
java.lang.String operationId)
sessionId
. Basically this method creates an EntityResult and sets its compression threshold.
Also, this method sets the operationId of the EntityResult.
sessionId -
public static int generateRandomId()
public static boolean parseStringValue(java.lang.String v,
boolean defaultValue)
value as a boolean.
If the string is 'yes' or 'true', then true is returned, and if is 'no' or 'false', false is returned.
Otherwise, defaultValue is returned.
v - defaultValue -
public static java.lang.String vectorToStringSeparateBySemicolon(java.util.Vector list)
list, separated by the ';' character
list -
public Entity getEntityReference(java.lang.String entityName)
throws java.lang.Exception
entityName.
This method checks if locator for this entity is an instance
of ServerReferenceLocator. If true,
getEntityReferenceFromServer(String) is used instead
getEntityReference(String)
entityName - the entityName
entityName
java.lang.Exception - if an error ocurrspublic static int getEntityPrivilegedId(Entity ent)
ent.
For this method to work, ent must be a
PrivilegedSecurityEntity.
In this case, the privileged identifier is got from the Entity object. If it has not been set, a new privileged identifier is generated ramdomly and set in the Entity object. Then, this identifier is returned.
ent -
public static java.sql.Timestamp truncateDateToMinutes(java.util.Date date)
date to zero:
Calendar.MILLISECOND,Calendar.SECOND
The default calendar (for the default locale and timezone) is used.
date -
date
except the fields set to zero.public static java.sql.Timestamp truncateDataToHour_00_00_00(java.util.Date date)
date to zero:
Calendar.MILLISECOND,Calendar.SECOND,Calendar.MINUTE,Calendar.HOUR_OF_DAY
The default calendar (for the default locale and timezone) is used.
date -
date
except the fields set to zero.
public static java.util.Vector getStringsOn(java.lang.String s,
java.lang.String separator)
s splitting it using separator
as delimiter. A Vector of Strings is generated.
s - the String to parse. May be null. In this case, an empty Vector
is returnedseparator - the delimiter. May be null. In this case, a Vector with only the
String s is returned
protected void logUpdate(java.util.Hashtable attributesValues,
java.util.Hashtable keysValues,
int sessionId)
keysValues and
attributes-values attributesValues
The log is only performed if logUpdate is true.
attributesValues - keysValues - sessionId - protected void logToLogKeys(java.lang.String s)
s to the corresponding LogWriter. If
logkeys field is null the
LogManager.getDefaultLogWriter() is used to log, if not null.
If logkeys field is not null, for each of the
logkeys, LogManager.getLogWriter(String) is used to log the String
s
s -
protected java.util.Vector processMultipleTableAttribute(java.util.Vector list,
java.util.Vector processedMultipleAttributes)
list. All other objects are added to the resulting Vector
with no changes. The MultipleTableAttribute objects are replaced by their
attribute plus a list of ExtendedTableAttribute objects corresponding to
the keys of the MultipleTableAttribute object.
list -
protected EntityResult deleteMultipleTableAttributesColumns(EntityResult result,
java.util.Vector originalAttributes,
java.util.Vector processedMultipleAttributes)
res creating TableMultipleValue
objects .
result - originalAttributes -
protected java.util.Hashtable processMultipleTableAttribute(java.util.Hashtable av)
av. All other objects are added to the resulting
Vector with no changes. The MultipleTableAttribute objects are replaced by
their attribute.
av -
protected java.util.Hashtable processFileColumnsAttributes(java.util.Hashtable av)
av using the
fileInfoList information in this entity.
The DataFile objects contained in av are splitted in
filename and file contents (bytes) as values in the resulting Hashtable
and using the filename column and the file contents column as keys.
If fileInfoList is null in this entity, a clone
of the Hashtable av is returned.
av -
protected java.util.Vector processFileColumnsAttributes(java.util.Vector list)
list using the information in
fileInfoList.
For each object in list that has an associated FileInfo
object, the FileInfo.getColumName() and FileInfo.getFileColumn() strings
are added to the resulting Vector.
If fileInfoList is null in this entity, a clone
of the Hashtable av is returned.
list - a Vectos with a list of attributes
protected EntityResult processFileResults(EntityResult result)
result object using the information in
fileInfoList.
For each FileInfo in fileInfoList, if the columns
that correspond to filenames and to file contents are found in
result, a new DataFile object is added to the result using as
key the FileInfo object's key.
If fileInfoList is null in this entity, a clone
of the Hashtable result is returned.
result -
public void addEntityDataChangeListener(EntityDataChangeListener listener)
addEntityDataChangeListener in interface EntityDataChangeNotifierlistener - public void removeEntityDataChangeListener(EntityDataChangeListener listener)
removeEntityDataChangeListener in interface EntityDataChangeNotifierlistener -
protected void fireDataChangeEvent(int type,
java.util.Hashtable keysValues,
java.util.Hashtable attributesValues)
fireDataChangeEvent(int, Hashtable, Hashtable, int)
If a registered listener is an instance of TransactionEntityDataChangeListener, then it is NOT notified.
type - keysValues - attributesValues -
protected void fireDataChangeEvent(int type,
java.util.Hashtable keysValues,
java.util.Hashtable attributesValues,
int sessionId)
If a registered listener is an instance of TransactionEntityDataChangeListener, then it is NOT notified.
type - keysValues - attributesValues - sessionId - identifier of the sessionId of the user that executes the operation
protected void fireTransactionDataChangeEvent(int type,
java.util.Hashtable kv,
java.util.Hashtable av,
java.sql.Connection con)
fireTransactionDataChangeEvent(int, Hashtable, Hashtable, int, Connection)
con is provided to the listener.
If a registered listener is NOT an instance of TransactionEntityDataChangeListener, then it is NOT notified.
type - kv - av - con -
protected void fireTransactionDataChangeEvent(int type,
java.util.Hashtable kv,
java.util.Hashtable av,
int sessionId,
java.sql.Connection con)
con is provided to the listener.
If a registered listener is NOT an instance of TransactionEntityDataChangeListener, then it is NOT notified.
type - kv - av - sessionId - con -
public EntityResult query(java.util.Hashtable keysValues,
java.util.Vector attributes,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
This method calls
query(Hashtable, Vector, int, Connection, Vector, boolean) using
null and true as the last two parameters.
query in interface TransactionalEntitykeysValues - attributes - sessionId - con -
java.lang.Exception - if an error ocurrs
public EntityResult query(java.util.Hashtable keysValues,
java.util.Vector attributes,
int sessionId,
java.sql.Connection con,
java.util.Vector orderColumns,
boolean ascending)
throws java.lang.Exception
The keysValues object determines the conditions that the
records must fulfill, that is, the WHERE clause.
The attributes object determines the columns for each record
that must be returned, that is, the asked columns.
The sessionId number identifies the session.
The orderColumns object determines the order columns, that
is, the columns to use in the ORDER BY clause.
The ascending boolean determines if the order is ascending or
descending.
When overriding, this method must suppose that the connection provided is not in autocommit mode, so all operations are executed in a transaction. This means that in an error ocurrs this method should throw an Exception to ensure that the calling method is properly notified.
The following methods of this class are called:
keysValues - the conditions. The key-value pairs will be interpreted as
column-value conditions.attributes - if empty, all columns will be returnedsessionId - the caller session identifier. Use privileged identifier for
bypassing restrictions.con - the connection to use when executing the queryorderColumns - the order columns. Can be null.ascending - the ascending/descending order
java.lang.Exception - if an error ocurrs or the caller has not permission to execute
the action.
public EntityResult insert(java.util.Hashtable attributesValues,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
The attributesValues object determines the columns and values
that will be inserted.
The sessionId number identifies the session.
When overriding, this method must suppose that the connection provided is not in autocommit mode, so all operations are executed in a transaction. This means that in an error ocurrs this method should throw an Exception to ensure that the calling method is properly notified.
The following methods of this class are called:
attributesValues no insert is performed and no error is
produced.
If there is no error, a TransactionDataChangeEvent is fired and all listeners are notified.
insert in interface TransactionalEntityattributesValues - the table columns and corresponding values to insertsessionId - the session identifiercon - the Connection to use when executing the PreparedStatement
java.lang.Exception - if an error ocurrs or the caller has not permission to execute
the action.protected EntityResult insertAutonumericalAlias(EntityResult res)
res.
This is only done if the autonumericalColumn for this entity
is not null and res contains a pair key-value where key is
the autonumerical column and the value is an Integer.
res -
res object with a new key-value pair if the
conditions above are met
public EntityResult update(java.util.Hashtable attributesValues,
java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
The attributesValues object determines the columns that will
be updated and to which values.
The keysValues object determines the conditions that the
records that will be updated must fulfill, that is, the WHERE clause.
The sessionId number identifies the session.
When overriding, this method must suppose that the connection provided is not in autocommit mode, so all operations are executed in a transaction. This means that in an error ocurrs this method should throw an Exception to ensure that the calling method is properly notified.
The following methods of this class are called:
attributesValues no update is performed and no error is
produced.
If there is no error, a TransactionDataChangeEvent is fired and all listeners are notified.
update in interface TransactionalEntitykeysValues - the table columns and corresponding values to use as conditions
that the records to be updated must fulfillattributesValues - the table columns and corresponding values to insertsessionId - the session identifiercon - the Connection to use when executing the PreparedStatement
java.lang.Exception - if an error ocurrs or the caller has not permission to execute
the action.
public EntityResult delete(java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
The keysValues object determines the conditions that the
records that will be deleted must fulfill, that is, the WHERE clause.
The sessionId number identifies the session.
When overriding, this method must suppose that the connection provided is not in autocommit mode, so all operations are executed in a transaction. This means that in an error ocurrs this method should throw an Exception to ensure that the calling method is properly notified.
The following methods of this class are called:
keysValues no delete
is performed and no error is produced.
If the records to be deleted have attachments, these attachments will also
be deleted. If these attachments are stored on the file system, a query is
performed with keysValues to determine which files must be
deleted.
If there is no error, a TransactionDataChangeEvent is fired and all listeners are notified.
delete in interface TransactionalEntitykeysValues - the table columns and corresponding values to use as conditions
that the records to be deleted must fulfillsessionId - the session identifiercon - the Connection to use when executing the PreparedStatement
java.lang.Exception - if an error ocurrs or the caller has not permission to execute
the action.
protected void preInsert(java.util.Hashtable attributesValues,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
java.lang.Exception
protected void postInsert(EntityResult insertResult,
java.util.Hashtable attributesValues,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
java.lang.Exception
public void preUpdate(java.util.Hashtable attributesValues,
java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
java.lang.Exception
public void postUpdate(EntityResult updateResult,
java.util.Hashtable attributesValues,
java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
java.lang.Exception
public void preDelete(java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
java.lang.Exception
public void postDelete(EntityResult deleteResult,
java.util.Hashtable keysValues,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
java.lang.Exceptionpublic java.util.Vector getWildCardColumns()
public java.util.Vector getUpdateColumns()
public java.util.Vector getOrderColumns()
public java.util.Vector getDescOrderColumns()
public java.util.Vector getColumns()
public java.lang.String getAutonumericalColumn()
protected EntityResult executeStatement(java.lang.String sqlSentence,
java.sql.Connection con)
throws java.lang.Exception
sqlSentence
using the connection con
sqlSentence - the sentence to executecon - the connection to use
java.lang.Exception - if an error ocurrs
protected java.util.Map getSQLTypesFromMetaData(java.util.List columns,
int sessionId)
columns - sessionId -
public java.util.Map getColumnListForAvancedQuery(int sessionId)
throws java.lang.Exception
getColumnListForAvancedQuery in interface AdvancedQueryEntitysessionId - the session identifier
java.lang.Exception
public java.util.Hashtable getSubGroupValues(java.util.Hashtable fieldsValues,
java.util.Vector columns)
getSubGroupValues(Hashtable, Vector, int)
fieldsValues that satisfy the condition that key is contained
in columns.
fieldsValues - columns -
public java.util.Hashtable getSubGroupValues(java.util.Hashtable fieldsValues,
java.util.Vector columns,
int sessionid)
fieldsValues that satisfy the condition that key is contained
in columns.
fieldsValues - columns - sessionid -
public static java.util.Hashtable processingMultipleValueAttributes(java.util.Hashtable keysValues)
keysValues.
Returns a new Hashtable with the same data as keysValues
except that MultipleValue objects are deleted and the key-value pairs of
these objects are added to the new Hashtable.
keysValues -
public boolean deleteAttachmentFile(java.util.Hashtable keysValues,
int sessionId)
throws java.lang.Exception
deleteAttachmentFile(Hashtable, int, Connection)
deleteAttachmentFile in interface FileManagementEntitykeysValues - sessionId -
java.lang.Exception
public boolean deleteAttachmentFile(java.util.Hashtable kv,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
attachmentFilePath is not null, this method executes a
query with conditions keysValues and then if one record is
found, searchs the column named attachmentFileNameColumn and
uses the file name found to delete the file in the file system.
This method requires grants for UPDATE_ACTION to session
sessionId
If more than one record is found an Exception is thrown.
After deleting the file, the following fields (if exist) of the database
table are set to null:
attachmentFileNameColumn,originalAttachmentFileNameColumn,descriptionAttachmentFileColumn,attachmentFileSizeColumn
kv - the conditions that identify the record for which the attachment
must be deletedsessionId - the session identifiercon - the connection to use for executing queries
java.lang.Exception - if an error ocurrspublic java.util.Vector processMultipleAttributeKey(java.util.Vector list)
list.
For each MultipleReferenceDataFieldAttribute found, the objects in MultipleReferenceDataFieldAttribute.getCods() are added to the resulting Vector
list -
protected java.lang.String getAttachmentFilePath(java.util.Hashtable kv,
int sessionId)
throws java.lang.Exception
java.lang.Exception
protected java.lang.String getAttachmentFilePath(java.util.Hashtable kv,
int sessionId,
java.sql.Connection con)
throws java.lang.Exception
java.lang.Exceptionpublic void setName(java.lang.String name)
setName in interface IdentifiedEntitypublic DatabaseConnectionManager getDatabaseConnectionManager()
protected java.util.Vector checkOrderColumns(java.util.Vector order)
|
Ontimize | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||