planetj.database.fielddescriptors
Class FieldDescriptorManager

java.lang.Object
  |
  +--planetj.database.fielddescriptors.FieldDescriptorManager
All Implemented Interfaces:
IFieldData

public class FieldDescriptorManager
extends Object
implements IFieldData

Author:
PlanetJ Corporation

Field Summary
 
Fields inherited from interface planetj.database.fielddescriptors.IFieldData
APPLICATION_ID, ASSOCIATION_FIELD_ID, ASSOCIATION_ID, AUTHORIZE_EDIT_OPERATION, AUTHORIZE_READ_OPERATION, AUTO_TRIM_ON_READ, AUTO_TRIM_ON_WRITE, AUTO_TRIM_SPACES, AUTO_UPDATE_VALUE, BUFFER_LENGTH, CHAR_OCTET_LENGTH, COLUMN_DEF, COLUMN_NAME, COLUMN_SIZE, COMPANY_ID, CONCURRENCY, CONCURRENT_DELETES_ALLOWED, CONCURRENT_UPDATES_ALLOWED, CONCURRENT_UPDATES_AND_DELETES_ALLOWED, DATA_SQL_OPERATION_ID, DATA_TYPE, DECIMAL_DIGITS, DISPLAY_COMPONENT, DISPLAY_COMPONENT_ASSOC_OPERATION, DISPLAY_COMPONENT_EDITABLE_SELECT, DISPLAY_COMPONENT_EDITABLE_SELECT_TEXT_AREA, DISPLAY_COMPONENT_FILE_UPLOAD, DISPLAY_COMPONENT_LIST, DISPLAY_COMPONENT_RADIO_BUTTON_PV_SELECT, DISPLAY_COMPONENT_SYSTEM, DISPLAY_COMPONENT_TEXT_AREA, DISPLAY_HEIGHT, DISPLAY_LENGTH, DISPLAY_ORDER, DISPLAY_RULE, DISPLAY_RULE_ADMINISTRATOR, DISPLAY_RULE_ALWAYS, DISPLAY_RULE_HIDE_IF_NA_ALWAYS, DISPLAY_RULE_HIDE_IF_NA_ON_INSERT, DISPLAY_RULE_HIDE_IF_NA_ON_UPDATE, DISPLAY_RULE_HIDE_IF_NA_ON_UPDATE_AND_INSERT, DISPLAY_RULE_HIDE_ON_INSERT, DISPLAY_RULE_HIDE_ON_UPDATE, DISPLAY_RULE_HIDE_ON_UPDATE_AND_INSERT, DISPLAY_RULE_NEVER, DIVISION_ID, EXTERNAL_NAME, FIELD_CLASS, FIELD_CLASS_ID, FIELD_DATA_TABLE_NAME, FIELD_DESCRIPTOR_TYPE, FIELD_SET, FORMATTER_CLASS, FORMATTER_CLASS_ID, GETTER_METHOD, HELP_TEXT, ID, IS_AUTO_INCREMENT, IS_CASE_SENSITIVE, IS_CURRENCY, IS_DEFINITELY_WRITABLE, IS_NULLABLE, IS_READ_ONLY, IS_REQUIRED, IS_REQUIRED_ON_SEARCH, IS_SEARCHABLE, IS_SIGNED, IS_SORTABLE, IS_WRITABLE, KEY_POSITION, MAX_LIBRARY_NAME_LENGTH, MAX_TABLE_NAME_LENGTH, NO_CONCURRENT_ALTERATIONS_ALLOWED, NULLABLE, NUM_PREC_RADIX, ORDINAL_POSITION, ORIGIN_DB_METADATA, ORIGIN_FIELDDATA_FILE, ORIGIN_RS_METADATA, OWNER_ID, PARAM_DIGIT_REQUIRED, PARAM_MIN_LENGTH, POSSIBLE_VALUES_KEY, PV_CLASS, PV_CLASS_ID, PV_SQL_OPERATION_ID, REMARKS, SECURITY_ID, SECURITY_TYPE, SETTER_METHOD, SQL_DATA_TYPE, SQL_DATETIME_SUB, STATUS_CHANGE, STATUS_CHANGE_DEFAULT, STATUS_CHANGE_NO, STATUS_CHANGE_YES, STYLE_CLASS, SWITCHES, SYSTEM_ALIAS, SYSTEM_URL, TABLE_CAT, TABLE_ID, TABLE_NAME, TABLE_SCHEM, TYPE_DEFAULT_FIELD_DESCRIPTOR, TYPE_DERIVED_FIELD_DESCRIPTOR, TYPE_DRILL_DOWN_FIELD_DESCRIPTOR, TYPE_NAME, TYPE_ONE_TO_MANY_ASSOCIATION_FIELD_DESCRIPTOR, TYPE_ONE_TO_ONE_ASSOCIATION_FIELD_DESCRIPTOR, TYPE_POSSIBLE_VALUES_FIELD_DESCRIPTOR, TYPE_TABLE_DESCRIPTOR, USAGE_ID, XML_TAG
 
Constructor Summary
FieldDescriptorManager()
           
 
Method Summary
static void addFD(FieldDescriptorRow pFD)
          Adds the FieldDescriptor to the internal store
static void addFD(FieldDescriptorRow pFD, boolean pReplace)
          Add Field Descriptors for this table, optionally replace existing field descriptors.
static void addFD(FieldDescriptorRow pFD, Table pTable)
          Removes all FieldDescriptors for all systems.
static void addFD(FieldDescriptorRow pFD, Table pTable, boolean pReplace)
          Removes all FieldDescriptors for all systems.
static void addFDs(List pFDs)
          Removes all FieldDescriptors for all systems.
static void addFDs(List pFDs, boolean pReplace)
          Removes all FieldDescriptors for all systems.
static void addFDs(List pFDs, Table pTable)
          Removes all FieldDescriptors for all systems.
static void addFDs(List pFDs, Table pTable, boolean pReplace)
          Sets the FD's for a table
static void addFDs(RowCollection pFDRows)
          Add field descriptors.
static void addFDs(RowCollection pFDRows, boolean pReplace)
          Add field descriptors.
static void addFDs(RowCollection pFDRows, Table pTable)
          Add field descriptors.
static void addFDs(RowCollection pFDRows, Table pTable, boolean pReplace)
          Add field descriptors.
static void clearFieldDescriptors()
          Removes all FieldDescriptors for all systems.
static FieldDescriptorCollection clearFieldDescriptors(Table table)
          Removes all FieldDescriptors for all systems.
static void clearFieldDescriptorsForSystem(String systemAlias)
          Removes all field descriptors for the specified system from the FD cache
static FieldDescriptorRow createFDFromDBMetaData(Connection pConnection, Field pField)
          Create a field descriptor for the specified field name in the table from the given connection.
static FieldDescriptorRow createFDFromDBMetaData(Connection pConnection, Table pTable, String pFieldName)
          Create a field descriptor for the specified field name in the table from the given connection.
static FieldDescriptorRow createFDFromDBMetaData(Field pField)
          Create a field descriptor for the specified Field.
static FieldDescriptorRow createFDFromDBMetaData(Table pTable, String pFieldName)
          Create a field descriptor for the specified field name in the table.
static FieldDescriptorRow createFDFromRSMetaData(int pColumnIndex, ResultSetMetaData pRSMetaData, String metaDataAlias)
          Deprecated. replaced with createFDFromRSMetaData(int, ResultSetMetaData, Table)
static FieldDescriptorRow createFDFromRSMetaData(int pColumnIndex, ResultSetMetaData pRSMetaData, Table pTable)
          Creates and returns a FieldDescriptor using the given ResultSetMetaData and column index.
static List createFDsFromDBMetaData(Connection pConnection, Library pLibrary)
          Create field descriptors for the specified Library.
static RowCollection createFDsFromDBMetaData(Connection pConnection, Table pTable)
          Create field descriptors for the specified Table.
static List createFDsFromDBMetaData(Library pLibrary)
          Create field descriptors for the specified Library.
static RowCollection createFDsFromDBMetaData(Table pTable)
          Create field descriptors for the specified Table.
static RowCollection createFDsFromFile(Table pTable)
          Retrieves and creates any new FieldDescriptors from the Field data file that have not yet been created for the specified Table.
static boolean createFieldDataFile(String pFDSystemAlias)
          Creates the Field data file if it doesn't already exist.
static String createFieldDataTableSQL()
           
static StringBuffer generateJavaCode(FieldDescriptorRow fd, RowClassProperties pProps, StringBuffer pSB)
           
static RowCollection getAssociationsForTable(Table pTable)
           
static Class getDefaultClassForLogicalType(int pFieldDescriptorType)
          Gets the Class that is registered as the default class for the specifed type of logical] field descriptor.
static IFDModifier getFDModifier()
          Gets the modifier that will be used to modify FD's read from RS or DB metadata (may be null)
static RowCollection getFDsFromFile(Library pLibrary, int pNumPerPage)
           
static RowCollection getFDsFromFile(String pFDSystemAlias, Library pLibrary, int pNumPerPage)
           
static RowCollection getFDsFromFile(Table pTable, int pNumPerPage)
           
static RowCollection getFDsFromFile(Table pTable, int pNumPerPage, List orderByColumns)
           
static Table getFieldDataTable(String pFDSystemAlias)
          Returns the Field data file Table object.
static String getFieldDataTableName()
           
static FieldDescriptorRow getFieldDescriptor(Field pField)
          Return an IFieldDescriptor for the given Field, if it doesn't exist then create it from DatabaseMetaData.
static FieldDescriptorRow getFieldDescriptor(String pFieldName, Table pTable)
          Returns the FieldDescriptor for the given Field name.
static FieldDescriptorRow getFieldDescriptor(String pFieldName, Table pTable, boolean pCheckFieldDataFile)
          Returns the FieldDescriptor for the given Field name.
static FieldDescriptorCollection getFieldDescriptors(Table pTable)
          Returns a map of FieldDescriptors created for the given Table.
static FieldDescriptorCollection getFieldDescriptors(Table pTable, boolean pCheckFieldDataFile)
          Returns a map of FieldDescriptors created for the given Table.
static boolean isFDFileUsed()
           
static void registerDefaultFieldClass(int pFieldDescriptorType, Class pFieldClass)
          Registers a Field class as the default Field class for a specific type of logical field descriptor.
static void removeFD(FieldDescriptorRow fd)
           
static void setFDFileUsed(boolean pFDFileUsed)
           
static void setFDModifier(IFDModifier newFDModifier)
          Sets the modifier that will be used to modify FD's read from RS or DB metadata (may be null)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldDescriptorManager

public FieldDescriptorManager()
Method Detail

addFD

public static void addFD(FieldDescriptorRow pFD)
                  throws CMException
Adds the FieldDescriptor to the internal store

CMException

addFD

public static void addFD(FieldDescriptorRow pFD,
                         Table pTable)
                  throws CMException
Removes all FieldDescriptors for all systems.

CMException

addFD

public static void addFD(FieldDescriptorRow pFD,
                         Table pTable,
                         boolean pReplace)
                  throws CMException
Removes all FieldDescriptors for all systems.

CMException

addFD

public static void addFD(FieldDescriptorRow pFD,
                         boolean pReplace)
                  throws CMException
Add Field Descriptors for this table, optionally replace existing field descriptors.

CMException

addFDs

public static void addFDs(List pFDs)
                   throws CMException
Removes all FieldDescriptors for all systems.

CMException

addFDs

public static void addFDs(List pFDs,
                          Table pTable)
                   throws CMException
Removes all FieldDescriptors for all systems.

CMException

addFDs

public static void addFDs(List pFDs,
                          Table pTable,
                          boolean pReplace)
                   throws CMException
Sets the FD's for a table

CMException

addFDs

public static void addFDs(List pFDs,
                          boolean pReplace)
                   throws CMException
Removes all FieldDescriptors for all systems.

CMException

addFDs

public static void addFDs(RowCollection pFDRows)
                   throws CMException
Add field descriptors.

CMException

addFDs

public static void addFDs(RowCollection pFDRows,
                          Table pTable)
                   throws CMException
Add field descriptors.

CMException

addFDs

public static void addFDs(RowCollection pFDRows,
                          Table pTable,
                          boolean pReplace)
                   throws CMException
Add field descriptors.

CMException

addFDs

public static void addFDs(RowCollection pFDRows,
                          boolean pReplace)
                   throws CMException
Add field descriptors.

CMException

clearFieldDescriptors

public static void clearFieldDescriptors()
Removes all FieldDescriptors for all systems.


clearFieldDescriptors

public static FieldDescriptorCollection clearFieldDescriptors(Table table)
Removes all FieldDescriptors for all systems.


clearFieldDescriptorsForSystem

public static void clearFieldDescriptorsForSystem(String systemAlias)
Removes all field descriptors for the specified system from the FD cache


createFDFromDBMetaData

public static FieldDescriptorRow createFDFromDBMetaData(Connection pConnection,
                                                        Field pField)
                                                 throws CMException
Create a field descriptor for the specified field name in the table from the given connection.

Parameters:
pConnection - connection to query for field descriptor info
pField - field to create field descriptor for
Returns:
generated field descriptor
CMException

createFDFromDBMetaData

public static FieldDescriptorRow createFDFromDBMetaData(Connection pConnection,
                                                        Table pTable,
                                                        String pFieldName)
                                                 throws CMException
Create a field descriptor for the specified field name in the table from the given connection.

Parameters:
pConnection - connection to query for field descriptor info
pTable - table to create field descriptor for
pFieldName - name of field to create field descriptor for
Returns:
generated field descriptor
CMException

createFDFromDBMetaData

public static FieldDescriptorRow createFDFromDBMetaData(Field pField)
                                                 throws CMException
Create a field descriptor for the specified Field.

Parameters:
pField - to create field descriptor for
Returns:
generated field descriptor
CMException

createFDFromDBMetaData

public static FieldDescriptorRow createFDFromDBMetaData(Table pTable,
                                                        String pFieldName)
                                                 throws CMException
Create a field descriptor for the specified field name in the table.

Parameters:
pTable - table to create field descriptor for
pFieldName - name of field to create field descriptor for
Returns:
generated field descriptor
CMException

createFDFromRSMetaData

public static FieldDescriptorRow createFDFromRSMetaData(int pColumnIndex,
                                                        ResultSetMetaData pRSMetaData,
                                                        String metaDataAlias)
                                                 throws CMException
Deprecated. replaced with createFDFromRSMetaData(int, ResultSetMetaData, Table)

Creates and returns a FieldDescriptor using the given ResultSetMetaData and column index. And then caches the FieldDescriptor for the specified table.

Parameters:
pColumnIndex -
pRSMetaData -
Returns:
FieldDescriptorRow created and stored using information from the parameters.
CMException

createFDFromRSMetaData

public static FieldDescriptorRow createFDFromRSMetaData(int pColumnIndex,
                                                        ResultSetMetaData pRSMetaData,
                                                        Table pTable)
                                                 throws CMException
Creates and returns a FieldDescriptor using the given ResultSetMetaData and column index. And then caches the FieldDescriptor for the specified table.

Parameters:
pColumnIndex -
pRSMetaData -
pTable -
Returns:
FieldDescriptorRow created and stored using information from the parameters.
CMException

createFDsFromDBMetaData

public static List createFDsFromDBMetaData(Connection pConnection,
                                           Library pLibrary)
                                    throws CMException
Create field descriptors for the specified Library.

Parameters:
pLibrary - to create field descriptors for
Returns:
list of RowCollections of generated field descriptors
CMException

createFDsFromDBMetaData

public static RowCollection createFDsFromDBMetaData(Connection pConnection,
                                                    Table pTable)
                                             throws CMException
Create field descriptors for the specified Table.

Parameters:
pTable - to create field descriptors for
Returns:
list of RowCollections of generated field descriptors
CMException

createFDsFromDBMetaData

public static List createFDsFromDBMetaData(Library pLibrary)
                                    throws CMException
Create field descriptors for the specified Library.

Parameters:
pLibrary - to create field descriptors for
Returns:
list of RowCollections of generated field descriptors
CMException

createFDsFromDBMetaData

public static RowCollection createFDsFromDBMetaData(Table pTable)
                                             throws CMException
Create field descriptors for the specified Table.

Parameters:
pTable - to create field descriptors for
Returns:
generated field descriptors
CMException

createFDsFromFile

public static RowCollection createFDsFromFile(Table pTable)
                                       throws CMException
Retrieves and creates any new FieldDescriptors from the Field data file that have not yet been created for the specified Table.

Parameters:
pTable - Table to use for looking for new FieldDescriptors in the Field data file.
Returns:
RowCollection of FieldDescriptorRow objects
CMException

createFieldDataFile

public static boolean createFieldDataFile(String pFDSystemAlias)
                                   throws CMException
Creates the Field data file if it doesn't already exist.

CMException

createFieldDataTableSQL

public static String createFieldDataTableSQL()

generateJavaCode

public static StringBuffer generateJavaCode(FieldDescriptorRow fd,
                                            RowClassProperties pProps,
                                            StringBuffer pSB)

getAssociationsForTable

public static RowCollection getAssociationsForTable(Table pTable)
                                             throws CMException
CMException

getDefaultClassForLogicalType

public static Class getDefaultClassForLogicalType(int pFieldDescriptorType)
Gets the Class that is registered as the default class for the specifed type of logical] field descriptor.


getFDModifier

public static IFDModifier getFDModifier()
Gets the modifier that will be used to modify FD's read from RS or DB metadata (may be null)


getFDsFromFile

public static RowCollection getFDsFromFile(String pFDSystemAlias,
                                           Library pLibrary,
                                           int pNumPerPage)
                                    throws CMException
CMException

getFDsFromFile

public static RowCollection getFDsFromFile(Library pLibrary,
                                           int pNumPerPage)
                                    throws CMException
CMException

getFDsFromFile

public static RowCollection getFDsFromFile(Table pTable,
                                           int pNumPerPage)
                                    throws CMException
CMException

getFDsFromFile

public static RowCollection getFDsFromFile(Table pTable,
                                           int pNumPerPage,
                                           List orderByColumns)
                                    throws CMException
CMException

getFieldDataTable

public static Table getFieldDataTable(String pFDSystemAlias)
                               throws DataEngineException
Returns the Field data file Table object.

Returns:
pTable.
DataEngineException

getFieldDataTableName

public static String getFieldDataTableName()
Returns:
Name of field data table.

getFieldDescriptor

public static FieldDescriptorRow getFieldDescriptor(String pFieldName,
                                                    Table pTable)
                                             throws CMException
Returns the FieldDescriptor for the given Field name. If it does not exist, then null is returned. By default, this also checks the Field data file.

Parameters:
pFieldName - Name of the Field to see if a FieldDescriptor exists for that Field.
pTable - Table the FieldDescriptor for the Field will be create for.
Returns:
Return the FieldDescriptor for the given Field name. (Returns null if one does not exist.)
CMException

getFieldDescriptor

public static FieldDescriptorRow getFieldDescriptor(String pFieldName,
                                                    Table pTable,
                                                    boolean pCheckFieldDataFile)
                                             throws CMException
Returns the FieldDescriptor for the given Field name. If it does not exist, then the Field data file is check. If still no FieldDescriptor exist, null is returned.

Parameters:
pFieldName - Name of the Field to see if a FieldDescriptor exists for that Field.
pTable - Table the FieldDescriptor for the Field will be create for.
pCheckFieldDataFile - Flag to indicate whether or not to check the the Field data file for a FieldDescriptor.
Returns:
Return the FieldDescriptor for the given Field name. (Returns null if one does not exist.)
CMException

getFieldDescriptor

public static FieldDescriptorRow getFieldDescriptor(Field pField)
                                             throws CMException
Return an IFieldDescriptor for the given Field, if it doesn't exist then create it from DatabaseMetaData.

Parameters:
pField - Field
Returns:
IFieldDescriptor
CMException

getFieldDescriptors

public static FieldDescriptorCollection getFieldDescriptors(Table pTable)
                                                     throws CMException
Returns a map of FieldDescriptors created for the given Table. By default, the Field data file is also checked for new FieldDescriptors.

Parameters:
pTable - Table the FieldDescriptor for the Field will be create for.
Returns:
Return a FieldDescriptorCollection of all created FieldDescriptors for the given Table.
CMException

getFieldDescriptors

public static FieldDescriptorCollection getFieldDescriptors(Table pTable,
                                                            boolean pCheckFieldDataFile)
                                                     throws CMException
Returns a map of FieldDescriptors created for the given Table. If the specified, the Field data is also checked for new FieldDescriptors.

Parameters:
pTable - Table the FieldDescriptor for the Field will be create for.
pCheckFieldDataFile - Flag to indicate whether or not to check the the Field data file for a FieldDescriptor.
Returns:
Return a Map of all created FieldDescriptors for the given Table.
CMException

isFDFileUsed

public static boolean isFDFileUsed()

registerDefaultFieldClass

public static void registerDefaultFieldClass(int pFieldDescriptorType,
                                             Class pFieldClass)
Registers a Field class as the default Field class for a specific type of logical field descriptor. If a field descriptor is a logical field descriptor, and no field class is specified for that field descriptor, then the fields for that field descriptor will be whatever Field class has been registered for that field descriptor's type.
For performance reasons this method is not synchronized. It should only be invoked during initialization before any Fields are created.

Parameters:
pFieldDescriptorType - The type of field descriptor for which a default Field class is being registered
pFieldClass - The default Field class that is being registered

removeFD

public static void removeFD(FieldDescriptorRow fd)
                     throws CMException
CMException

setFDFileUsed

public static void setFDFileUsed(boolean pFDFileUsed)

setFDModifier

public static void setFDModifier(IFDModifier newFDModifier)
Sets the modifier that will be used to modify FD's read from RS or DB metadata (may be null)