org.mmbase.module.corebuilders
Class FieldDefs

java.lang.Object
  |
  +--org.mmbase.module.corebuilders.FieldDefs
All Implemented Interfaces:
java.lang.Comparable

public class FieldDefs
extends java.lang.Object
implements java.lang.Comparable

One of the core objects, Defines one field of a object type / builder, has its own builder called FieldDef (hitlisted)

Version:
$Id: FieldDefs.java,v 1.30.2.1 2002/11/21 16:05:35 robmaris Exp $
Author:
Daniel Ockeloen, Hans Speijer, Pierre van Rooden

Field Summary
static int DBSTATE_MAXVALUE
           
static int DBSTATE_MINVALUE
           
static int DBSTATE_PERSISTENT
           
static int DBSTATE_SYSTEM
           
static int DBSTATE_UNKNOWN
           
static int DBSTATE_VIRTUAL
           
static int ORDER_CREATE
           
static int ORDER_EDIT
           
static int ORDER_LIST
           
static int ORDER_SEARCH
           
static int TYPE_BYTE
           
static int TYPE_DOUBLE
           
static int TYPE_FLOAT
           
static int TYPE_INTEGER
           
static int TYPE_LONG
           
static int TYPE_MAXVALUE
           
static int TYPE_MINVALUE
           
static int TYPE_NODE
           
static int TYPE_STRING
           
static int TYPE_UNKNOWN
           
static int TYPE_XML
           
 
Constructor Summary
FieldDefs()
          Constructor for default FieldDef.
FieldDefs(java.lang.String GUIName, java.lang.String GUIType, int GUISearch, int GUIList, java.lang.String DBName, int DBType)
          Constructor for FieldDefs with partially initialized fields.
FieldDefs(java.lang.String GUIName, java.lang.String GUIType, int GUISearch, int GUIList, java.lang.String DBName, int DBType, int GUIPos, int DBState)
          Constructor for FieldDefs with partially initialized fields.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compare this object to the supplied one (should be a FieldDefs)
 java.lang.String getDBDocType()
          Retrieve the doctype
 java.lang.String getDBName()
          Retrieve the database name of the field.
 boolean getDBNotNull()
          Retrieve whether the field can be left blank.
 int getDBPos()
          Retrieve the position of the field in the database table.
 int getDBSize()
          Retrieve size of the field.
 int getDBState()
          Retrieve the state of the field (persistent, system, or virtual).
 java.lang.String getDBStateDescription()
          Provide a description for the current state.
static java.lang.String getDBStateDescription(int state)
          Provide a description for the specified state.
static int getDBStateId(java.lang.String state)
          Provide an id for the specified mmbase state description.
 int getDBType()
          Retrieve the basic MMBase type of the field.
 java.lang.String getDBTypeDescription()
          Provide a description for the current type.
static java.lang.String getDBTypeDescription(int type)
          Provide a description for the specified type.
static int getDBTypeId(java.lang.String type)
          Provide an id for the specified mmbase type description
 java.lang.String getDescription()
          Retrieve the GUI name of the field.
 java.lang.String getDescription(java.lang.String lang)
          Retrieve the description of the field depending on specified langauge.
 java.util.Map getDescriptions()
          Retrieve a Map with all descriptions for this field, accessible by language.
 int getGUIList()
          Retrieve the position of the field when listing.
 java.lang.String getGUIName()
          Retrieve the GUI name of the field.
 java.lang.String getGUIName(java.lang.String lang)
          Retrieve the GUI name of the field depending on specified langauge.
 java.util.Map getGUINames()
          Retrieve a Map with all GUI names for this field, accessible by language.
 int getGUIPos()
          Retrieve the position of the field when editing.
 int getGUISearch()
          Retrieve the position of the field when searching.
 java.lang.String getGUIType()
          Retrieve the GUI type of the field.
 MMObjectBuilder getParent()
          Retrieves the parent builder for this field
 boolean isKey()
          Retrieve whether the field is a key and thus need be unique.
 void setDBDocType(java.lang.String doctype)
          Set whether the field has an doctype to validate
 void setDBKey(boolean value)
          Set whether the field is a key and thus need be unique.
 void setDBName(java.lang.String value)
          Set the database name of the field.
 void setDBNotNull(boolean value)
          Set whether the field can be left blank.
 void setDBPos(int value)
          Set the position of the field in the database table.
 void setDBSize(int value)
          Set size of the field.
 void setDBState(int value)
          Set the state of the field (persistent, system, or virtual).
 void setDBState(java.lang.String value)
          Set the basic MMBase state of the field, using the state description
 void setDBType(int value)
          Set the basic MMBase type of the field.
 void setDBType(java.lang.String value)
          Set the basic MMBase type of the field, using the type description
 void setDescription(java.lang.String lang, java.lang.String value)
          Set the description of the field for a specified langauge.
 void setGUIList(int value)
          Set the position of the field when listing.
 void setGUIName(java.lang.String lang, java.lang.String value)
          Set the GUI name of the field for a specified langauge.
 void setGUIPos(int value)
          Set the position of the field when editing.
 void setGUISearch(int value)
          Set the position of the field when searching.
 void setGUIType(java.lang.String value)
          Set the GUI type of the field.
 void setParent(MMObjectBuilder parent)
          Set the parent builder for this field
static void sort(java.util.List fielddefs)
          Sorts a list with FieldDefs objects, using the default order (ORDER_CREATE)
static void sort(java.util.List fielddefs, int order)
          Sorts a list with FieldDefs objects, using the specified order
 java.lang.String toString()
          Returns a description for this field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DBSTATE_MINVALUE

public static final int DBSTATE_MINVALUE

DBSTATE_VIRTUAL

public static final int DBSTATE_VIRTUAL

DBSTATE_PERSISTENT

public static final int DBSTATE_PERSISTENT

DBSTATE_SYSTEM

public static final int DBSTATE_SYSTEM

DBSTATE_MAXVALUE

public static final int DBSTATE_MAXVALUE

DBSTATE_UNKNOWN

public static final int DBSTATE_UNKNOWN

TYPE_MINVALUE

public static final int TYPE_MINVALUE

TYPE_STRING

public static final int TYPE_STRING

TYPE_INTEGER

public static final int TYPE_INTEGER

TYPE_BYTE

public static final int TYPE_BYTE

TYPE_FLOAT

public static final int TYPE_FLOAT

TYPE_DOUBLE

public static final int TYPE_DOUBLE

TYPE_LONG

public static final int TYPE_LONG

TYPE_XML

public static final int TYPE_XML

TYPE_NODE

public static final int TYPE_NODE

TYPE_MAXVALUE

public static final int TYPE_MAXVALUE

TYPE_UNKNOWN

public static final int TYPE_UNKNOWN

ORDER_CREATE

public static final int ORDER_CREATE

ORDER_EDIT

public static final int ORDER_EDIT

ORDER_LIST

public static final int ORDER_LIST

ORDER_SEARCH

public static final int ORDER_SEARCH
Constructor Detail

FieldDefs

public FieldDefs()
Constructor for default FieldDef.

FieldDefs

public FieldDefs(java.lang.String GUIName,
                 java.lang.String GUIType,
                 int GUISearch,
                 int GUIList,
                 java.lang.String DBName,
                 int DBType)
Constructor for FieldDefs with partially initialized fields.
Parameters:
GUIName - the default GUIName for a field
GUIType - the GUI type (i.e. "integer' or 'field')
GUISearch - position in the editor for this field when searching
GUIList - position in the editor for this field when listing
DBName - the actual name of the field in the database
DBType - the basic MMBase type of the field

FieldDefs

public FieldDefs(java.lang.String GUIName,
                 java.lang.String GUIType,
                 int GUISearch,
                 int GUIList,
                 java.lang.String DBName,
                 int DBType,
                 int GUIPos,
                 int DBState)
Constructor for FieldDefs with partially initialized fields.
Parameters:
GUIName - the default GUIName for a field
GUIType - the GUI type (i.e. "integer' or 'field')
GUISearch - position in the editor for this field when searching
GUIList - position in the editor for this field when listing
DBName - the actual name of the field in the database
DBType - the basic MMBase type of the field
GUIPos - position in the editor for this field when editing
DBState - the state of the field (persistent, virtual, etc.)
Method Detail

getDBTypeDescription

public static java.lang.String getDBTypeDescription(int type)
Provide a description for the specified type. Useful for debugging, errors or presenting GUI info.
Parameters:
type - the type to get the description of
Returns:
the description of the type.

getDBStateDescription

public static java.lang.String getDBStateDescription(int state)
Provide a description for the specified state. Useful for debugging, errors or presenting GUI info.
Parameters:
state - the state to get the description of
Returns:
the description of the state.

getDBTypeId

public static int getDBTypeId(java.lang.String type)
Provide an id for the specified mmbase type description
Parameters:
type - the type description to get the id of
Returns:
the id of the type.

getDBStateId

public static int getDBStateId(java.lang.String state)
Provide an id for the specified mmbase state description.
Parameters:
type - the state description to get the id of
Returns:
the id of the state.

getDBTypeDescription

public java.lang.String getDBTypeDescription()
Provide a description for the current type.
Returns:
the description of the type.

getDBStateDescription

public java.lang.String getDBStateDescription()
Provide a description for the current state.
Returns:
the description of the state.

getGUIName

public java.lang.String getGUIName(java.lang.String lang)
Retrieve the GUI name of the field depending on specified langauge. If the language is not available, the "en" value is returned instead. If that one is unavailable the internal fieldname is returned.
Parameters:
lang - the language to return the name in
Returns:
the GUI Name

getGUIName

public java.lang.String getGUIName()
Retrieve the GUI name of the field. If possible, the "en" value is returned. If that one is unavailable the internal fieldname is returned.
Returns:
the GUI Name

getDescription

public java.lang.String getDescription(java.lang.String lang)
Retrieve the description of the field depending on specified langauge. If the language is not available, the "en" value is returned instead.
Parameters:
lang - the language to return the name in
Returns:
the description

getDescription

public java.lang.String getDescription()
Retrieve the GUI name of the field. If possible, the "en" value is returned.
Returns:
the Description

getGUINames

public java.util.Map getGUINames()
Retrieve a Map with all GUI names for this field, accessible by language.

getDescriptions

public java.util.Map getDescriptions()
Retrieve a Map with all descriptions for this field, accessible by language.

getGUIType

public java.lang.String getGUIType()
Retrieve the GUI type of the field.

getDBName

public java.lang.String getDBName()
Retrieve the database name of the field.

getDBType

public int getDBType()
Retrieve the basic MMBase type of the field.

getDBSize

public int getDBSize()
Retrieve size of the field. This may not be specified for some field types.

getDBNotNull

public boolean getDBNotNull()
Retrieve whether the field can be left blank.

getDBDocType

public java.lang.String getDBDocType()
Retrieve the doctype

getDBState

public int getDBState()
Retrieve the state of the field (persistent, system, or virtual).

isKey

public boolean isKey()
Retrieve whether the field is a key and thus need be unique.

getGUISearch

public int getGUISearch()
Retrieve the position of the field when searching. A value of -1 indicates teh field is unavailable during search.

getGUIList

public int getGUIList()
Retrieve the position of the field when listing. A value of -1 indicates the field is unavailable in a list.

getGUIPos

public int getGUIPos()
Retrieve the position of the field when editing. A value of -1 indicates the field cannot be edited.

getDBPos

public int getDBPos()
Retrieve the position of the field in the database table.

setGUIName

public void setGUIName(java.lang.String lang,
                       java.lang.String value)
Set the GUI name of the field for a specified langauge.
Parameters:
lang - the language to set the name for
value - the value to set

setDescription

public void setDescription(java.lang.String lang,
                           java.lang.String value)
Set the description of the field for a specified langauge.
Parameters:
lang - the language to set the description for
value - the value to set

setGUIType

public void setGUIType(java.lang.String value)
Set the GUI type of the field.
Parameters:
value - the value to set

setDBName

public void setDBName(java.lang.String value)
Set the database name of the field.
Parameters:
value - the value to set

setGUIList

public void setGUIList(int value)
Set the position of the field when listing. A value of -1 indicates teh field is unavailable in a list.
Parameters:
value - the value to set

setGUIPos

public void setGUIPos(int value)
Set the position of the field when editing. A value of -1 indicates the field cannot be edited.
Parameters:
value - the value to set

setGUISearch

public void setGUISearch(int value)
Set the position of the field when searching. A value of -1 indicates teh field is unavailable during search.
Parameters:
value - the value to set

setDBSize

public void setDBSize(int value)
Set size of the field.
Parameters:
value - the value to set

setDBType

public void setDBType(int value)
Set the basic MMBase type of the field.
Parameters:
value - the id of the type

setDBType

public void setDBType(java.lang.String value)
Set the basic MMBase type of the field, using the type description
Parameters:
value - the name of the type

setDBPos

public void setDBPos(int value)
Set the position of the field in the database table.
Parameters:
value - the value to set

setDBState

public void setDBState(int value)
Set the state of the field (persistent, system, or virtual).
Parameters:
value - the value to set

setDBState

public void setDBState(java.lang.String value)
Set the basic MMBase state of the field, using the state description
Parameters:
value - the name of the state

setDBKey

public void setDBKey(boolean value)
Set whether the field is a key and thus need be unique.
Parameters:
value - the value to set

setDBNotNull

public void setDBNotNull(boolean value)
Set whether the field can be left blank.
Parameters:
value - the value to set

setDBDocType

public void setDBDocType(java.lang.String doctype)
Set whether the field has an doctype to validate
Parameters:
doctype - the doctype, which has to be used for the field

getParent

public MMObjectBuilder getParent()
Retrieves the parent builder for this field

setParent

public void setParent(MMObjectBuilder parent)
Set the parent builder for this field
Parameters:
parent - the fielddefs parent

toString

public java.lang.String toString()
Returns a description for this field.
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Compare this object to the supplied one (should be a FieldDefs)
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
the - object to compare to
Returns:
-1,1, or 0 accordingto whetehr this object is smaller, greater, or equals to the supplied one.

sort

public static void sort(java.util.List fielddefs)
Sorts a list with FieldDefs objects, using the default order (ORDER_CREATE)
Parameters:
fielddefs - the list to sort

sort

public static void sort(java.util.List fielddefs,
                        int order)
Sorts a list with FieldDefs objects, using the specified order
Parameters:
fielddefs - the list to sort
order - one of ORDER_CREATE, ORDER_EDIT, ORDER_LIST,ORDER_SEARCH


MMBase build 1.6.5.20030923