public abstract class DataObject extends java.lang.Object implements EntityInfo, DataObjectConstructionDetails, Exemptible
SqlDialect
Modifier and Type | Field and Description |
---|---|
protected static ChangeLogger |
changeLogger |
protected java.lang.String[] |
columnNames |
protected int[] |
columnType |
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
htColumnType |
static int |
INSERTMODE |
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
maxFieldSize |
protected java.util.HashMap<java.lang.String,java.lang.Object> |
original |
static int |
UPDATEMODE |
Modifier | Constructor and Description |
---|---|
protected |
DataObject(java.sql.Connection connection)
Constructs a new DataObject with the specified connection.
|
protected |
DataObject(java.sql.Connection newConnection,
IdentifyTemplate identifyTemplate)
Constructs a new DataObject with the specified connection and identify template
|
protected |
DataObject(java.sql.Connection connection,
int maxColumns)
Constructs a new DataObject with the specified connection.
|
protected |
DataObject(java.sql.Connection newConnection,
java.lang.String uniqueKeyName)
Constructs a new DataObject with the specified connection and the name of the
unique key to process updates.
|
protected |
DataObject(DataObjectConstructionDetails dataObjectConstructionDetails)
Constructs a new DataObject with the specified DB connection details.
|
protected |
DataObject(DataObjectConstructionDetails dataObjectConstructionDetails,
int maxColumns)
Constructs a new DataObject with the specified global objects of the
individual application.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataChangeListener(DataChangeListener listener)
Adds the specified ThreadDoneListener to receive data changed events from
any entity.
|
void |
addDataSelectionListener(DataSelectionListener l)
Adds the specified DataSelectionListener to receive data selection events
from this entity.
|
protected void |
alertBadUniqueKey() |
Identifier |
allocateNewIdentifier()
Allocates a new row identifier (primary key).
|
protected boolean |
checkRecoverConnection()
Checks the DB connection, if it has not been used for a while to prevent
Exception "No operations allowed after connection closed"
|
protected void |
closeIfExists(java.sql.Statement statement) |
void |
closePreparedStatementsForWhereCondition()
Closes all prepared statements used with where condition for prepared statements if existing.
|
void |
closeQuery()
Closes the query as opened by select or openQuery statements.
|
void |
commitIfNotAutoCommit()
Makes all changes made since the previous commit/rollback permanent and
releases any database locks currently held by the Connection.
|
boolean |
contains(AbstractTextAttribute attribute,
java.lang.String columnValue)
Indicates, whether a record exists, whose column's value is equals the
specified value.
|
boolean |
contains(NumericAttribute attribute,
int columnValue)
Indicates, whether a record exists, whose column's value is equals the
specified value.
|
boolean |
contains(java.lang.String columnName,
java.sql.Date columnValue)
Indicates, whether a record exists, whose column's value is equals the
specified date.
|
boolean |
contains(java.lang.String columnName,
Identifier identifier)
Indicates, whether a record exists, whose column's value is equals the
specified value.
|
boolean |
contains(java.lang.String columnName,
int columnValue)
Indicates, whether a record exists, whose column's value is equals the
specified value.
|
boolean |
contains(java.lang.String columnName,
java.lang.String columnValue)
Indicates, whether a record exists, whose column's value is equals the
specified value.
|
int |
count(AbstractTextAttribute attribute,
java.lang.String value)
Returns the number of rows of a specific column value.
|
int |
count(NumericAttribute attribute,
int number)
Returns the number of rows of a specific column value.
|
int |
count(java.lang.String columnName,
int number)
Returns the number of rows of a specific column value.
|
int |
count(java.lang.String columnName,
java.lang.String value)
Returns the number of rows of a specific column value.
|
int |
count(java.lang.String field,
WhereConditionForPrepStmts wc)
Counts the rows fitting the where condition.
|
int |
count(WhereConditionForPrepStmts wc)
Counts the rows fitting the where condition using the first column of the identify template.
|
int |
countThrowException(java.lang.String columnName,
int number)
Returns the number of rows of a specific column value.
|
boolean |
delete()
Deletes the currently accessed row, e.g. a row found by nextRow().
|
boolean |
delete(Identifier identifier)
Deletes a row by primary key.
|
protected boolean |
deleteFreeConditioned(java.lang.String whereCondition)
Deletes rows by a free formulated condition.
|
protected boolean |
deleteFreeConditioned(WhereCondition whereCondition)
Deletes rows by a free formulated condition.
|
protected int |
deleteFreeConditionedAndCount(java.lang.String whereCondition)
Deletes rows by a free formulated condition.
|
protected void |
discardStatements()
Discard prepared statements, e.g. to force new creation due to underlying connection has been closed.
|
boolean |
ensureMetaDataIsAvailableForAllColumns()
Ensures that meta data is available for all columns by executing a query over all
columns if necessary.
|
protected void |
finalize() |
void |
fireDataChanged(DataChangedEvent e)
Notifies all listeners that have registered interest for notification on
this event type.
|
void |
free()
Releases external resources.
|
boolean |
getBoolean(BooleanAttribute attribute)
Gets the value of the specified column as boolean.
|
boolean |
getBoolean(java.lang.String columnName)
Gets the value of the specified column as boolean.
|
byte[] |
getBytes(java.lang.String columnName)
Return the bytes of the specified column.
|
int |
getColumnCount()
Returns the number of available columns.
|
java.lang.String |
getColumnLabel()
Returns the label of the current column.
|
int |
getColumnLength(java.lang.String columnName)
Returns the length of the specified column.
|
java.lang.String |
getColumnName()
Returns the name of the current column.
|
java.lang.String |
getColumnName(int columnPointer)
Returns the column name of the indicated array position.
|
int |
getColumnScale()
Returns the scale of the current column.
|
int |
getColumnType()
Returns the type of the current column.
|
int |
getColumnType(int columnPointer)
Returns the column type of the indicated array position.
|
int |
getColumnType(java.lang.String columnName)
Returns the type of the specified column.
|
int |
getColumnType(java.lang.String columnName,
boolean informIfNotAvailable)
Returns the type of the specified column.
|
java.sql.Connection |
getConnection()
Returns the used connection.
|
java.sql.Date |
getDate(DateAttribute attribute)
Gets the value of the specified column as date.
|
protected java.sql.Date |
getDate(java.lang.Integer intDate) |
java.sql.Date |
getDate(java.lang.String columnName)
Gets the value of the specified column as date.
|
java.lang.String |
getDateFormattedWithShortYear(java.lang.String columnName) |
HintContainer |
getDeletionHindrance(Identifier identifier)
Returns a hint container with hints why an item cannot be deleted -
if the container's getHint() method returns null there is no hindrance to delete an item.
|
java.lang.String |
getDescription(java.lang.String field)
Returns the description of the specified field.
|
java.lang.String |
getDescription(java.lang.String columnName,
AbstractAttribute[] atrributes)
Retrieves the internal description the specified column.
|
double |
getDouble(NumericAttribute attribute)
Gets the value of the specified column as double.
|
double |
getDouble(java.lang.String columnName)
Gets the value of the specified column as double.
|
protected java.lang.String |
getEntityId()
Returns the entity id.
|
java.lang.String |
getFailedQueryExpression()
Returns the failed query expression.
|
float |
getFloat(java.lang.String columnName)
Gets the value of the specified column as float.
|
java.lang.String |
getGlobalWhereCondition(java.lang.String textToFind)
Gets the global where condition for searching a value in all available and
castable columns.
|
java.lang.String |
getGlobalWhereCondition(java.lang.String textToFind,
java.lang.String additionalCondition)
Returns the global where condition for searching a value in all available and
castable columns.
|
Identifier |
getIdentifier()
Returns the identifier (primary key) of the current row.
|
IdentifyTemplate |
getIdentifyTemplate()
Returns the identify template.
|
int |
getIdentifyValueInt()
Returns the int primary key of the current row.
|
java.lang.String |
getIdentifyWhereCondition()
Returns the where condition to identify the current row without the word
"where".
|
IdManager |
getIdManager()
Returns the used Id Manager.
|
int |
getInt(NumericAttribute attribute)
Gets the value of the specified column as integer.
|
int |
getInt(java.lang.String columnName)
Gets the value of the specified column as integer.
|
java.lang.String |
getIntAsStringZeroSuppressed(java.lang.String columnName)
Gets the value of the specified Integer containing column as String with
zero suppression.
|
protected java.lang.String |
getKeyExtendedFieldSelection(java.lang.String fieldSelection)
Returns the extended field selection including all primary key fields.
|
java.lang.Exception |
getLastException()
Return the last exception occurring in update().
|
java.sql.SQLException |
getLoadException()
Returns the loadException or null if no exception occurred.
|
long |
getLong(java.lang.String columnName)
Gets the value of the specified column as long.
|
int |
getmaxRow(int licenceType)
Returns the maximum allowed rows to insert.
|
int |
getMode()
Returns the mode.
|
int |
getNbrOfFittingItems(java.lang.String whereCondition)
Returns the number of items which fit the where condition.
|
int |
getNbrOfFittingItems(java.lang.String selectionFieldName,
java.lang.String whereCondition)
Returns the number of items which fit the where condition.
|
int |
getNbrOfFittingItems(java.lang.String selectionFieldName,
WhereCondition whereCondition)
Returns the number of items which fit the where condition.
|
int |
getNbrOfFittingItems(java.lang.String selectionFieldName,
WhereConditionForPrepStmts whereCondition)
Returns the number of items which fit the where condition.
|
int |
getNbrOfFittingItems(WhereCondition whereCondition)
Returns the number of items which fit the where condition.
|
int |
getNbrOfFittingItems(WhereConditionForPrepStmts whereCondition)
Returns the number of items which fit the where condition.
|
java.lang.Object |
getObject(java.lang.String columnName)
Returns the value of a column as an object.
|
protected java.lang.Object |
getOriginalOf(java.lang.String columnName) |
java.sql.SQLException |
getQueryException()
Returns the queryException.
|
java.sql.Date |
getRecordingDate()
Returns the recording date.
|
java.lang.String |
getRecordingUser()
Returns the current user recording table rows.
|
int |
getRowCount() |
java.lang.String |
getSqlCompareString(boolean b) |
java.lang.String |
getSqlCompareString(java.sql.Date date)
Returns the date in the way the database dialect expects it in the where clause.
|
java.lang.String |
getText(AbstractTextAttribute attribute)
Gets the value of the specified column as text.
|
java.lang.String |
getText(java.lang.String columnName)
Gets the value of the specified column as text.
|
java.lang.String |
getTextNoMatterWhatTypeOfColumn(java.lang.String columnName)
Gets the value of the specified column as text.
|
java.sql.Time |
getTime(java.lang.String columnName)
Returns the value of the specified column as time.
|
java.sql.Timestamp |
getTimestamp(java.lang.String columnName)
Returns the value of the specified column as Timestamp.
|
java.lang.String |
getUniqueKeyName()
Returns the name of the primary key.
|
protected boolean |
getWorkedOnBoolean(java.lang.String columnName)
Gets the value of the specified column as boolean in a worked on state -
it might already been modified and differ from the original value.
|
java.sql.Date |
getWorkedOnDate(java.lang.String columnName)
Gets the value of the specified column as date in a worked on state -
it might already been modified and differ from the original value.
|
double |
getWorkedOnDouble(java.lang.String columnName)
Gets the value of the specified column as double in a worked on state -
it might already been modified and differ from the original value.
|
int |
getWorkedOnInt(java.lang.String columnName)
Gets the value of the specified column as int in a worked on state -
it might already been modified and differ from the original value.
|
protected java.lang.Object |
getWorkedOnOf(java.lang.String columnName) |
java.lang.String |
getWorkedOnText(AbstractTextAttribute attribute)
Gets the value of the specified column as text in a worked on state -
it might already been modified and differ from the original value.
|
java.lang.String |
getWorkedOnText(java.lang.String columnName)
Gets the value of the specified column as text in a worked on state -
it might already been modified and differ from the original value.
|
java.sql.Time |
getWorkedOnTime(java.lang.String columnName)
Gets the value of the specified column as time in a worked on state -
it might already been modified and differ from the original value.
|
java.sql.Timestamp |
getWorkedOnTimestamp(java.lang.String columnName)
Gets the value of the specified column as Timestamp in a worked on state -
it might already been modified and differ from the original value.
|
void |
insert()
Inserts the prepared row in the database.
|
boolean |
isAvailable(java.lang.String whereCondition)
Indicates, whether a where condition will find results.
|
boolean |
isAvailable(java.lang.String whereCondition,
java.lang.String fieldSelection)
Indicates, whether a where condition will find results.
|
boolean |
isAvailable(WhereConditionForPrepStmts whereCondition)
Indicates, whether a where condition will find results.
|
boolean |
isColumnContained(java.lang.String columnName)
Checks if the specified column is in the currently watched result set.
|
protected boolean |
isColumnToUseForGlobalSearch(java.lang.String columnName)
Returns true if the specified column is to use to build global where condition.
|
boolean |
isDeletionAllowed(Identifier identifier)
Checks of deletion of a row is allowed.
|
boolean |
isKnownAsBoolean(java.lang.String columnName)
Checks whether or not the specified column is of type boolean by
evaluating the attributes of the data object if available.
|
boolean |
isMemo(java.lang.String columnName) |
boolean |
isModified()
Checks if there have been any modifications made on the current row.
|
boolean |
isModifiedColumn(java.lang.String columnName)
Checks if there have been any modifications made on the current row.
|
boolean |
isQueryFindingRecords(java.lang.String queryExpression)
Indicates, whether a query expression will find results.
|
boolean |
isQueryFindingRecords(WhereCondition wc)
Indicates, whether a query expression will find results.
|
boolean |
load()
Loads a row as specified by the primary key previously specified by
|
boolean |
load(Identifier identifier)
Loads a row as specified by the primary key.
|
boolean |
load(Identifier identifier,
java.lang.String columns)
Loads a row as specified by the primary key .
|
boolean |
load(int identifyInt)
Loads a row as specified by the primary key.
|
boolean |
load(int identifyInt,
java.lang.String columns)
Loads a row as specified by the primary key.
|
boolean |
load(long identifyLong)
Loads a row as specified by the primary key.
|
boolean |
load(java.lang.String identifyString)
Loads a row as specified by the primary key.
|
boolean |
loadColumns(java.lang.String columns)
Loads a row as specified by the primary key previously specified by
|
boolean |
loadFirst(WhereConditionForPrepStmts wc)
Loads the first row fitting the where condition and returns true if row was found.
|
protected void |
logDebug(java.lang.String text)
Logs a message as a debug information.
|
protected void |
logError(java.lang.String text)
Logs a message as an error.
|
protected void |
logError(java.lang.String text,
java.lang.Throwable throwable)
Logs a message as an error.
|
protected void |
logError(java.lang.Throwable throwable)
Logs a message as an error.
|
protected void |
logInfo(java.lang.String text)
Logs a message as information.
|
boolean |
newRow()
Prepares an insert by initializing a new row.
|
Identifier |
newRowWithNextIdentifierAllocation()
Prepares an insert by initializing a new row plus allocating a new primary
key value.
|
boolean |
nextColumn()
Increases the column pointer.
|
boolean |
nextRow()
Loads the next row according to the previous select statement.
|
boolean |
openQuery(java.lang.String queryString)
Invokes a database query for following record requests via
nextRow() . |
void |
openQueryThrowException(java.lang.String queryString)
Invokes a database query for following record requests via
nextRow() . |
protected DataObject |
register(DataObject dataObject)
Registers a DataObject as Co-DataObject
|
void |
removeDataChangeListener(DataChangeListener listener)
Removes the specified DataChangeListener to receive data changed events
from any entity.
|
void |
removeDataSelectionListener(DataSelectionListener l)
Removes the specified DataSelectionListener to receive data selection events
from this entity.
|
void |
resetColumnPointer()
Sets the column pointer to 0.
|
void |
rollbackIfNotAutoCommit()
Drops all changes made since the previous commit/rollback and releases any
database locks currently held by this Connection.
|
boolean |
save()
Saves the current row.
|
void |
save(boolean furtherSaveIsPending)
Saves the current row and indicates if further save calls will follow.
|
void |
save(java.lang.Class<?> dataChangeSender,
int sequenceType)
Saves the current row.
|
boolean |
searchGlobal(java.lang.String textToFind)
Starts a select statement for searching a value in all available and
castable columns.
|
boolean |
searchGlobal(java.lang.String textToFind,
java.lang.String additionalCondition)
Starts a select statement for searching a value in all available and
castable columns.
|
boolean |
select(java.lang.String fieldSelection)
Invokes a database query for following record requests via
nextRow() . |
boolean |
select(java.lang.String fieldSelection,
java.lang.String whereCondition)
Invokes a database query for following record requests via
nextRow() . |
boolean |
select(java.lang.String fieldSelection,
java.lang.String whereCondition,
java.lang.String orderByFields)
Invokes a database query for following record requests via
nextRow() . |
boolean |
select(java.lang.String fieldSelection,
java.lang.String whereCondition,
java.lang.String orderByFields,
int limit)
Invokes a database query for following record requests via
nextRow() . |
boolean |
select(java.lang.String fieldSelection,
java.lang.String whereCondition,
java.lang.String orderByFields,
int limit,
int offset)
Invokes a database query for following record requests via
nextRow() . |
boolean |
select(java.lang.String fieldSelection,
java.lang.String joinedTables,
WhereConditionForPrepStmts wc,
java.lang.String orderByFields)
Invokes a database query with multiple joined tables for following record requests via
nextRow() . |
boolean |
select(java.lang.String fieldSelection,
WhereCondition whereCondition)
Invokes a database query for following record requests via
nextRow() . |
boolean |
select(java.lang.String fieldSelection,
WhereConditionForPrepStmts wc)
Invokes a database query for following record requests via
nextRow() . |
boolean |
select(java.lang.String fieldSelection,
WhereConditionForPrepStmts wc,
java.lang.String orderByFields)
Invokes a database query for following record requests via
nextRow() . |
boolean |
select(java.lang.String fieldSelection,
WhereCondition whereCondition,
java.lang.String orderByFields)
Invokes a database query for following record requests via
nextRow() . |
boolean |
select(WhereCondition whereCondition)
Invokes a database query for following record requests via
nextRow() loading all available columns. |
boolean |
select(WhereConditionForPrepStmts wc)
Invokes a database query for following record requests via
nextRow() loading all available columns. |
boolean |
select(WhereConditionForPrepStmts wc,
java.lang.String orderByFields)
Invokes a database query for following record requests via
nextRow() loading all available columns. |
boolean |
select(WhereCondition whereCondition,
java.lang.String orderByFields)
Invokes a database query for following record requests via
nextRow() . |
boolean |
selectForStreaming(java.lang.String fieldSelection)
Invokes a database query for following record requests via
nextRow() for streaming. |
void |
setBoolean(java.lang.String columnName,
boolean boolValue)
Sets the value of the specified column.
|
static void |
setChangeLog(ChangeLogStd newChangeLog) |
static void |
setChangeLogger(ChangeLogger newChangeLogger) |
protected void |
setColumnNameOfRecordingDate(java.lang.String newColumnNameOfRecordingDate)
Sets the column name of the recording date.
|
void |
setConnection(java.sql.Connection connection)
Sets the database connection, which may become necessary in context with connection pooling.
|
void |
setDate(DateAttribute attribute,
java.sql.Date dateValue)
Sets the value of the specified column.
|
void |
setDate(java.lang.String columnName,
java.util.Date dateValue)
Sets the value of the specified column.
|
void |
setDate(java.lang.String columnName,
java.sql.Date dateValue)
Sets the value of the specified column.
|
void |
setDouble(NumericAttribute attribute,
double doubleValue)
Sets the value of the specified column.
|
void |
setDouble(java.lang.String columnName,
double doubleValue)
Sets the value of the specified column.
|
void |
setDouble(java.lang.String columnName,
java.lang.Double doubleValue)
Sets the value of the specified column.
|
void |
setFloat(java.lang.String columnName,
float floatValue)
Sets the value of the specified column.
|
void |
setIdentifier(Identifier newIdentifier)
Sets the identifier (primary key) of the row to select.
|
void |
setIdentityValue(int identifyValueInt)
Sets the identify value (primary key) of the row to select.
|
void |
setIdentityValue(long identifyValueLong)
Sets the identify value (primary key) of the row to select.
|
void |
setIdentityValue(java.lang.String identifyString)
Sets the identify value (primary key) of the row to select.
|
void |
setIdInclOriginal(java.lang.String columnName,
Identifier newIdentifier)
Sets the identifier of the current row to the specified value.
|
void |
setIdManager(IdManager newIdManager)
Sets the ID manager.
|
void |
setInt(NumericAttribute attr,
int intValue)
Sets the value of the specified column.
|
void |
setInt(java.lang.String columnName,
int intValue)
Sets the value of the specified column.
|
void |
setLong(java.lang.String columnName,
long longValue)
Sets the value of the specified column.
|
void |
setNoLogging()
Blocks the statically logging specification for this instance only.
|
void |
setObject(java.lang.String columnName,
java.lang.Object newObject)
Sets the value of a column.
|
void |
setReadBigDecimalAsInt(boolean newReadBigDecimalAsInt)
Indicates if column type BigDecimal should be read as int.
|
static void |
setRecordingUser(java.lang.String newRecordingUser)
Sets the name of the recording user.
|
protected void |
setRecordingUser(java.lang.String columnNameOfRecordingUser,
java.lang.String newRecordingUser)
Sets the column name of the recording user.
|
void |
setSilentUpdate(boolean newSilentUpdate)
Sets the specified boolean to indicate whether insert and update should
be done with or without firing data change events.
|
void |
setText(AbstractTextAttribute attribute,
java.lang.String text)
Sets the text of the specified column.
|
void |
setText(java.lang.String columnName,
java.lang.String text)
Sets the text of the specified column.
|
void |
setTime(java.lang.String columnName,
java.sql.Time timeValue)
Sets the value of the specified column.
|
void |
setTimestamp(java.lang.String columnName,
java.sql.Timestamp timestampValue)
Sets the value of the specified column.
|
protected void |
sqlExceptionConsequences() |
java.lang.String |
sqlSecure(java.lang.String stringField)
Replaces ' by '' to avoid SQL error while inserting or updating.
|
java.lang.String |
unifyColumnName(java.lang.String columnName)
Unifies the column name to avoid errors of any kind.
|
java.lang.String |
unifyColumnNameForHashMapKey(java.lang.String columnName)
Unifies the column name to access hash table keys.
|
java.lang.String |
unifyTableName(java.lang.String tableName)
Unifies the table name to avoid errors of any kind.
|
boolean |
update()
Updates the current row if necessary and returns true if update occurred.
|
protected void |
updateIdentifier() |
void |
updateOrInsert(Identifier identifier,
java.lang.String columnName,
java.lang.String columnValue)
Quick update or insert of a single column in a single row.
|
void |
updateOrInsert(java.lang.String identifyString,
java.lang.String columnName,
java.lang.String columnValue)
Quick update or insert of a single column in a single row.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAttributes, getForeignKeys, getIndices, getTableName
protected static ChangeLogger changeLogger
public static final int INSERTMODE
public static final int UPDATEMODE
protected java.lang.String[] columnNames
protected int[] columnType
protected java.util.HashMap<java.lang.String,java.lang.Integer> htColumnType
protected java.util.HashMap<java.lang.String,java.lang.Integer> maxFieldSize
protected java.util.HashMap<java.lang.String,java.lang.Object> original
protected DataObject(DataObjectConstructionDetails dataObjectConstructionDetails)
dataObjectConstructionDetails
- the DB connection details to useprotected DataObject(DataObjectConstructionDetails dataObjectConstructionDetails, int maxColumns)
newConnection
- the connection to the database to usemaxColumns
- the maximum number of columns for cache dimensioningprotected DataObject(java.sql.Connection newConnection, java.lang.String uniqueKeyName)
newConnection
- the connection to the database to useuniqueKeyName
- the name of the unique key fieldprotected DataObject(java.sql.Connection newConnection, IdentifyTemplate identifyTemplate)
newConnection
- the connection to the database to useidentifyTemplate
- the identify template to build where conditions when loading entries by identifierprotected DataObject(java.sql.Connection connection)
connection
- the connection to the database to useprotected DataObject(java.sql.Connection connection, int maxColumns)
connection
- the connection to the database to usemaxColumns
- the maximum number of columns for cache capacitypublic static void setChangeLog(ChangeLogStd newChangeLog)
public static void setChangeLogger(ChangeLogger newChangeLogger)
public java.sql.Date getRecordingDate()
public void setConnection(java.sql.Connection connection)
connection
- the new connectionpublic void setSilentUpdate(boolean newSilentUpdate)
newSilentUpdate
- the boolean to be set, if true insert and update is done silentlypublic void setNoLogging()
public void setReadBigDecimalAsInt(boolean newReadBigDecimalAsInt)
newReadBigDecimalAsInt
- a boolean value, true if BigDecimal should
be read as int.protected void setColumnNameOfRecordingDate(java.lang.String newColumnNameOfRecordingDate)
newColumnNameOfRecordingDate
- the name of the column which is to be
filled with the recording date.protected void setRecordingUser(java.lang.String columnNameOfRecordingUser, java.lang.String newRecordingUser)
columnNameOfRecordingUser
- the name of the column which is to be
filled by the recording userrecordingUser
- the name of the recording userpublic static void setRecordingUser(java.lang.String newRecordingUser)
recordingUser
- the name of the recording userpublic java.sql.Connection getConnection()
new MyDataObject(this)
.getConnection
in interface DataObjectConstructionDetails
DataObjectConstructionDetails.getConnection()
public IdManager getIdManager()
getIdManager
in interface DataObjectConstructionDetails
DataObjectConstructionDetails.getIdManager()
public java.lang.String getRecordingUser()
public java.lang.String getDescription(java.lang.String field)
field
- the name of the field which description should be returnedpublic java.lang.String getDescription(java.lang.String columnName, AbstractAttribute[] atrributes)
columnName
- the name of the columnatrributes
- an attribute array where the column is to be foundpublic boolean contains(AbstractTextAttribute attribute, java.lang.String columnValue)
attribute
- the attribute of the column to checkcolumnValue
- the value of the column to be foundpublic boolean contains(java.lang.String columnName, java.lang.String columnValue)
columnName
- the name of the column to checkcolumnValue
- the value of the column to be foundpublic boolean contains(java.lang.String columnName, Identifier identifier)
columnName
- the name of the column to checkidentifier
- the value of the column to be foundpublic boolean contains(NumericAttribute attribute, int columnValue)
attribute
- the attribute of the columncolumnValue
- the value of the column to be foundpublic boolean contains(java.lang.String columnName, int columnValue)
columnName
- the name of the column to checkcolumnValue
- the value of the column to be foundpublic boolean contains(java.lang.String columnName, java.sql.Date columnValue)
columnName
- the name of the date column to checkcolumnValue
- the date value to be foundpublic int count(NumericAttribute attribute, int number)
attribute
- the attribute of the column to check valuenumber
- the number to querypublic int count(java.lang.String columnName, int number)
columnName
- the name of the column to check valuenumber
- the number to querypublic int countThrowException(java.lang.String columnName, int number) throws java.sql.SQLException
columnName
- the name of the column to check valuenumber
- the number to queryjava.sql.SQLException
public int count(AbstractTextAttribute attribute, java.lang.String value)
attribute
- the attribute of the column to check valuenumber
- the number to querypublic int count(java.lang.String columnName, java.lang.String value)
columnName
- the name of the column to check valuenumber
- the number to querypublic java.lang.String getSqlCompareString(java.sql.Date date)
date
- the date to formatpublic java.lang.String getSqlCompareString(boolean b)
public boolean isAvailable(WhereConditionForPrepStmts whereCondition)
whereCondition
- the where condition to be checkedpublic boolean isAvailable(java.lang.String whereCondition)
whereCondition
- the where condition to be checkedpublic boolean isAvailable(java.lang.String whereCondition, java.lang.String fieldSelection)
whereCondition
- the where condition to be checkedfieldSelection
- the names of the fields/columns to be used in the
check statementpublic boolean isQueryFindingRecords(WhereCondition wc)
wc
- the where condition to reduce the result setloadFirst(WhereConditionForPrepStmts)
public boolean isQueryFindingRecords(java.lang.String queryExpression)
queryExpression
- the query expression to checkpublic int getRowCount()
public int getNbrOfFittingItems(WhereConditionForPrepStmts whereCondition)
whereCondition
- the condition to reduce the result setpublic int getNbrOfFittingItems(java.lang.String selectionFieldName, WhereConditionForPrepStmts whereCondition)
selectionFieldName
- the name of the fields to be used for the search.whereCondition
- the condition to reduce the result setpublic int getNbrOfFittingItems(WhereCondition whereCondition)
whereCondition
- the condition to reduce the result setpublic int getNbrOfFittingItems(java.lang.String whereCondition)
whereCondition
- the condition to reduce the result setpublic int getNbrOfFittingItems(java.lang.String selectionFieldName, WhereCondition whereCondition)
selectionFieldName
- the name of the fields to be used for the search.whereCondition
- the condition to reduce the result setpublic int getNbrOfFittingItems(java.lang.String selectionFieldName, java.lang.String whereCondition)
selectionFieldName
- the name of the fields to be used for the search.whereCondition
- the condition to reduce the result setpublic boolean select(java.lang.String fieldSelection)
nextRow()
.
Always invoke closeQuery()
to release table handle in
the end.fieldSelection
- the fields to be selectedopenQuery(java.lang.String)
,
closeQuery()
public boolean selectForStreaming(java.lang.String fieldSelection)
nextRow()
for streaming.
This means, no other query may be done with the same connection while the
query is used.
Always invoke closeQuery()
to release table handle in
the end.fieldSelection
- the fields to be selectedopenQuery(java.lang.String)
,
closeQuery()
public boolean select(WhereCondition whereCondition)
nextRow()
loading all available columns.
Always invoke closeQuery()
to release table handle in the end.whereCondition
- the condition to reduce the result setopenQuery(java.lang.String)
,
closeQuery()
public boolean select(java.lang.String fieldSelection, WhereCondition whereCondition)
nextRow()
.
Always invoke closeQuery()
to release table handle in the end.fieldSelection
- a sequence of field names to be accessed, separated
by commawhereCondition
- the condition to reduce the result setopenQuery(java.lang.String)
,
closeQuery()
public boolean select(java.lang.String fieldSelection, java.lang.String whereCondition)
nextRow()
.
Always invoke closeQuery()
to release table handle in the end.
public boolean isDeletionAllowed(Identifier identifier) { if (doMedien == null) doMedien = new DoMedien(); doMedien.select("MedienNi, KatalogNi", "KatalogNi = " + identifier.getIntIdentifier()); while (doMedien.nextRow()) { if (!doMedien.isDeletionAllowed(doMedien.getIdentifier())) { doMedien.closeQuery(); return false; } } doMedien.closeQuery(); return true; }
fieldSelection
- a sequence of field names to be accessed, separated
by commawhereCondition
- the condition to reduce the result setopenQuery(java.lang.String)
,
closeQuery()
public boolean select(WhereCondition whereCondition, java.lang.String orderByFields)
nextRow()
.
Always invoke closeQuery()
to release table handle in
the end.whereCondition
- the condition to reduce the result setorderByFields
- the fields to be used for the order by clause, separated
by commaopenQuery(java.lang.String)
,
closeQuery()
public boolean select(java.lang.String fieldSelection, WhereCondition whereCondition, java.lang.String orderByFields)
nextRow()
.
Always invoke closeQuery()
to release table handle in
the end.fieldSelection
- a sequence of field names to be accessed, separated
by commawhereCondition
- the condition to reduce the result setorderByFields
- the fields to be used for the order by clause, separated
by commaopenQuery(java.lang.String)
,
closeQuery()
public boolean select(java.lang.String fieldSelection, java.lang.String whereCondition, java.lang.String orderByFields)
nextRow()
.
Always invoke closeQuery()
to release table handle in
the end.fieldSelection
- a sequence of field names to be accessed, separated
by commawhereCondition
- the condition to reduce the result setorderByFields
- the fields to be used for the order by clause, separated
by commaopenQuery(java.lang.String)
,
closeQuery()
public boolean select(java.lang.String fieldSelection, java.lang.String whereCondition, java.lang.String orderByFields, int limit)
nextRow()
.
Always invoke closeQuery()
to release table handle in
the end.fieldSelection
- a sequence of field names to be accessed, separated
by commawhereCondition
- the condition to reduce the result setorderByFields
- the fields to be used for the order by clause, separated
by commalimit
- maximum of entries to be put into the result set - supported by MySQL onlyopenQuery(java.lang.String)
,
closeQuery()
public boolean select(java.lang.String fieldSelection, java.lang.String whereCondition, java.lang.String orderByFields, int limit, int offset)
nextRow()
.
Always invoke closeQuery()
to release table handle in
the end.fieldSelection
- a sequence of field names to be accessed, separated
by commawhereCondition
- the condition to reduce the result setorderByFields
- the fields to be used for the order by clause, separated
by commalimit
- maximum of entries to be put into the result set - supported by MySQL onlyoffset
- the number of records that don't have to be read anymore - supported by MySQL onlyopenQuery(java.lang.String)
,
closeQuery()
protected java.lang.String getKeyExtendedFieldSelection(java.lang.String fieldSelection)
fieldSelection
- the field selection with or without primary key fieldspublic boolean searchGlobal(java.lang.String textToFind)
textToFind
- the text to be found globallypublic boolean searchGlobal(java.lang.String textToFind, java.lang.String additionalCondition)
textToFind
- the text to be found globallyadditionalCondition
- additional where conditions to be combined with
the global searchpublic java.lang.String getGlobalWhereCondition(java.lang.String textToFind)
textToFind
- the text to be found globallypublic java.lang.String getGlobalWhereCondition(java.lang.String textToFind, java.lang.String additionalCondition)
textToFind
- the text to be found globallyadditionalCondition
- additional where conditions to be combined with
the global searchprotected boolean isColumnToUseForGlobalSearch(java.lang.String columnName)
columnName
- the name of the column to checkpublic boolean openQuery(java.lang.String queryString)
nextRow()
. If possible, it is recommended to use the
select()
methods instead.
Always invoke closeQuery()
to release table handle in
the end.
SQL Errors will be logged automatically.queryString
- query string to be executedcloseQuery()
public void openQueryThrowException(java.lang.String queryString) throws java.sql.SQLException
nextRow()
. If possible, it is recommended to use the
select()
methods instead.
Always invoke closeQuery()
to release table handle in
the end.queryString
- query string to be executedjava.sql.SQLException
public boolean nextRow()
select(java.lang.String)
public void closeQuery()
public void closePreparedStatementsForWhereCondition()
public java.sql.SQLException getLoadException()
public java.sql.SQLException getQueryException()
public java.lang.String getFailedQueryExpression()
public void setIdentityValue(int identifyValueInt)
identifyValueInt
- the value of the primary key to be selectedpublic void setIdentityValue(long identifyValueLong)
identifyValueLong
- the value of the primary key to be selectedpublic void setIdentityValue(java.lang.String identifyString)
identifyString
- the value of the primary key to be selectedpublic void setIdentifier(Identifier newIdentifier)
identifyValueLong
- the value of the primary key to be selectedpublic Identifier newRowWithNextIdentifierAllocation()
public boolean newRow()
public boolean ensureMetaDataIsAvailableForAllColumns()
public void setIdManager(IdManager newIdManager)
newIdManager
- the new ID manager to usepublic Identifier allocateNewIdentifier()
protected java.lang.String getEntityId()
public void setIdInclOriginal(java.lang.String columnName, Identifier newIdentifier)
columnName
- newIdentifyValueInt
- public void insert()
newRow()
protected void alertBadUniqueKey()
public boolean load(int identifyInt)
identifyInt
- the primary key value of the row to loadpublic boolean load(int identifyInt, java.lang.String columns)
identifyInt
- the primary key value of the row to loadcolumns
- the names of the columns to be part of result set, separatedpublic boolean load(long identifyLong)
identifyLong
- the primary key value of the row to loadpublic boolean load(java.lang.String identifyString)
identifyString
- the primary key value of the row to loadpublic boolean load(Identifier identifier)
identifier
- the primary key value of the row to loadpublic boolean load(Identifier identifier, java.lang.String columns)
newIdentifyValueInt
- the primary key value of the row to loadcolumns
- the names of the columns to be part of result set, separated
by commapublic boolean loadFirst(WhereConditionForPrepStmts wc)
wc
- the where condition to find the first recordpublic boolean load()
setIdentityValue(int)
setIdentityValue(int)
public boolean loadColumns(java.lang.String columns)
setIdentityValue(int)
columns
- the names of the columns to be part of result set, separated
by commasetIdentityValue(int)
public void save(java.lang.Class<?> dataChangeSender, int sequenceType)
dataChangeSender
- the class who causes the data change.sequenceType
- the type of the save sequence which may be
DataChangedEvent.SINGLE_TYPE
,
DataChangedEvent.NOT_THE_LAST_OF_A_SEQUENCE_TYPE
or
DataChangedEvent.SUMMARY_TYPE
DataChangedEvent
public void save(boolean furtherSaveIsPending)
furtherSaveIsPending
- true to indicate that further save calls will followpublic boolean save()
public void updateOrInsert(java.lang.String identifyString, java.lang.String columnName, java.lang.String columnValue)
newIdentifyValueString
- the primary keycolumnName
- the name of the columncolumnValue
- the value of the columnpublic void updateOrInsert(Identifier identifier, java.lang.String columnName, java.lang.String columnValue)
newIdentifyValueString
- the primary keycolumnName
- the name of the columncolumnValue
- the value of the columnpublic boolean update()
public void commitIfNotAutoCommit()
java.sql.SQLException
- if a database access error occurspublic void rollbackIfNotAutoCommit()
java.sql.SQLException
- if a database access error occursprotected void updateIdentifier()
public java.lang.String unifyTableName(java.lang.String tableName)
tableName
- the name of the table to unifypublic java.lang.String unifyColumnName(java.lang.String columnName)
columnName
- the name of the column to unifypublic java.lang.String unifyColumnNameForHashMapKey(java.lang.String columnName)
columnName
- the name of the column to unifypublic java.lang.String getIdentifyWhereCondition()
public java.lang.String sqlSecure(java.lang.String stringField)
public void resetColumnPointer()
public boolean nextColumn()
public java.lang.String getColumnName()
public java.lang.String getColumnLabel()
public int getColumnType()
public int getColumnType(java.lang.String columnName)
columnName
- the name of the columnpublic int getColumnType(java.lang.String columnName, boolean informIfNotAvailable)
columnName
- the name of the columninformIfNotAvailable
- log information if type of the column isn't availablepublic boolean isMemo(java.lang.String columnName)
public int getColumnLength(java.lang.String columnName)
columnName
- the name of the columnpublic int getColumnScale()
public java.lang.Object getObject(java.lang.String columnName)
columnName
- the name of the columnpublic void setObject(java.lang.String columnName, java.lang.Object newObject)
columnName
- the name of the columnnewObject
- the new value of the column to setpublic java.lang.String getText(AbstractTextAttribute attribute)
attribute
- the attribute of the columnpublic boolean isKnownAsBoolean(java.lang.String columnName)
columnName
- the name of the column to be checked as boolean typepublic java.lang.String getText(java.lang.String columnName)
columnName
- the name of the columnpublic java.lang.String getTextNoMatterWhatTypeOfColumn(java.lang.String columnName)
columnName
- the name of the columnpublic java.lang.String getWorkedOnText(AbstractTextAttribute attribute)
attribute
- the attribute of the columnpublic java.lang.String getWorkedOnText(java.lang.String columnName)
columnName
- the name of the columnpublic void setText(AbstractTextAttribute attribute, java.lang.String text)
attribute
- the attribute representing the columntext
- the new value of the columnpublic void setText(java.lang.String columnName, java.lang.String text)
columnName
- the name of the column to be modifiedtext
- the new value of the columnpublic float getFloat(java.lang.String columnName)
columnName
- the name of the columnpublic void setFloat(java.lang.String columnName, float floatValue)
columnName
- the name of the column to be modifiedfloatValue
- the new value of the columnpublic double getDouble(NumericAttribute attribute)
attribute
- the attribute of the columnpublic double getDouble(java.lang.String columnName)
columnName
- the name of the columnpublic double getWorkedOnDouble(java.lang.String columnName)
columnName
- the name of the columnpublic void setDouble(NumericAttribute attribute, double doubleValue)
attribute
- the attribute of the columndoubleValue
- the new value of the columnpublic void setDouble(java.lang.String columnName, double doubleValue)
columnName
- the name of the column to be modifieddoubleValue
- the new value of the columnpublic void setDouble(java.lang.String columnName, java.lang.Double doubleValue)
columnName
- the name of the column to be modifieddoubleValue
- the new value of the columnpublic int getInt(NumericAttribute attribute)
attribute
- the attribute of the columnpublic int getInt(java.lang.String columnName)
columnName
- the name of the columnpublic java.lang.String getIntAsStringZeroSuppressed(java.lang.String columnName)
columnName
- the name of the columnpublic int getWorkedOnInt(java.lang.String columnName)
columnName
- the name of the columnpublic void setInt(NumericAttribute attr, int intValue)
attr
- the attribute specifying the columnintValue
- the new value of the columnpublic void setInt(java.lang.String columnName, int intValue)
columnName
- the name of the column to be modifiedintValue
- the new value of the columnpublic long getLong(java.lang.String columnName)
columnName
- the name of the columnpublic void setLong(java.lang.String columnName, long longValue)
columnName
- the name of the column to be modifiedlongValue
- the new value of the columnpublic java.lang.String getDateFormattedWithShortYear(java.lang.String columnName)
public java.sql.Date getDate(DateAttribute attribute)
attribute
- the attribute of the columnpublic java.sql.Date getDate(java.lang.String columnName)
columnName
- the name of the columnprotected java.sql.Date getDate(java.lang.Integer intDate)
public java.sql.Date getWorkedOnDate(java.lang.String columnName)
columnName
- the name of the columnpublic void setDate(DateAttribute attribute, java.sql.Date dateValue)
attribute
- the attribute of the columndateValue
- the new value of the columnpublic void setDate(java.lang.String columnName, java.util.Date dateValue)
columnName
- the name of the column to be modifieddateValue
- the new value of the columnpublic void setDate(java.lang.String columnName, java.sql.Date dateValue)
columnName
- the name of the column to be modifieddateValue
- the new value of the columnpublic java.sql.Time getTime(java.lang.String columnName)
columnName
- the name of the columnpublic java.sql.Time getWorkedOnTime(java.lang.String columnName)
columnName
- the name of the columnpublic void setTime(java.lang.String columnName, java.sql.Time timeValue)
columnName
- the name of the column to be modifieddateValue
- the new value of the columnpublic java.sql.Timestamp getTimestamp(java.lang.String columnName)
columnName
- the name of the columnpublic java.sql.Timestamp getWorkedOnTimestamp(java.lang.String columnName)
columnName
- the name of the columnpublic void setTimestamp(java.lang.String columnName, java.sql.Timestamp timestampValue)
columnName
- the name of the column to be modifieddateValue
- the new value of the columnpublic boolean getBoolean(BooleanAttribute attribute)
attribute
- the attribute of the columnpublic boolean getBoolean(java.lang.String columnName)
columnName
- the name of the columnprotected boolean getWorkedOnBoolean(java.lang.String columnName)
columnName
- the name of the columnpublic void setBoolean(java.lang.String columnName, boolean boolValue)
columnName
- the name of the column to be modifiedboolValue
- the new value of the columnpublic byte[] getBytes(java.lang.String columnName)
columnName
- the name of the columnpublic boolean isDeletionAllowed(Identifier identifier)
identifyValueString
- the primary key of the row to be checkedpublic HintContainer getDeletionHindrance(Identifier identifier)
identifier
- the identifier of the item to check for hindrancespublic boolean delete(Identifier identifier)
newIdentifyValueInt
- the primary key of the row to be deletedpublic boolean delete()
protected boolean deleteFreeConditioned(WhereCondition whereCondition)
whereCondition
- the condition to select the rows to deleteprotected boolean deleteFreeConditioned(java.lang.String whereCondition)
whereCondition
- the condition to select the rows to deleteprotected int deleteFreeConditionedAndCount(java.lang.String whereCondition)
whereCondition
- the condition to select the rows to deletepublic int getmaxRow(int licenceType)
licenceType
- the license typepublic java.lang.String getUniqueKeyName()
public int getColumnCount()
public java.lang.String getColumnName(int columnPointer)
columnPointer
- the array indexpublic int getColumnType(int columnPointer)
columnPointer
- the array indexpublic IdentifyTemplate getIdentifyTemplate()
public int getIdentifyValueInt()
public Identifier getIdentifier()
public int getMode()
INSERTMODE
,
UPDATEMODE
public boolean isColumnContained(java.lang.String columnName)
columnName
- the name of the column to be checkedpublic boolean isModified()
public boolean isModifiedColumn(java.lang.String columnName)
protected java.lang.Object getOriginalOf(java.lang.String columnName)
protected java.lang.Object getWorkedOnOf(java.lang.String columnName)
public void addDataChangeListener(DataChangeListener listener)
DataChangedEvent
public void removeDataChangeListener(DataChangeListener listener)
listener
- the DataChangeListener to be removedDataChangedEvent
public void fireDataChanged(DataChangedEvent e)
public void addDataSelectionListener(DataSelectionListener l)
DataSelectionEvent
public void removeDataSelectionListener(DataSelectionListener l)
DataSelectionEvent
protected DataObject register(DataObject dataObject)
dataObject
- the Co-DataObjectpublic boolean select(WhereConditionForPrepStmts wc)
nextRow()
loading all available columns.
Always invoke closeQuery()
to release table handle in the end.whereCondition
- the condition to reduce the result setcloseQuery()
,
closePreparedStatementsForWhereCondition()
public boolean select(WhereConditionForPrepStmts wc, java.lang.String orderByFields)
nextRow()
loading all available columns.
Always invoke closeQuery()
to release table handle in the end.whereCondition
- the condition to reduce the result setorderByFields
- the fields to be used for the order by clausecloseQuery()
,
closePreparedStatementsForWhereCondition()
public boolean select(java.lang.String fieldSelection, WhereConditionForPrepStmts wc)
nextRow()
.
Always invoke closeQuery()
to release table handle in the end.fieldSelection
- a sequence of field names to be accessed, separated by commawc
- the where condition to reduce the result setcloseQuery()
,
closePreparedStatementsForWhereCondition()
public boolean select(java.lang.String fieldSelection, WhereConditionForPrepStmts wc, java.lang.String orderByFields)
nextRow()
.
Always invoke closeQuery()
to release table handle in the end.fieldSelection
- a sequence of field names to be accessed, separated by commawc
- the condition to reduce the result setorderByFields
- the fields to be used for the order by clausecloseQuery()
,
closePreparedStatementsForWhereCondition()
public boolean select(java.lang.String fieldSelection, java.lang.String joinedTables, WhereConditionForPrepStmts wc, java.lang.String orderByFields)
nextRow()
.
Always invoke closeQuery()
to release table handle in the end.fieldSelection
- a sequence of field names to be accessed, separated by commajoinedTables
- joined tableswc
- the condition to reduce the result setorderByFields
- the fields to be used for the order by clausecloseQuery()
,
closePreparedStatementsForWhereCondition()
public int count(WhereConditionForPrepStmts wc)
wc
- the where condition to fitpublic int count(java.lang.String field, WhereConditionForPrepStmts wc)
field
- the field to be countedwc
- the where condition to fitprotected boolean checkRecoverConnection()
protected void sqlExceptionConsequences()
protected void logDebug(java.lang.String text)
text
- the message to logprotected void logInfo(java.lang.String text)
text
- the message to logprotected void logError(java.lang.Throwable throwable)
throwable
- the exception to logprotected void logError(java.lang.String text)
text
- the message to logprotected void logError(java.lang.String text, java.lang.Throwable throwable)
text
- the message to logthrowable
- the exception to logpublic java.lang.Exception getLastException()
public void free()
Exemptible
free
in interface Exemptible
protected void discardStatements()
protected void closeIfExists(java.sql.Statement statement)
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de