Expresso 5-6

com.jcorporate.expresso.core.dataobjects
Interface DataFieldMetaData

All Known Implementing Classes:
DBField

public interface DataFieldMetaData

This interface will eventually have the same public functionality as DBField. It is just used as "Interface"e; glue right now. It will be fleshed out significantly in future versions.

This interface represents the descriptive data for a particular DataField.

Since:
Expresso 5.0
Author:
Michael Rimov

Method Summary
 boolean allowsNull()
          Does this field allow nulls?
 Set getAllAttributes()
          Retrieve a list of all attribute names in the field
 Object getAttribute(String attribName)
          Returns an attribute keyed by name.
 Iterator getAttributesIterator()
          Returns a copy of all attributes associated with this field.
 String getDefaultValue()
          Retrieve the default value of the field.
 String getDescription()
          Return the description of this field.
 int getLengthInt()
          Return the length of this field as an integer
 String getLookupDefinition()
          Future versions of Expresso will rely more on objects that are shown as unique by a combination of their classname and their definition names.
 String getLookupField()
          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()
          Return the value for the lookupObject for this field
 org.apache.oro.text.regex.Pattern getMask()
          Get the compiled regular expression for this field.
 String getName()
          Return the name of the field
 int getPrecision()
          Return the precision of this field as an integer
 String getTypeString()
          Return the database type of the field as specified with a string in the DBObject itself
 boolean isAutoIncremented()
          Is this field an auto-incremented field?
 boolean isBinaryObjectType()
          Is it a BLOB?
 boolean isBooleanType()
          is the field a boolean?
 boolean isCharacterLongObjectType()
          Is this field fall into the classification of a long character object?
 boolean isDateOnlyType()
          is the field a date or time field?
 boolean isDateTimeType()
          is the field a date or time field?
 boolean isDateType()
          is the field a date or time field?
 boolean isEncrypted()
          Return the field's hashed status
 boolean isFloatingPointType()
           
 boolean isHashed()
          Return the field's hashed status
 boolean isKey()
          Is this field a key field?
 boolean isLongBinaryType()
          Is it a BLOB?
 boolean isLongCharacterType()
          Is it a BLOB?
 boolean isLongObjectType()
          Does this field fall into a class of BLOB object data types?
 boolean isMasked()
          Return boolean if the field has a mask set
 boolean isMultiValued()
          Is this field multi-valued?
 boolean isNumericType()
          is the field a numeric field?
 boolean isQuotedTextType()
          is the field a quoted text field?
 boolean isReadOnly()
          Return the field's read-only
 boolean isSecret()
          Return the field's secret status
 boolean isTimeType()
          is the field a date or time field?
 boolean isVirtual()
          Is this field a virtual field?
 void removeAttribute(String attribName)
          Removes an attribute from this Field object.
 void setAttribute(String attribName, Object attribValue)
          Sets an attribute for this particular field.
 void setDefaultValue(String newValue)
          Sets the new default value as a string for the field.
 void setEncrypted(boolean newValue)
          Set the field's encrypted status
 void setHashed(boolean newValue)
          Set the field's hashed status.
 void setKey(boolean newKey)
          Set this field as a key field (or not)
 void setLookupObject(String objectName)
          Set the value for the "lookup object" for this field.
 void setMask(org.apache.oro.text.regex.Pattern newMask)
          Set a regular expression "mask" for this field that specifies it's valid values.
 void setMultiValued(boolean newMulti)
          Set this field to be "multi-valued".
 void setReadOnly()
          Set the field as a read-only field.
 void setSecret()
          Set the field as a 'secret' field.
 void setVirtual(boolean newVirtual)
          Set this field as a virtual field.
 

Method Detail

allowsNull

public boolean allowsNull()
Does this field allow nulls?

Returns:
boolean True if the field allows null, else false if it does not

getDefaultValue

public String getDefaultValue()
Retrieve the default value of the field.

Returns:
String java.lang.String

getDescription

public String getDescription()
Return the description of this field. This field name is not i18n'ized, use DataObjectMetaData with Locale parameter to get the i18n'ized escription

Returns:
String Description of the field

getLengthInt

public int getLengthInt()
Return the length of this field as an integer

Returns:
int The length of this field in characters

getLookupObject

public String getLookupObject()
Return the value for the lookupObject for this field

Returns:
String for the lookup object for this field

getLookupField

public String getLookupField()
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.

Returns:
java.lang.String or null if there is no lookup field
Throws:
IllegalArgumentException - if the field name does not exist

getLookupDefinition

public String getLookupDefinition()
Future versions of Expresso will rely more on objects that are shown as unique by a combination of their classname and their definition names. All instances of Defineable must have a corresponding definition name.

Returns:
java.lang.String

getName

public String getName()
Return the name of the field

Returns:
String The name of this field

getPrecision

public int getPrecision()
Return the precision of this field as an integer

Returns:
int The precision of this field

getTypeString

public String getTypeString()
Return the database type of the field as specified with a string in the DBObject itself

Returns:
The type of this field

isKey

public boolean isKey()
Is this field a key field?

Returns:
true if this field is a key field

isMultiValued

public boolean isMultiValued()
Is this field multi-valued?

Returns:
boolean True if the field is multi-valued, else false

isReadOnly

public boolean isReadOnly()
Return the field's read-only

Returns:
True if the field is readonly, else false if it is not

isBooleanType

public boolean isBooleanType()
is the field a boolean? cache answer for efficiency, since field type is immutable

Returns:
True if the field is boolean

isCharacterLongObjectType

public boolean isCharacterLongObjectType()
Is this field fall into the classification of a long character object?

Returns:
boolean true if it does

isLongObjectType

public boolean isLongObjectType()
Does this field fall into a class of BLOB object data types?

Returns:
boolean true if it does

isBinaryObjectType

public boolean isBinaryObjectType()
Is it a BLOB? This is calculated by if it is a long object and is NOT a character long object.

Returns:
boolean True if it is

isLongBinaryType

public boolean isLongBinaryType()
Is it a BLOB? This is calculated by if it is a long object and is NOT a character long object.

Returns:
boolean True if it is

isLongCharacterType

public boolean isLongCharacterType()
Is it a BLOB? This is calculated by if it is a long object and is NOT a character long object.

Returns:
boolean True if it is

isQuotedTextType

public boolean isQuotedTextType()
is the field a quoted text field? cache answer for efficiency, since field type is immutable

Returns:
True if the field is text field

isNumericType

public boolean isNumericType()
is the field a numeric field? cache answer for efficiency, since field type is immutable

Returns:
true if the field is numberic field

isDateType

public boolean isDateType()
is the field a date or time field? cache answer for efficiency, since field type is immutable

Returns:
true if the field is date or time field

isDateOnlyType

public boolean isDateOnlyType()
is the field a date or time field? cache answer for efficiency, since field type is immutable author Yves Henri AMAIZO

Returns:
true if the field is date field

isFloatingPointType

public boolean isFloatingPointType()

isTimeType

public boolean isTimeType()
is the field a date or time field? cache answer for efficiency, since field type is immutable author Yves Henri AMAIZO

Returns:
true if the field is time field

isDateTimeType

public boolean isDateTimeType()
is the field a date or time field? cache answer for efficiency, since field type is immutable author Yves Henri AMAIZO

Returns:
true if the field is dateTime or Timestamp field

isSecret

public boolean isSecret()
Return the field's secret status

Returns:
True if the field is secret, else false if it is not

isHashed

public boolean isHashed()
Return the field's hashed status

Returns:
True if the field is secret, else false if it is not

isEncrypted

public boolean isEncrypted()
Return the field's hashed status

Returns:
True if the field is secret, else false if it is not

isVirtual

public boolean isVirtual()
Is this field a virtual field? E.g. not stored in the database

Returns:
boolean True if the field is virtual, else false

isMasked

public boolean isMasked()
Return boolean if the field has a mask set

Returns:
True if the field mask is set, else false if it is not

setKey

public void setKey(boolean newKey)
Set this field as a key field (or not)

Parameters:
newKey - Is this field a key?

setLookupObject

public void setLookupObject(String objectName)
Set the value for the "lookup object" for this field. This is a database object name which can be used to look up valid values for this field by the user. This is used by the standard maintenance forms to create a "Lookup" link alongside the field if this value is set

Parameters:
objectName - the classname of the lookup object

setMultiValued

public void setMultiValued(boolean newMulti)
Set this field to be "multi-valued". A multi-valued field has a specific set of valid values, often from another database object. Any multi-valued field may be used in a call to the getValues method, which will return a hashtable of the valid values for the field and descriptions for those values.

Parameters:
newMulti - True if the field is multi-valued, false if it is not

setHashed

public void setHashed(boolean newValue)
Set the field's hashed status. Only works if the field is a string data type (in the future CLOB should be ok too) [This is currently not yet implemented and tested]

Parameters:
newValue - true if you want this field hashed.

setEncrypted

public void setEncrypted(boolean newValue)
Set the field's encrypted status

Parameters:
newValue - new value if you want an encrypted field

setDefaultValue

public void setDefaultValue(String newValue)
Sets the new default value as a string for the field.

Parameters:
newValue - String

setReadOnly

public void setReadOnly()
Set the field as a read-only field. Read only fields are still used against the database, but are not offered for updating when the automatic database maintenance servlet creates a form on the screen. Note this is different from the setAutoIncremented method below, which means this field will not participate in any add or update statement to the database.


isAutoIncremented

public boolean isAutoIncremented()
Is this field an auto-incremented field?

Returns:
true if this field is autoincremented

setSecret

public void setSecret()
Set the field as a 'secret' field. Secret fields are not shown in listings of data from this database object, and are only available to users with update, add or delete permissions


setVirtual

public void setVirtual(boolean newVirtual)
Set this field as a virtual field. A virtual field is part of the object but not stored in the database table.

Parameters:
newVirtual - True to make this object virtual, false if it is not

setMask

public void setMask(org.apache.oro.text.regex.Pattern newMask)
Set a regular expression "mask" for this field that specifies it's valid values. The mask should already be compiled by the regular expression compiler

Parameters:
newMask - The compiled regular expression mask

getMask

public org.apache.oro.text.regex.Pattern getMask()
Get the compiled regular expression for this field.

Returns:
the precompiled regular expression mask

removeAttribute

public void removeAttribute(String attribName)
Removes an attribute from this Field object.

Parameters:
attribName - The name of the attribute to remove from this field.

setAttribute

public void setAttribute(String attribName,
                         Object attribValue)
Sets an attribute for this particular field.

Parameters:
attribName - the name of the attribute
attribValue - the value of the attribute by this name

getAttribute

public Object getAttribute(String attribName)
Returns an attribute keyed by name. An attribute is an arbitrary object you can associate with a particular db field.

Parameters:
attribName - the name of the attribute to get
Returns:
java.lang.Object the object associated with this attribute name

getAllAttributes

public Set getAllAttributes()
Retrieve a list of all attribute names in the field

Returns:
java.util.Set

getAttributesIterator

public Iterator getAttributesIterator()
Returns a copy of all attributes associated with this field.

Returns:
a valid Iterator to a HashMap OR null if no attributes exist for this field

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.