de.unidu.is.util
Class DBKeyPropertyMap

java.lang.Object
  extended byde.unidu.is.util.PropertyMap
      extended byde.unidu.is.util.DBKeyPropertyMap
All Implemented Interfaces:
java.util.Map

public class DBKeyPropertyMap
extends PropertyMap

A special property map backed by a RDBMS table.

This class uses a table with three columns (the default names are "propkey" and "propvalue", but these can be changed) with the SQL type "text" for storing the property map. This means that this set can only be used with strings, or with objects for which the string representation is sufficient. The difference to the DBPropertyMap makes a extra column named "key". The purpose is to have a special index on key, so that it can hold e.x. a username. Be aware, that this key is only 50 chars long! Additionally the "like" is uses in some methods, to retrieve hierarchical keys like desktop.window.* to fetch all window properties stored.

Since:
2005-02-18
Version:
$Revision: 1.12 $, $Date: 2005/02/28 22:27:55 $
Author:
Claus-Peter Klas

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected  DB db
          The DB which is used for backing this map.
protected  java.lang.String extraKeyCol
          The column name for the extra keys used for e.x. username.
protected  java.lang.String keyCol
          The column name for the keys used for this map.
protected  java.lang.String tableName
          The table used for backing this map.
protected  java.lang.String valueCol
          The column name for the values used for this map.
 
Fields inherited from class de.unidu.is.util.PropertyMap
multipleValues
 
Constructor Summary
DBKeyPropertyMap(DB db, java.lang.String tableName)
          Creates a new instance (and the corresponding table, if it does not exists), and sets the columns to "propkey" and "propvalue".
DBKeyPropertyMap(DB db, java.lang.String tableName, boolean multiple)
          Creates a new instance (and the corresponding table, if it does not exists), and sets the columns to "propkey" and "propvalue".
DBKeyPropertyMap(DB db, java.lang.String tableName, java.lang.String eKey, java.lang.String keyCol, java.lang.String valueCol)
          Creates a new instance (and the corresponding table, if it does not exists), and sets the column names.
DBKeyPropertyMap(DB db, java.lang.String tableName, java.lang.String eKeyCol, java.lang.String keyCol, java.lang.String valueCol, boolean multiple)
          Creates a new instance (and the corresponding table, if it does not exists), and sets the column names.
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 void delete()
          Deletes the corresponding table.
 java.util.Set entrySet()
           
 boolean equals(java.lang.Object obj)
           
 java.lang.Object get(java.lang.Object key)
           
 java.util.List getAll(java.lang.Object key)
          Returns a list with all values stored for the specified key.
 java.lang.String getEValue()
           
 java.util.Map getRightTruncated(java.lang.String key)
           
 java.lang.String getUserId()
           
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map t)
           
 java.lang.Object remove(java.lang.Object key)
           
 void remove(java.lang.Object key, java.lang.Object value)
          Removes the specified value for the specified key.
 void setEValue(java.lang.String value)
           
 void setUserId(java.lang.String value)
           
 int size()
           
 java.lang.String toString()
           
 java.util.Collection values()
           
 
Methods inherited from class de.unidu.is.util.PropertyMap
addDouble, addDouble, addDouble, addInt, addInt, addInt, apply, convertString, divDouble, divDouble, divDouble, divInt, divInt, divInt, getBoolean, getDouble, getInt, getLength, getLong, getMaxDouble, getMaxKey, getMinDouble, getString, getString, getSum, hasMultipleValues, inc, initDouble, isMultipleValues, multDouble, multDouble, multDouble, multDouble, multInt, multInt, multInt, normalizeLength, removeCloseToZero, removeZero, set, setBoolean, setDouble, setInt, setLong, setMultipleValues, setString, subDouble, subDouble, subDouble, subInt, subInt, subInt
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

db

protected DB db
The DB which is used for backing this map.


tableName

protected java.lang.String tableName
The table used for backing this map.


extraKeyCol

protected java.lang.String extraKeyCol
The column name for the extra keys used for e.x. username.


keyCol

protected java.lang.String keyCol
The column name for the keys used for this map.


valueCol

protected java.lang.String valueCol
The column name for the values used for this map.

Constructor Detail

DBKeyPropertyMap

public DBKeyPropertyMap(DB db,
                        java.lang.String tableName)
Creates a new instance (and the corresponding table, if it does not exists), and sets the columns to "propkey" and "propvalue".

Parameters:
db - DB used by this set
tableName - name of the table used by this set

DBKeyPropertyMap

public DBKeyPropertyMap(DB db,
                        java.lang.String tableName,
                        java.lang.String eKeyCol,
                        java.lang.String keyCol,
                        java.lang.String valueCol,
                        boolean multiple)
Creates a new instance (and the corresponding table, if it does not exists), and sets the column names.

Parameters:
db - DB used by this set
tableName - name of the table used by this set
keyCol - column name for keys
valueCol - column name for values
multiple - values if true, multiple values can be hold for a key

DBKeyPropertyMap

public DBKeyPropertyMap(DB db,
                        java.lang.String tableName,
                        boolean multiple)
Creates a new instance (and the corresponding table, if it does not exists), and sets the columns to "propkey" and "propvalue".

Parameters:
db - DB used by this set
tableName - name of the table used by this set
multiple - values if true, multiple values can be hold for a key

DBKeyPropertyMap

public DBKeyPropertyMap(DB db,
                        java.lang.String tableName,
                        java.lang.String eKey,
                        java.lang.String keyCol,
                        java.lang.String valueCol)
Creates a new instance (and the corresponding table, if it does not exists), and sets the column names.

Parameters:
db - DB used by this set
tableName - name of the table used by this set
keyCol - column name for keys
valueCol - column name for values
Method Detail

clear

public void clear()

delete

public void delete()
Deletes the corresponding table.


containsKey

public boolean containsKey(java.lang.Object key)

containsValue

public boolean containsValue(java.lang.Object value)

entrySet

public java.util.Set entrySet()

get

public java.lang.Object get(java.lang.Object key)

isEmpty

public boolean isEmpty()

keySet

public java.util.Set keySet()

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)

putAll

public void putAll(java.util.Map t)

remove

public java.lang.Object remove(java.lang.Object key)

size

public int size()

values

public java.util.Collection values()

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

toString

public java.lang.String toString()

getAll

public java.util.List getAll(java.lang.Object key)
Description copied from class: PropertyMap
Returns a list with all values stored for the specified key.

Specified by:
getAll in class PropertyMap
Parameters:
key - property key
Returns:
list with all values stored for the specified key

remove

public void remove(java.lang.Object key,
                   java.lang.Object value)
Description copied from class: PropertyMap
Removes the specified value for the specified key.

Specified by:
remove in class PropertyMap
Parameters:
key - property key
value - value to be removed

getUserId

public java.lang.String getUserId()
Returns:
Returns the eValue.

setUserId

public void setUserId(java.lang.String value)
Parameters:
value - The eValue to set.

getEValue

public java.lang.String getEValue()
Returns:
Returns the eValue.

setEValue

public void setEValue(java.lang.String value)
Parameters:
value - The eValue to set.

getRightTruncated

public java.util.Map getRightTruncated(java.lang.String key)
Parameters:
key -
Returns: