org.tentackle.db
Class DbPreferencesNode

java.lang.Object
  extended by org.tentackle.db.DbObject
      extended by org.tentackle.db.DbPreferencesNode
All Implemented Interfaces:
Serializable, Cloneable, Comparable<DbObject>

public class DbPreferencesNode
extends DbObject

Preferences Node stored in the database.

Author:
harald
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.tentackle.db.DbObject
DbObject.CopyAllToDbLogger, DbObject.IdComparator<T extends DbObject>, DbObject.NameComparator<T extends DbObject>, DbObject.NameIdComparator<T extends DbObject>
 
Field Summary
static String FIELD_NAME
          database column name for name
static String FIELD_PARENTID
          database column name for parentId
static String FIELD_USER
          database column name for user
static String TABLENAME
          database tablename
 
Fields inherited from class org.tentackle.db.DbObject
BEGIN, COMMIT, DELETE, DELETEALL, FIELD_ID, FIELD_SERIAL, FIELD_TABLESERIAL, idComparator, INSERT, lazyMethodInterval, nameComparator, nameIdComparator, TX_DELETE_LIST, TX_DELETE_MISSING_IN_LIST, TX_DELETE_OBJECT, TX_DUMMY_UPDATE, TX_INSERT_OBJECT, TX_INSERT_PLAIN, TX_SAVE, TX_SAVE_LIST, TX_UPDATE_OBJECT, TX_UPDATE_PLAIN, TX_UPDATE_SERIAL, TX_UPDATE_SERIAL_AND_TABLESERIAL, TX_UPDATE_TABLESERIAL, UPDATE
 
Constructor Summary
DbPreferencesNode()
          Creates a node (without db).
DbPreferencesNode(Db db)
          Creates a node.
 
Method Summary
 String getBaseName()
          Gets the basename of the node.
 DbObjectClassVariables getDbObjectClassVariables()
          Gets the some attributes and variables common to all objects of the same class.
 boolean getFields(ResultSetWrapper rs)
          Retrieves the values of all fields (all columns of the database table) in the given ResultSetWrapper and stores them in the object's attributes.
 ImageIcon getIcon()
          Gets the icon of this object.
 String getName()
          Gets the db attribute name
 long getParentId()
          Gets the db attribute parentId
 String getUser()
          Gets the db attribute user
 boolean isCountingModification(int modType)
          Determines whether modifications of this object are counted in the modification table.
 boolean isTableSerialValid()
          By default objects don't need to include the tableSerial in the database table.
 int prepareInsertStatement()
          Prepares the insert statement.
 int prepareUpdateStatement()
          Prepare the update statement.
 DbPreferencesNode select(long id)
          Selects a node by its ID.
 List<DbPreferencesNode> selectByParentId(long parentId)
          Gets all nodes belonging to a parent node.
 DbPreferencesNode selectByUserAndName(String user, String name)
          Selects a node by user and name.
 Set<Long> selectChildIds()
          Selects the object IDs of all childs nodes.
 int setFields(PreparedStatementWrapper st)
          Sets the values of all fields (all columns of the database table) in the given PreparedStatementWrapper from the object's attributes.
 void setName(String name)
          Sets the db attribute name
 void setParentId(long parentId)
          Sets the db attribute parentId
 void setUser(String user)
          Sets the db attribute user
 String toString()
          Gets the default string value.
The default implementation invokes DbObject.toGenericString().
 
Methods inherited from class org.tentackle.db.DbObject
_delete, _save, alwaysPrepare, assertLazyNotWithinTX, attributesModified, beginTx, clone, compareTo, copyAllToDb, copyLazyValues, copyToDb, countModification, countModification, createModificationLog, delete, deleteLinkedObjects, deleteList, deleteMissingInList, deleteObject, deletePlain, dummyUpdate, equals, finishModification, finishNotUpdated, getClassBaseName, getClassName, getDb, getDeleteStatementId, getDummyUpdateStatementId, getExpirationBacklog, getExpiredTableSerials, getFieldCount, getId, getIdSource, getInsertStatementId, getMultiName, getRemoteDelegate, getRemoteDelegateId, getSelectAllStatementId, getSelectExpiredTableSerials1StatementId, getSelectExpiredTableSerials2StatementId, getSelectLockedStatementId, getSelectSerialStatementId, getSelectStatementId, getSerial, getSingleName, getSqlAllFields, getSqlPrefix, getSqlPrefixWithDot, getSqlSelectAllFields, getTableName, getTableSerial, getUpdateSerialAndTableSerialStatementId, getUpdateSerialStatementId, getUpdateStatementId, getUpdateTableSerialStatementId, hashCode, initModification, insert, insertObject, insertPlain, invalidateLazyValues, isDeleted, isEditable, isEditableLazy, isEntity, isGettingFieldCount, isIdValid, isLazyElapsed, isListModified, isLoggingModification, isModified, isNew, isPartial, isReferenced, isReferencedLazy, isRemovable, isRemovableLazy, isSaveable, isTracked, isTxObject, isUpdatingSerialEvenIfNotModified, isVirgin, loadLinkedObjects, logModification, markDeleted, markListDeleted, newByClass, newByClass, newByClassWrapped, newId, newObject, prepareDeleteStatement, prepareDummyUpdateStatement, prepareSelectLockedStatement, prepareSelectSerialStatement, prepareSelectStatement, prepareSetFields, prepareUpdateSerialAndTableSerialStatement, prepareUpdateSerialStatement, prepareUpdateTableSerialStatement, readFromResultSetWrapper, readFromResultSetWrapper, reload, reloadLocked, reserveId, save, saveLinkedObjects, saveList, saveList, select, select, select, selectAll, selectAll, selectAll, selectAllCursor, selectAllCursor, selectAllResultSet, selectExpiredTableSerials, selectExpiredTableSerials, selectInValidContext, selectLocked, selectLocked, selectModification, selectNext, selectSerial, selectSerial, setAlwaysPrepare, setDb, setDeleteStatementId, setDummyUpdateStatementId, setId, setInsertStatementId, setModified, setSelectAllStatementId, setSelectExpiredTableSerials1StatementId, setSelectExpiredTableSerials2StatementId, setSelectLockedStatementId, setSelectSerialStatementId, setSelectStatementId, setSerial, setTableSerial, setUpdateSerialAndTableSerialStatementId, setUpdateSerialStatementId, setUpdateStatementId, setUpdateTableSerialStatementId, sync, syncObject, toGenericString, update, updateFieldCount, updateFields, updateObject, updatePlain, updateSerial, updateSerialAndTableSerial, updateTableSerial
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TABLENAME

public static final String TABLENAME
database tablename

See Also:
Constant Field Values

FIELD_USER

public static final String FIELD_USER
database column name for user

See Also:
Constant Field Values

FIELD_NAME

public static final String FIELD_NAME
database column name for name

See Also:
Constant Field Values

FIELD_PARENTID

public static final String FIELD_PARENTID
database column name for parentId

See Also:
Constant Field Values
Constructor Detail

DbPreferencesNode

public DbPreferencesNode(Db db)
Creates a node.

Parameters:
db - the db connection

DbPreferencesNode

public DbPreferencesNode()
Creates a node (without db).

Method Detail

isCountingModification

public boolean isCountingModification(int modType)
Description copied from class: DbObject
Determines whether modifications of this object are counted in the modification table. The default implementation returns false. Must be overridden if counting the modifications is desired.

Overrides:
isCountingModification in class DbObject
Parameters:
modType - is one of the modtypes INSERT, UPDATE, DELETE, ...
Returns:
true if count modification, false if not.
See Also:
ModificationCounter

isTableSerialValid

public boolean isTableSerialValid()
Description copied from class: DbObject
By default objects don't need to include the tableSerial in the database table. Override this method if object contains a TABLESERIAL-column.

Overrides:
isTableSerialValid in class DbObject
Returns:
true if object is using the tableSerial column, false if not.

getIcon

public ImageIcon getIcon()
Description copied from class: DbObject
Gets the icon of this object. The icon is displayed in trees, for example. The default implementation returns PlafGlobal.getIcon(java.lang.String, java.lang.String)("unknown").

Overrides:
getIcon in class DbObject
Returns:
the icon

getDbObjectClassVariables

public DbObjectClassVariables getDbObjectClassVariables()
Description copied from class: DbObject
Gets the some attributes and variables common to all objects of the same class. Class variables for classes derived from DbObject are kept in an instance of DbObjectClassVariables.

Specified by:
getDbObjectClassVariables in class DbObject
Returns:
the class variables

getFields

public boolean getFields(ResultSetWrapper rs)
Description copied from class: DbObject
Retrieves the values of all fields (all columns of the database table) in the given ResultSetWrapper and stores them in the object's attributes.

Specified by:
getFields in class DbObject
Parameters:
rs - the result set
Returns:
true if all fields retrieved

setFields

public int setFields(PreparedStatementWrapper st)
Description copied from class: DbObject
Sets the values of all fields (all columns of the database table) in the given PreparedStatementWrapper from the object's attributes.

Specified by:
setFields in class DbObject
Parameters:
st - the statement
Returns:
the number of fields set, -1 if error.

select

public DbPreferencesNode select(long id)
Selects a node by its ID.

Overrides:
select in class DbObject
Parameters:
id - is the object id
Returns:
object if loaded, null if no such object

prepareInsertStatement

public int prepareInsertStatement()
Description copied from class: DbObject
Prepares the insert statement.

Specified by:
prepareInsertStatement in class DbObject
Returns:
the statememt id

prepareUpdateStatement

public int prepareUpdateStatement()
Description copied from class: DbObject
Prepare the update statement.

Specified by:
prepareUpdateStatement in class DbObject
Returns:
the statememt id

selectByParentId

public List<DbPreferencesNode> selectByParentId(long parentId)
Gets all nodes belonging to a parent node.

Parameters:
parentId - the ID of the parent node, 0 = rootnode
Returns:
List of nodes
Wurblet:
selectByParentId DbSelectList $mapfile $remote parentId

selectChildIds

public Set<Long> selectChildIds()
Selects the object IDs of all childs nodes.

Returns:
the IDs

selectByUserAndName

public DbPreferencesNode selectByUserAndName(String user,
                                             String name)
Selects a node by user and name.

Parameters:
user - is the username, null = system
name - is the absolute pathname of the node, ""=root
Returns:
the node
Wurblet:
selectByUserAndName DbSelectUnique $mapfile $remote user name

getUser

public String getUser()
Gets the db attribute user

Returns:
name of user, null = system

setUser

public void setUser(String user)
Sets the db attribute user

Parameters:
user - name of user, null = system

getName

public String getName()
Gets the db attribute name

Returns:
name of the node

setName

public void setName(String name)
Sets the db attribute name

Parameters:
name - name of the node

getParentId

public long getParentId()
Gets the db attribute parentId

Returns:
ID of parent node, 0 = rootnode

setParentId

public void setParentId(long parentId)
Sets the db attribute parentId

Parameters:
parentId - ID of parent node, 0 = rootnode

getBaseName

public String getBaseName()
Gets the basename of the node.

Returns:
the node's basename

toString

public String toString()
Description copied from class: DbObject
Gets the default string value.
The default implementation invokes DbObject.toGenericString().

Overrides:
toString in class DbObject
Returns:
the string value of this DbObject


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de