PAJES 3.0.21

org.pajes.db.entity
Class Attributes

java.lang.Object
  extended by org.pajes.db.entity.Attributes
All Implemented Interfaces:
java.io.Serializable

public class Attributes
extends java.lang.Object
implements java.io.Serializable

A representation of the atributes of a single column in a database entity.

See Also:
Serialized Form

Constructor Summary
Attributes(Manager manager, java.lang.String columnName, java.lang.String tableName, java.lang.String label, int sqlType, boolean primaryKey, boolean autoIncrement)
          Creates an entity attributes object.
Attributes(Manager manager, java.lang.String columnName, java.lang.String tableName, java.lang.String label, int sqlType, boolean primaryKey, boolean autoIncrement, boolean required)
          Creates an entity attributes object.
Attributes(Manager manager, java.lang.String columnName, java.lang.String tableName, java.lang.String label, int sqlType, boolean primaryKey, boolean autoIncrement, boolean required, java.text.Format parser)
          Creates an entity attributes object.
Attributes(Manager manager, java.lang.String columnName, java.lang.String tableName, java.lang.String label, int sqlType, boolean primaryKey, boolean autoIncrement, boolean required, java.text.Format parser, int position, boolean optimisticLockKey, java.lang.Object defaultValue)
          Creates an entity attributes object.
 
Method Summary
 java.lang.String format(java.lang.Object value)
          Returns a formatted value.
 java.lang.Object get(java.lang.String name)
          Returns the specified user defined attribute.
 int getDataType()
          Retrieves the SQL data type of this attribute.
 java.lang.Object getDefaultValue()
          Gets the default value of this attribute.
 int getEditorPosition()
          Returns the position down the page of this input field relative to the other columns when being displayed in the DefaultEditor.
 Input getInputField(Form form)
          Returns an Input field that can be used to display and edit the value of this Entity.
 java.lang.String getLabel()
          Returns the label for this attribute.
 int getListerPosition()
          Returns the position of return this column relative to the other columns when being displayed in the DefaultLister.
 Manager getManager()
          Returns the Manager object to which this attribute belongs.
 java.lang.String getName()
          Returns the database column name that this attribute represents.
 java.lang.String getQualifiedName()
          Returns the table-qualified database column name that this attribute represents.
 java.lang.String getTable()
          Returns the name of the database table to which this attribute belongs.
 java.util.Set<java.lang.String> getUserDefinedAttributesNameSet()
          Returns the set of user-defined attributes.
 int getViewerPosition()
          Returns the position down the page of this element relative to the other columns when being displayed in the DefaultViewer.
 boolean isAutoIncrement()
          Determines whether this attribute is automatically incremented by the database server.
 boolean isDate()
          Determines if this attribute represents a date/time value or not.
 boolean isMandatory()
          Determines if this attribute is required by the database server to have a value.
 boolean isNumeric()
          Determines if this attribute represents a numeric value or not.
 boolean isOptimisticLockKey()
          Determines whether this column will participate in determining whether the row has been changed or not.
 boolean isPrimaryKey()
          Determines if this attribute is part of the primary key.
 boolean isReadOnly()
          Determines if this attribute should be read only or not.
 java.lang.Object parse(java.lang.String value)
          Converts the specified String into an Object of the correct type for this column.
 java.lang.Object put(java.lang.String name, java.lang.Object value)
          Creates a user-defined attribute.
 java.lang.Object remove(java.lang.String name)
          Removes the specified user-defined attribute.
 void setAutoIncrement(boolean autoIncrement)
          Sets whether or not this attribute is automatically incremented by the database server.
 void setDataType(int sqlType)
          Sets the SQL data type of this attribute.
 void setDefaultValue(java.lang.Object defaultValue)
          Sets the default value of this attribute, which will be used by the parse(java.lang.String) method if the String to be parsed is null or Select.NULL_ENTRY, or if the trimmed String equals "" and this attribute is numeric or a date.
 void setEditorPosition(int position)
          Determines the position down the page of this input field relative to the other columns when being displayed in the DefaultEditor.
 void setInputField(Input field)
          Sets the HTML Input field that can be used to display and edit the value of this Entity.
 void setLabel(java.lang.String label)
          Sets the default label for auto-generated maintenance screens.
 void setListerPosition(int position)
          Determines the position of this column relative to the other columns when being displayed in the DefaultLister.
 void setMandatory(boolean required)
          Determines if this attribute is required by the database server to have a value.
 void setOptimisticLockKey(boolean on)
          Determines whether this column will participate in determining whether the row has been changed or not.
 void setParser(java.text.Format parser)
          Specifies the object that will be used by the parse(java.lang.String) method to convert a String to an object of the correct type.
 void setPrimaryKey(boolean primaryKey)
          Determines whether this column participates in the primary key.
 void setReadOnly(boolean readOnly)
          Determines if this attribute should be read only or not.
 void setViewerPosition(int position)
          Determines the position down the page of this element relative to the other columns when being displayed in the DefaultViewer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Attributes

public Attributes(Manager manager,
                  java.lang.String columnName,
                  java.lang.String tableName,
                  java.lang.String label,
                  int sqlType,
                  boolean primaryKey,
                  boolean autoIncrement)
Creates an entity attributes object.

Parameters:
manager - the entity manager to which this attribute belongs.
columnName - the name of the database column that this attribute represents.
tableName - the name of the database table to which this column belongs. If null, it will default to the table defined in the Manager.
label - the default label for auto-generated maintenance screens.
sqlType - the java.sql.Types field that corresponds to the data type of this attribute.
primaryKey - true if this attribute is part of the primary key.
autoIncrement - true if this attribute is automatically incremented by the database server when inserting a new entity.

Attributes

public Attributes(Manager manager,
                  java.lang.String columnName,
                  java.lang.String tableName,
                  java.lang.String label,
                  int sqlType,
                  boolean primaryKey,
                  boolean autoIncrement,
                  boolean required)
Creates an entity attributes object.

Parameters:
manager - the entity manager to which this attribute belongs.
columnName - the name of the database column that this attribute represents.
tableName - the name of the database table to which this column belongs. If null, it will default to the table defined in the Manager.
label - the default label for auto-generated maintenance screens.
sqlType - the java.sql.Types field that corresponds to the data type of this attribute.
primaryKey - true if this attribute is part of the primary key.
autoIncrement - true if this attribute is automtically incremented by the database server when inserting a new entity.
required - true if this attribute is required by the database server to have a value.

Attributes

public Attributes(Manager manager,
                  java.lang.String columnName,
                  java.lang.String tableName,
                  java.lang.String label,
                  int sqlType,
                  boolean primaryKey,
                  boolean autoIncrement,
                  boolean required,
                  java.text.Format parser)
Creates an entity attributes object.

Parameters:
manager - the entity manager to which this attribute belongs.
columnName - the name of the database column that this attribute represents.
tableName - the name of the database table to which this column belongs. If null, it will default to the table defined in the Manager.
label - the default label for auto-generated maintenance screens.
sqlType - the java.sql.Types field that corresponds to the data type of this attribute.
primaryKey - true if this attribute is part of the primary key.
autoIncrement - true if this attribute is automtically incremented by the database server when inserting a new entity.
required - true if this attribute is required by the database server to have a value.
parser - the Format object that will be used by the parse(java.lang.String) method to convert a String to an object of the correct type.

Attributes

public Attributes(Manager manager,
                  java.lang.String columnName,
                  java.lang.String tableName,
                  java.lang.String label,
                  int sqlType,
                  boolean primaryKey,
                  boolean autoIncrement,
                  boolean required,
                  java.text.Format parser,
                  int position,
                  boolean optimisticLockKey,
                  java.lang.Object defaultValue)
Creates an entity attributes object.

Parameters:
manager - the entity manager to which this attribute belongs.
columnName - the name of the database column that this attribute represents.
tableName - the name of the database table to which this column belongs. If null, it will default to the table defined in the Manager.
label - the default label for auto-generated maintenance screens.
sqlType - the java.sql.Types field that corresponds to the data type of this attribute.
primaryKey - true if this attribute is part of the primary key.
autoIncrement - true if this attribute is automtically incremented by the database server when inserting a new entity.
required - true if this attribute is required by the database server to have a value.
parser - the Format object that will be used by the parse(java.lang.String) method to convert a String to an object of the correct type.
position - the default position of this field in the DefaultEditor, DefaultLister and DefaultViewer. If the position is negative, this field will not be displayed.
optimisticLockKey - if true, this column will be included in a WHERE clause to determine if the row has been changed.
defaultValue - the default value of this attribute, which will be used by the parse(java.lang.String) method if the String to be parsed is null or Select.NULL_ENTRY, or if the trimmed String equals "" and this attribute is numeric or a date.
Method Detail

format

public java.lang.String format(java.lang.Object value)
Returns a formatted value.

Parameters:
value - the value to be formatted.
Returns:
the formatted value.

get

public java.lang.Object get(java.lang.String name)
Returns the specified user defined attribute.

Parameters:
name - the user-defined attribute name.
Returns:
the specified user-defined attribute value.

getDataType

public int getDataType()
Retrieves the SQL data type of this attribute.

Returns:
the SQL data type of this attribute.

getDefaultValue

public java.lang.Object getDefaultValue()
Gets the default value of this attribute.

Returns:
the default value.

getEditorPosition

public int getEditorPosition()
Returns the position down the page of this input field relative to the other columns when being displayed in the DefaultEditor.

Returns:
the position of this field in the DefaultEditor. If the position is negative, this field will not be displayed in the editor.
See Also:
setEditorPosition(int)

getInputField

public Input getInputField(Form form)
Returns an Input field that can be used to display and edit the value of this Entity. If not specified with setInputField(org.pajes.html.Input), a default based on the data type will be used.

Parameters:
form - the HTML form on which the field will be placed.
Returns:
the input field.
See Also:
setInputField(org.pajes.html.Input)

getLabel

public java.lang.String getLabel()
Returns the label for this attribute.

Returns:
the label for this attribute.
See Also:
setLabel(java.lang.String)

getListerPosition

public int getListerPosition()
Returns the position of return this column relative to the other columns when being displayed in the DefaultLister.

Returns:
the position of return this column in the DefaultLister. If the position is negative, return this column will not be displayed in the list.
See Also:
setListerPosition(int)

getManager

public Manager getManager()
Returns the Manager object to which this attribute belongs.

Returns:
the Manager object to which this attribute belongs.

getName

public java.lang.String getName()
Returns the database column name that this attribute represents.

Returns:
the database column name that this attribute represents.

getQualifiedName

public java.lang.String getQualifiedName()
Returns the table-qualified database column name that this attribute represents.

Returns:
the database column name in the form TABLE_NAME.COLUMN_NAME.

getTable

public java.lang.String getTable()
Returns the name of the database table to which this attribute belongs.

Returns:
the name of the database table to which this attribute belongs.

getUserDefinedAttributesNameSet

public java.util.Set<java.lang.String> getUserDefinedAttributesNameSet()
Returns the set of user-defined attributes.

Returns:
a Set of the user-defined attribute names. Use {#get} to retrieve the user-defined attribute value.

getViewerPosition

public int getViewerPosition()
Returns the position down the page of this element relative to the other columns when being displayed in the DefaultViewer.

Returns:
the position of this field in the DefaultViewer. If the position is negative, this field will not be displayed in the editor.
See Also:
setViewerPosition(int)

isAutoIncrement

public boolean isAutoIncrement()
Determines whether this attribute is automatically incremented by the database server.

Returns:
true if the value of the attribute is automatically incremented.

isDate

public boolean isDate()
Determines if this attribute represents a date/time value or not.

Returns:
true if this attribute represents a date/time value, or false if it does not.

isMandatory

public boolean isMandatory()
Determines if this attribute is required by the database server to have a value.

Returns:
true if this attribute is required by the database server to have a value.

isNumeric

public boolean isNumeric()
Determines if this attribute represents a numeric value or not.

Returns:
true if this attribute represents a numeric value, or false if it does not.

isOptimisticLockKey

public boolean isOptimisticLockKey()
Determines whether this column will participate in determining whether the row has been changed or not.

Returns:
true if this column will be included in a WHERE clause to determine if the row has been changed, of false if it will not.
See Also:
setOptimisticLockKey(boolean)

isPrimaryKey

public boolean isPrimaryKey()
Determines if this attribute is part of the primary key.

Returns:
true if this attribute is part of the primary key, or false if it is not.
See Also:
setPrimaryKey(boolean)

isReadOnly

public boolean isReadOnly()
Determines if this attribute should be read only or not.

Returns:
true if this attribute should be read only.

parse

public java.lang.Object parse(java.lang.String value)
Converts the specified String into an Object of the correct type for this column. If a parser has been specified, that object will be used to parse the value. If not, an attempt to parse the value based on the data type will be made.

Parameters:
value - the String value.
Returns:
the Object, or the default value if the value was null or Select.NULL_ENTRY, or if the trimmed value equals "" and this attribute is numeric or a date.
Throws:
EntityException - if a number format exception occurs.

put

public java.lang.Object put(java.lang.String name,
                            java.lang.Object value)
Creates a user-defined attribute.

Parameters:
name - the user-defined attribute name.
value - the value of the user-defined attribute.
Returns:
the previous value associated with specified user-defined attribute, or null if there was no mapping for the name.

remove

public java.lang.Object remove(java.lang.String name)
Removes the specified user-defined attribute.

Parameters:
name - the user-defined attribute name.
Returns:
the value associated with the specified user-defined attribute, or null if there was no mapping for the name.

setAutoIncrement

public void setAutoIncrement(boolean autoIncrement)
Sets whether or not this attribute is automatically incremented by the database server. If this is an auto-increment column, then it will also be set to read-only.

Parameters:
autoIncrement - true if this attribute is automtically incremented by the database server when inserting a new entity.

setDataType

public void setDataType(int sqlType)
Sets the SQL data type of this attribute. Calling this method also resets the input field to one of the correct type.

Parameters:
sqlType - the java.sql.Types field that corresponds to the data type of this attribute.

setDefaultValue

public void setDefaultValue(java.lang.Object defaultValue)
Sets the default value of this attribute, which will be used by the parse(java.lang.String) method if the String to be parsed is null or Select.NULL_ENTRY, or if the trimmed String equals "" and this attribute is numeric or a date.

Parameters:
defaultValue - the default value.

setEditorPosition

public void setEditorPosition(int position)
Determines the position down the page of this input field relative to the other columns when being displayed in the DefaultEditor. The default value is determined by the order in which the Attributes are registered with the Manager.

Parameters:
position - the position of this field in the DefaultEditor. If the position is negative, this field will not be displayed in the editor.
See Also:
getEditorPosition(), Manager.getColumnPosition(java.lang.Class, org.pajes.db.entity.Attributes)

setInputField

public void setInputField(Input field)
Sets the HTML Input field that can be used to display and edit the value of this Entity. If not specified, a default based on the data type will be used.

Parameters:
field - the input field to display or edit the value.
See Also:
getInputField(org.pajes.html.Form)

setLabel

public void setLabel(java.lang.String label)
Sets the default label for auto-generated maintenance screens.

Parameters:
label - the default label for auto-generated maintenance screens.
See Also:
getLabel()

setListerPosition

public void setListerPosition(int position)
Determines the position of this column relative to the other columns when being displayed in the DefaultLister. The default value is determined by the order in which the Attributes are registered with the Manager.

Parameters:
position - the position of this column in the DefaultLister. If the position is negative, this column will not be displayed in the list.
See Also:
getListerPosition(), Manager.getColumnPosition(java.lang.Class, org.pajes.db.entity.Attributes)

setMandatory

public void setMandatory(boolean required)
Determines if this attribute is required by the database server to have a value.

Parameters:
required - true if this attribute is required by the database server to have a value.

setOptimisticLockKey

public void setOptimisticLockKey(boolean on)
Determines whether this column will participate in determining whether the row has been changed or not. The default for all columns is true.

Parameters:
on - if true, this column will be included in a WHERE clause to determine if the row has been changed.
See Also:
isOptimisticLockKey()

setParser

public void setParser(java.text.Format parser)
Specifies the object that will be used by the parse(java.lang.String) method to convert a String to an object of the correct type.

Parameters:
parser - the Format object that will be used by the parse(java.lang.String) method to convert a String to an object of the correct type.
See Also:
parse(java.lang.String)

setPrimaryKey

public void setPrimaryKey(boolean primaryKey)
Determines whether this column participates in the primary key.

Parameters:
primaryKey - true if this attribute is part of the primary key.
See Also:
isPrimaryKey()

setReadOnly

public void setReadOnly(boolean readOnly)
Determines if this attribute should be read only or not.

Parameters:
readOnly - true if this attribute should be read only.

setViewerPosition

public void setViewerPosition(int position)
Determines the position down the page of this element relative to the other columns when being displayed in the DefaultViewer. The default value is determined by the order in which the Attributes are registered with the Manager.

Parameters:
position - the position of this element in the DefaultViewer. If the position is negative, this field will not be displayed in the editor.
See Also:
getViewerPosition(), Manager.getColumnPosition(java.lang.Class, org.pajes.db.entity.Attributes)

PAJES 3.0.21

Copyright 1998-2007 Viridian Pty Limited. All Rights Reserved.