|
Expresso 5-5-0 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.dbobj.DBObjectDef
This object contains the "definition" of the DBObject, while the DBObject itself contains only the data itself. One DBObjectDef object is stored in a static HashMap in the DBObject class, and is looked up and referenced for all definitions of the structure of the given object. since this class is not threadsafe for adding information, it is imperitive that all information addition, typically done when the first instance of a DBObject is instantiated, is done in a synchronized context.
| Constructor Summary | |
DBObjectDef()
Default Constructor. |
|
| Method Summary | |
void |
addDetail(String objName,
String keyFieldsLocal,
String keyFieldsForeign)
Specify a new "detail" db object, and the fields in this object they specify the fields in the related object |
void |
addField(String fieldName,
String fieldType,
int fieldSize,
boolean allowNull,
String fieldDescription)
Add a field with more details: This version of addfield supplies the allowNull flags and a description of the field to be used when reporting errors to the user. |
void |
addField(String fieldName,
String fieldType,
int fieldSize,
boolean allowNull,
String descriptionKey,
String fieldDescription)
Add a field with more details: This version of addfield supplies the allowNull flags and a description of the field to be used when reporting errors to the user. |
void |
addField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String fieldDescription)
Add a field with more details: This version allows the user to specify a precision, for fields that use both a size and precision. |
void |
addIndex(String indexName,
String fieldNames,
boolean isUnique)
Add an index to the table. |
void |
addKey(String keyFieldName)
Add a new field to the list of fields that are part of this object's key. |
void |
addTransition(Transition t)
?????? |
void |
addVirtualField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String fieldDescription)
Add a field with more details: This version allows the user to specify a precision, for fields that use both a size and precision. |
void |
addVirtualField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String descriptionKey,
String fieldDescription)
Add a field with more details: This version allows the user to specify a precision, for fields that use both a size and precision. |
void |
addVirtualField(String fieldName,
String fieldType,
int fieldSize,
String fieldDescription)
Add a new virtual field to the definition of this object. |
void |
addVirtualField(String fieldName,
String fieldType,
int fieldSize,
String descriptionKey,
String fieldDescription)
Add a new virtual field to the definition of this object. |
boolean |
allowsNull(String fieldName)
Returns whether the field allows null values or not. |
boolean |
checkZeroUpdate()
Retrieves whether or not checkZeroUpdate is enabled for this data object |
void |
disableLogging()
Disable change logging of this object |
void |
enableLogging()
Enable logging of changes to this object. |
Set |
getAllAttributes(String fieldName)
Retrieve all the attributes so you can iterate through them. |
HashMap |
getAllDBFields()
|
Hashtable |
getAllFields()
Deprecated. use getAllFieldsMap instead |
Iterator |
getAllFieldsIterator()
Way to get an interator into the allFields objects |
HashMap |
getAllFieldsMap()
Return the "allFields" Hashtable, which contains all of the DBField objects that make up this DB object. |
Hashtable |
getAllKeys()
Deprecated. Use getAllKeysMap or getAllKeysIterator instead |
Iterator |
getAllKeysIterator()
Non-threadsafe way to get an interator into the allKeys data structure |
HashMap |
getAllKeysMap()
Return the "allKeys" hash, containing the DBField objects that make up the primary key for this db object. |
Object |
getAttribute(String fieldName,
String attribName)
Gets an Object attribute from the field's metatdata |
Iterator |
getAttributesIterator(String fieldName)
|
int |
getCacheSize()
Get the current Cache size of this object. |
String |
getCharset()
return the current object's character set |
DBField |
getDBField(String fieldName)
Get the DBField object specified by the fieldname |
String |
getDefaultValue(String fieldName)
Retreive the default value of a particular field for when it is first instantiated |
String |
getDescription()
Return a description of this database object. |
String |
getDescription(Locale l)
Retrieve the table description in a localized way. |
String |
getDescription(Locale l,
String fieldName)
Retrieve an i18n'ized description as per the locale defined for the 'client' |
String |
getDescription(String fieldName)
Return the long description of a field, if available |
String |
getDetailFieldsForeign(String detailName)
Retrieve the foreign key fields |
String |
getDetailFieldsLocal(String detailName)
Retrieve the local key fields. |
Enumeration |
getDetails()
|
Set |
getDetailSet()
Retrieve a set of detail objects. |
Enumeration |
getFieldList()
Deprecated. Use getFieldListArray or getFieldListIterator instead |
ArrayList |
getFieldListArray()
Get a list of all of the fields in this object This is threadsafe in that it makes a new copy of the fieldNamesInOrder ArrayList |
Iterator |
getFieldListIterator()
Get a list of all of the fields in this object This iterator is not thread safe. |
DataFieldMetaData |
getFieldMetadata(String fieldName)
Retrieve the metadata for the field. |
String[] |
getFields()
This convenience method iterates through all the fields belonging to this DBObject
returns an array of field names ( String ). |
FilterManager |
getFilterManager()
|
Object[] |
getIndexArray()
Get an array of DBIndex objects for purpose of creating them through the schema. |
Enumeration |
getKeyFieldList()
Deprecated. Use getKeyFieldArray instead |
ArrayList |
getKeyFieldListArray()
Get a list of all of the names of the key fields in this object |
Iterator |
getKeyFieldListIterator()
Retrieve an interator of key fields |
String |
getLength(String fieldName)
Return the length of a field |
int |
getLengthInt(String fieldName)
Return the length of a field as an integer |
String |
getLookupField(String fieldName)
When you get a lookup object, to perform a complete mapping between the two, you need to know what field name in the remote object maps to this field. |
String |
getLookupObject(String fieldName)
Get a field's lookup object - this is the name of another database object that can be used to look up valid values for this object. |
String |
getName()
Get the name of this object |
int |
getPrecision(String fieldName)
Retrieve the precision of a particular field |
String |
getSchema()
Retrieve the schema object's class name associated with this data object |
String |
getTargetTable()
Return the Table Name of the current database object. |
Iterator |
getTransitionsIterator()
???????????? |
String |
getType(String fieldName)
Return the type of a field - this method returns the internal Expresso type |
boolean |
hasField(String fieldName)
This method will return a boolean true if the field is defined in the DBOBject, false otherwise. |
boolean |
hasIndex()
Returns true if an Index exists for this array. |
boolean |
isAllowsNull(String fieldName)
Returns whether the field allows null values or not. |
boolean |
isField(String fieldName)
Check if a certain name is a field (of any kind) in this DBOBject |
String |
isFieldIgnoreCase(String fieldName)
Check if a certain name is a field (of any kind) in this DBOBject since SQL is case insensitive, ignore case of field name for match, this method takes longer, so use isField if the field name is known precisely |
boolean |
isLoggingEnabled()
Retrieves whether or not change logging is enabled for a particular data object |
boolean |
isMultiValued(String fieldName)
Method called to determine if a particular field is multi-valued, that is does it have a set of specific values and descriptions |
boolean |
isReadOnly(String fieldName)
Is a given field readOnly - these fields are not offered for entry when a form is produced by the generic database maintenance servlet |
boolean |
isSecret(String fieldName)
Is a given field 'secret' - these fields are not shown when a list is produced by the generic database maintenance servlet (DBMaint). |
boolean |
isVirtual(String fieldName)
Is a given field virtual? |
void |
removeAttribute(String fieldName,
String attribName)
Removes an attribute from the field. |
void |
setAttribute(String fieldName,
String attribName,
Object attribValue)
|
void |
setCacheSize(int newValue)
Sets the cache size for this DBObject |
void |
setCharset(String newCharSet)
Set a characterset for a particular field. |
void |
setCheckZeroUpdate(boolean newFlag)
Turn on or off the facility to verify that when an update is made that at least one record got updated. |
void |
setDefaultValue(String fieldName,
String fieldValue)
Sets the default value for a particular field |
void |
setDescription(String newDescription)
Set the description of this object |
void |
setLookupObject(String fieldName,
String objectName)
Set a field's lookup object - this is the name of another database object that can be used to look up valid values for this object. |
void |
setMask(String fieldName,
String newMask)
Sets the field's regular expression validation mask. |
void |
setMultiValued(String fieldName)
Set this field to be multi-valued - e.g. there is a specific list of values that are valid for this field. |
void |
setName(String theName)
Set the name of this object - this name is used to identify the db object with a more human-readable description |
void |
setReadOnly(String fieldName)
Set a field as read-only - these fields are not offered for update when a form is produced by the generic database maintenance servlet (DBMaint). |
void |
setSchema(String schemaName)
|
void |
setSecret(String fieldName)
Set a field as 'secret' - these fields are not shown when a list is produced by the generic database maintenance servlet. |
void |
setStringFilter(String fieldName,
String filterMethod)
Set a filter for a particular field. |
void |
setTargetTable(String theTable)
Set the target table for this DBObject. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DBObjectDef()
throws DBException
DBException| Method Detail |
public void addField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Type of the field - this is the internal Expresso type,
mapping in DBField to a specific database data type.fieldSize - Size of the fieldfieldPrecision - The precision of the fieldallowNull - Does this field allow nulls?fieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException
public void setDefaultValue(String fieldName,
String fieldValue)
throws DBException
fieldName - The name of the field to setfieldValue - the default value to use
DBException - upon errorpublic String getDefaultValue(String fieldName)
DataObjectMetaData
getDefaultValue in interface DataObjectMetaDatafieldName - the name of the field to retrieve
public void addDetail(String objName,
String keyFieldsLocal,
String keyFieldsForeign)
throws DBException
objName - The class name of the related object. There is assumed to be
a one to one or one to many relationship from this object to the specified objectkeyFieldsLocal - A pipe-delimited list of field names in this objectkeyFieldsForeign - A pipe-delimieted list of field names in the other object
DBExceptionpublic Enumeration getDetails()
public String getDetailFieldsLocal(String detailName)
DataObjectMetaData
getDetailFieldsLocal in interface DataObjectMetaDatadetailName - the name of the detail dbobject
public String getDetailFieldsForeign(String detailName)
DataObjectMetaData
getDetailFieldsForeign in interface DataObjectMetaDatadetailName - the name of the detail dbobject
public void addField(String fieldName,
String fieldType,
int fieldSize,
boolean allowNull,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Type of the field - this is the "internal" Expresso type,
and is mapped to a specific type for the database depending on the
mappings in the properties file (if any). The DBField object contains
the default mappings.fieldSize - Size of this field, if specified for this type of field. For
fields that do not use a size (such as "date"), specify 0 for the size.allowNull - Does this field allow nulls?fieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException
public void addField(String fieldName,
String fieldType,
int fieldSize,
boolean allowNull,
String descriptionKey,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Type of the field - this is the "internal" Expresso type,
and is mapped to a specific type for the database depending on the
mappings in the properties file (if any). The DBField object contains
the default mappings.fieldSize - Size of this field, if specified for this type of field. For
fields that do not use a size (such as "date"), specify 0 for the size.allowNull - Does this field allow nulls?descriptionKey - Key into the local language files for this
field's descriptionfieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException
public boolean allowsNull(String fieldName)
throws DBException
fieldName - name of the field
DBException
public void setMask(String fieldName,
String newMask)
throws DBException
fieldName - The field name to associate with this regular expressionnewMask - The actual regular expression.
DBException
public void removeAttribute(String fieldName,
String attribName)
removeAttribute in interface DataObjectMetaDatafieldName - the name of the field to remove the attributeattribName - the attribute name to remove
public void setAttribute(String fieldName,
String attribName,
Object attribValue)
throws DBException
setAttribute in interface DataObjectMetaDatafieldName - the name of the field to set the attribute forattribName - the name of the attribute to setattribValue - the attribute to set
DBException
public Object getAttribute(String fieldName,
String attribName)
throws DBException
Object attribute from the field's metatdata
getAttribute in interface DataObjectMetaDatafieldName - the name of the field for the attributeattribName - the name of the attribute
DBException
public Iterator getAttributesIterator(String fieldName)
throws DBException
DBException
public void addIndex(String indexName,
String fieldNames,
boolean isUnique)
throws IllegalArgumentException
indexName - the name to give the index in the tablefieldNames - A comma delimited list of all fields in the index.isUnique - - True if this field is a unique index.
IllegalArgumentException - of fieldName is null or doesn't exist
or if indexName is null
public void addKey(String keyFieldName)
throws DBException
keyFieldName - The name of the field to add as part of the key
DBException - if the field name is not valid or the field
allows nulls
public void addVirtualField(String fieldName,
String fieldType,
int fieldSize,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Database type of the fieldfieldSize - Size of the field in charactersfieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException
public void addVirtualField(String fieldName,
String fieldType,
int fieldSize,
String descriptionKey,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Database type of the fieldfieldSize - Size of the field in charactersdescriptionKey - Key into the local language files
for the description of this field.fieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException
public void addVirtualField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Type of the field - this is the internal Expresso type,
mapping in DBField to a specific database data type.fieldSize - Size of the fieldfieldPrecision - The precision of the fieldallowNull - Does this field allow nulls?fieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException
public void addVirtualField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String descriptionKey,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Type of the field - this is the internal Expresso type,
mapping in DBField to a specific database data type.fieldSize - Size of the fieldfieldPrecision - The precision of the fieldallowNull - Does this field allow nulls?descriptionKey - Key into the local langauge files
with a description of this fieldfieldDescription - A longer description of this field
(user-understandable hopefully!)
DBExceptionpublic void disableLogging()
disableLogging in interface DataObjectMetaDatapublic void enableLogging()
enableLogging in interface DataObjectMetaDatapublic boolean isLoggingEnabled()
DataObjectMetaData
isLoggingEnabled in interface DataObjectMetaDatapublic Hashtable getAllFields()
public String isFieldIgnoreCase(String fieldName)
isFieldIgnoreCase in interface DataObjectMetaDatafieldName - the name of the field to check
public boolean isField(String fieldName)
isField in interface DataObjectMetaDatafieldName - the name of the field to check
public HashMap getAllFieldsMap()
getAllFieldsMap in interface DataObjectMetaDatapublic HashMap getAllDBFields()
public Iterator getAllFieldsIterator()
public Iterator getKeyFieldListIterator()
public Hashtable getAllKeys()
public HashMap getAllKeysMap()
getAllKeysMap in interface DataObjectMetaDatapublic Iterator getAllKeysIterator()
public String getCharset()
getCharset in interface DataObjectMetaDatapublic int getCacheSize()
getCacheSize in interface DataObjectMetaDatapublic void setCacheSize(int newValue)
setCacheSize in interface DataObjectMetaDatanewValue - the new value. Must be >= -2
IllegalArgumentException - if newValue < -2
public void setCharset(String newCharSet)
throws DBException
newCharSet - The name of the characterset that you will filter against.
For Western-Latin character sets use "ISO-8859-1" as the parameter.
Currently, no other charactersets are implemented. DBException - upon errorfor more information on Filters and implementing Filters for your own
characterset.
Sets the characterset expected for a this DB object. A Table's default
is "ISO-8859-1",
Filter,
ISO_8859_1public String getDescription()
getDescription in interface DataObjectMetaDatapublic String getDescription(Locale l)
getDescription in interface DataObjectMetaDatal - the Locale to use for rendering the table description
public String getDescription(String fieldName)
throws DBException
getDescription in interface DataObjectMetaDatafieldName - The name of the field
DBException - If there is no such field
public String getDescription(Locale l,
String fieldName)
getDescription in interface DataObjectMetaDatal - the Locale to use. If null, will use the System default LocalefieldName - the name of the field to retrieve the i18n'ized description
for.
public DBField getDBField(String fieldName)
fieldName - the name of the field to retrieve
DBField objectpublic Enumeration getFieldList()
public ArrayList getFieldListArray()
getFieldListArray in interface DataObjectMetaDatapublic Iterator getFieldListIterator()
public Enumeration getKeyFieldList()
public ArrayList getKeyFieldListArray()
getKeyFieldListArray in interface DataObjectMetaData
public String getLength(String fieldName)
throws DBException
getLength in interface DataObjectMetaDatafieldName - The name of the field
DBException - If there is no such field in this object
public int getLengthInt(String fieldName)
throws DBException
DataObjectMetaData
getLengthInt in interface DataObjectMetaDatafieldName - The name of the field
DBException - If there is no such field in this object
public int getPrecision(String fieldName)
throws DBException
DataObjectMetaData
getPrecision in interface DataObjectMetaDatafieldName - The name of the field
DBException
public String getLookupObject(String fieldName)
throws DBException
getLookupObject in interface DataObjectMetaDatafieldName - Field name to check
DBException - If the specified field does not exist.public String getLookupField(String fieldName)
getLookupField in interface DataObjectMetaDatafieldName - the name of the field to look up.
IllegalArgumentException - if the field name does not existpublic String getName()
getName in interface DataObjectMetaData
public String getTargetTable()
throws DataException
getTargetTable in interface JDBCObjectMetaDataDataException - upon error
public String getType(String fieldName)
throws DBException
getType in interface DataObjectMetaDatafieldName - The name of the field
DBException - If there is no such field in this objectpublic Object[] getIndexArray()
public boolean hasIndex()
hasIndex in interface JDBCObjectMetaDatapublic boolean hasField(String fieldName)
hasField in interface DataObjectMetaDatafieldName - java.lang.String
public FilterManager getFilterManager()
public boolean isMultiValued(String fieldName)
throws DBException
isMultiValued in interface DataObjectMetaDatafieldName - Name of the field
DBException - If there is no such field
public boolean isReadOnly(String fieldName)
throws DBException
isReadOnly in interface DataObjectMetaDatafieldName - name of the field to check
DBException - Ff there is no such field
public boolean isSecret(String fieldName)
throws DBException
isSecret in interface DataObjectMetaDatafieldName - The name of the field to check
DBException - If there is no such field.setSecret(String)
public boolean isVirtual(String fieldName)
throws DBException
isVirtual in interface DataObjectMetaDatafieldName - The name of the field to check
DBException - If there is no such fieldaddVirtualField(String, String, int, String)public void setCheckZeroUpdate(boolean newFlag)
setCheckZeroUpdate in interface DataObjectMetaDatanewFlag - True to turn on checking, false to turn it offpublic boolean checkZeroUpdate()
DataObjectMetaData
checkZeroUpdate in interface DataObjectMetaDatapublic void setDescription(String newDescription)
newDescription - A description of this database object
public void setLookupObject(String fieldName,
String objectName)
throws DBException
fieldName - The field name that this lookup is associated withobjectName - The db object used to look up valid values for this field.
DBException
public void setMultiValued(String fieldName)
throws DBException
fieldName - The name of the field to specify as multi-valued
DBException - If the field name given is not valid, or is a virtual fieldpublic void setName(String theName)
theName - New name for this object
public void setReadOnly(String fieldName)
throws DBException
Typical uses are for serial-numbered fields and timestamps
fieldName - The name of the field to be reserved as normally read-only.
DBException - If there is no such field.
public void setSecret(String fieldName)
throws DBException
fieldName - The name of the field to set as 'secret'
DBException - if the field does not exist
public void setStringFilter(String fieldName,
String filterMethod)
throws DBException
fieldName - The name of the field to set a particular filter for.filterMethod - The name of the filter method to use when calling a filter.
Can be one of three values:DBException - if: fieldName doesn't exist, or filterType String
isn't a valid value.for more information on Filters and implementing Filters for your own
characterset.
public void setTargetTable(String theTable)
throws DBException
theTable - Table for this object
DBExceptionpublic void setSchema(String schemaName)
schemaName - the name of the schemapublic String getSchema()
DataObjectMetaData
getSchema in interface DataObjectMetaDatapublic String[] getFields()
This convenience method iterates through all the
fields belonging to this DBObject
returns an array of field names ( String ).
getFields in interface DataObjectMetaDatagetFieldList()
public void addTransition(Transition t)
throws DBException
t - ???
DBException
public Iterator getTransitionsIterator()
throws DBException
DBExceptionpublic Set getDetailSet()
getDetailSet in interface DataObjectMetaData
public boolean isAllowsNull(String fieldName)
throws DBException
isAllowsNull in interface DataObjectMetaDatafieldName - name of the field
DBExceptionpublic DataFieldMetaData getFieldMetadata(String fieldName)
getFieldMetadata in interface DataObjectMetaDatafieldName - the name of the field to retrieve the metadata for.
public Set getAllAttributes(String fieldName)
getAllAttributes in interface DataObjectMetaDatafieldName - the name of the field to retrieve.
|
Expresso 5-5-0 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||