com.wm.app.tn.profile
Class ProfileFieldMetaData

java.lang.Object
  extended by com.wm.app.tn.util.TNFixedData
      extended by com.wm.app.tn.profile.ProfileFieldMetaData
All Implemented Interfaces:
com.wm.data.IData, com.wm.util.sort.Sortable, java.lang.Cloneable

public class ProfileFieldMetaData
extends TNFixedData
implements com.wm.util.sort.Sortable

A ProfileFieldMetaData object holds information about a profile field.

The metadata also defines certain constrains about the field, such as whether it is required, it's set of valid values and it's default value.

See Also:
ExtendedProfileField

Nested Class Summary
 
Nested classes/interfaces inherited from class com.wm.app.tn.util.TNFixedData
TNFixedData.TreeCursor
 
Field Summary
static java.lang.String VALUE_SEP
          Separates the values in a list of valid values for an extended field.
 
Constructor Summary
ProfileFieldMetaData()
          Creates an empty ProfileFieldMetaData.
 
Method Summary
 int compare(com.wm.util.sort.Sortable compareTo, boolean reverse, int column)
          Takes another ProfileFieldMetaData and returns -1 if it is less than this ProfileFieldMetaData 0 if it is equal to this ProfileFieldMetaData 1 if it is greater than this ProfileFieldMetaData
static com.wm.data.IData create()
          Creates a ProfileFieldMetaData.
 void delete()
          Marks the field as deleted.
 java.lang.String getColumn()
           
 java.lang.String getDatatype()
           
 java.lang.String getDefaultValue()
           
 java.lang.String getDescription()
           
 java.lang.String getDisplayName()
           
 java.lang.String getFieldID()
           
 java.lang.String getFieldName()
           
 int getGroupID()
           
 java.lang.String getGroupName()
          Internal use only; may be null all the time except during export operation
 int getMaxLength()
           
 java.lang.String getTable()
           
 java.util.Enumeration getValidValues()
           
 java.lang.String getValidValueString()
           
 boolean isDeleted()
          Is this field deleted?
 boolean isDisplayable()
          Is this field displayed in the dictionary?
 boolean isExtended()
          Is this an extended field?
 boolean isRegistration()
          Is this a registration field?
 boolean isRequired()
          Is this a required field?
 boolean isStandard()
          Is this a standard field?
 boolean isValid(java.lang.StringBuffer err)
          Determines if the ProfileFieldMetaData is valid.
 void setColumn(java.lang.String column)
          for internal use only
 void setDatatype(java.lang.String datatype)
          Sets the extended field's data type.
 void setDefaultValue(java.lang.String defVal)
          Sets the extended field's default value.
 void setDescription(java.lang.String desc)
          Sets the field's description.
 void setDisplayable(boolean disp)
          Sets whether this field is displayable in the profile dictionary.
 void setExtended(boolean ext)
          for internal use only
 void setFieldID(java.lang.String id)
          for internal use only
 void setFieldName(java.lang.String name)
          Sets the field's name.
 void setGroupID(short group)
          Sets the extended field's group id.
 void setGroupName(java.lang.String groupName)
          Internal Use only
 void setMaxLength(int len)
          Sets this field's maximum length.
 void setRegistration(boolean reg)
          Sets whether this field is to be used for registration (profile exchange).
 void setRequired(boolean reqd)
          Sets whether this field is required.
 void setTable(java.lang.String table)
          for internal use only
 void setValidValues(java.lang.String validVals)
          Sets the extended field's set of valid values.
 void setValidValues(java.util.Vector validVals)
          Sets the extended field's set of valid values.
 java.lang.String toString()
          Default toString implementation returns class name followed by contents.
 void undelete()
          Marks the field as undeleted.
 
Methods inherited from class com.wm.app.tn.util.TNFixedData
clone, dataSize, get, get, getCursor, getHashCursor, getIndexCursor, getKey, getSharedCursor, getTreeCursor, indexOf, merge, set, set
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VALUE_SEP

public static final java.lang.String VALUE_SEP
Separates the values in a list of valid values for an extended field.

See Also:
Constant Field Values
Constructor Detail

ProfileFieldMetaData

public ProfileFieldMetaData()
Creates an empty ProfileFieldMetaData.

Method Detail

create

public static com.wm.data.IData create()
Creates a ProfileFieldMetaData. Used by the IDataCoders


setRegistration

public final void setRegistration(boolean reg)
Sets whether this field is to be used for registration (profile exchange).


setRequired

public final void setRequired(boolean reqd)
Sets whether this field is required.


setDisplayable

public final void setDisplayable(boolean disp)
Sets whether this field is displayable in the profile dictionary.


setMaxLength

public final void setMaxLength(int len)
Sets this field's maximum length. A value less than 1 means no maximum.


setDescription

public final void setDescription(java.lang.String desc)
Sets the field's description.


setGroupID

public final void setGroupID(short group)
Sets the extended field's group id. Do not change an existing field's Group.

Throws:
java.lang.IllegalArgumentException - if group is not recognized.

setFieldID

public final void setFieldID(java.lang.String id)
for internal use only


setExtended

public final void setExtended(boolean ext)
for internal use only


setTable

public final void setTable(java.lang.String table)
                    throws ProfileStoreException
for internal use only

Throws:
ProfileStoreException

setColumn

public final void setColumn(java.lang.String column)
                     throws ProfileStoreException
for internal use only

Throws:
ProfileStoreException

delete

public final void delete()
                  throws ProfileStoreException
Marks the field as deleted.

Throws:
ProfileStoreException - if this is a standard field.

undelete

public final void undelete()
                    throws ProfileStoreException
Marks the field as undeleted.

Throws:
ProfileStoreException - if this is a standard field.

setFieldName

public final void setFieldName(java.lang.String name)
Sets the field's name.


setDatatype

public final void setDatatype(java.lang.String datatype)
                       throws ProfileStoreException
Sets the extended field's data type.

Throws:
ProfileStoreException - if this is a standard field.
java.lang.IllegalArgumentException - if dataype is not recognized.

setDefaultValue

public final void setDefaultValue(java.lang.String defVal)
                           throws ProfileStoreException
Sets the extended field's default value.

Throws:
ProfileStoreException - if this is a standard field.

setValidValues

public final void setValidValues(java.lang.String validVals)
                          throws ProfileStoreException
Sets the extended field's set of valid values.

Parameters:
validVals - a list of String values, separated by the defined value separator.
Throws:
ProfileStoreException - if this is a standard field.

setValidValues

public final void setValidValues(java.util.Vector validVals)
                          throws ProfileStoreException
Sets the extended field's set of valid values.

Parameters:
validVals - a Vector of Strings - the valid values
Throws:
ProfileStoreException - if this is a standard field.

setGroupName

public final void setGroupName(java.lang.String groupName)
Internal Use only


getFieldID

public final java.lang.String getFieldID()
Returns:
the field's ID.

getGroupID

public final int getGroupID()
Returns:
the ID of the field's group.

getDisplayName

public final java.lang.String getDisplayName()
Returns:
the field's name for UI display purpose.

getFieldName

public final java.lang.String getFieldName()
Returns:
the field's name.

getMaxLength

public final int getMaxLength()
Returns:
the field's maximum length.

isExtended

public final boolean isExtended()
Is this an extended field?


isStandard

public final boolean isStandard()
Is this a standard field?


isRequired

public final boolean isRequired()
Is this a required field?


isRegistration

public final boolean isRegistration()
Is this a registration field?


isDisplayable

public final boolean isDisplayable()
Is this field displayed in the dictionary?


isDeleted

public final boolean isDeleted()
Is this field deleted?


getTable

public final java.lang.String getTable()
Returns:
the standard field's table name.

getColumn

public final java.lang.String getColumn()
Returns:
the standard field's column name.

getDatatype

public final java.lang.String getDatatype()
Returns:
the extended field's data type.

getDefaultValue

public final java.lang.String getDefaultValue()
Returns:
the extended field's default value.

getValidValueString

public final java.lang.String getValidValueString()
Returns:
a String of VALUE_SEP-separated valid values for the field

getValidValues

public final java.util.Enumeration getValidValues()
Returns:
An Enumeration of the set of valid values for the field

getDescription

public final java.lang.String getDescription()
Returns:
if it's an extended field, a String description. If it's a standard field, null.

getGroupName

public final java.lang.String getGroupName()
Internal use only; may be null all the time except during export operation


isValid

public final boolean isValid(java.lang.StringBuffer err)
Determines if the ProfileFieldMetaData is valid.

Parameters:
err - A StringBuffer that will contain error messages if the metadata is not valid. If valid, the StringBuffer will be unchanged.
Returns:
true if the metadata is valid and can be saved, otherwise false.

compare

public final int compare(com.wm.util.sort.Sortable compareTo,
                         boolean reverse,
                         int column)
Takes another ProfileFieldMetaData and returns -1 if it is less than this ProfileFieldMetaData 0 if it is equal to this ProfileFieldMetaData 1 if it is greater than this ProfileFieldMetaData

Specified by:
compare in interface com.wm.util.sort.Sortable
Parameters:
compareTo - the ProfileFieldMetaData to compare against
reverse - if true, return multiplicative inverse
column - IGNORED BY THIS IMPLEMENTATION

toString

public final java.lang.String toString()
Description copied from class: TNFixedData
Default toString implementation returns class name followed by contents.

Overrides:
toString in class TNFixedData
Returns:
a String representing the ProfileFieldMetaData