FileDocCategorySizeDatePackage
TableDefinition.javaAPI DocGlassfish v2 API31810Tue May 22 16:54:54 BST 2007oracle.toplink.essentials.tools.schemaframework

TableDefinition

public class TableDefinition extends DatabaseObjectDefinition

Purpose: Allow a generic way of creating tables on the different platforms.

Fields Summary
protected Vector
fields
protected HashMap
foreignKeyMap
protected Vector
uniqueKeys
protected String
creationPrefix
protected String
creationSuffix
private boolean
createSQLFiles
Constructors Summary
public TableDefinition()

        this.fields = new Vector();
        this.foreignKeyMap = new HashMap<String, ForeignKeyConstraint>();
        this.uniqueKeys = new Vector();
        this.creationPrefix = "CREATE TABLE ";
        this.creationSuffix = "";
    
Methods Summary
public voidaddField(java.lang.String fieldName, java.lang.Class type)
PUBLIC: Add the field to the table, default sizes are used.

param
type is the Java class type coresponding to the database type.

        this.addField(new FieldDefinition(fieldName, type));
    
public voidaddField(java.lang.String fieldName, java.lang.Class type, int fieldSize)
PUBLIC: Add the field to the table.

param
type is the Java class type coresponding to the database type.

        this.addField(new FieldDefinition(fieldName, type, fieldSize));
    
public voidaddField(java.lang.String fieldName, java.lang.Class type, int fieldSize, int fieldSubSize)
PUBLIC: Add the field to the table.

param
type is the Java class type coresponding to the database type.

        this.addField(new FieldDefinition(fieldName, type, fieldSize, fieldSubSize));
    
public voidaddField(java.lang.String fieldName, java.lang.String typeName)
PUBLIC: Add the field to the type to a nested type.

param
typeName is the name of the nested type.

        this.addField(new FieldDefinition(fieldName, typeName));
    
public voidaddField(oracle.toplink.essentials.tools.schemaframework.FieldDefinition field)
PUBLIC: Add the field to the table.

        this.getFields().addElement(field);
    
public voidaddForeignKeyConstraint(oracle.toplink.essentials.tools.schemaframework.ForeignKeyConstraint foreignKey)
PUBLIC: Add a foreign key constraint to the table. If there is a same name foreign key constraint already, nothing will happen.

        if (!foreignKeyMap.containsKey(foreignKey.getName())) {
            foreignKeyMap.put(foreignKey.getName(), foreignKey);
        }
    
public voidaddForeignKeyConstraint(java.lang.String name, java.lang.String sourceField, java.lang.String targetField, java.lang.String targetTable)
PUBLIC: Add a foreign key constraint to the table. If there is a same name foreign key constraint already, nothing will happen.

        ForeignKeyConstraint foreignKey = new ForeignKeyConstraint(name, sourceField, targetField, targetTable);
        addForeignKeyConstraint(foreignKey);
    
public voidaddIdentityField(java.lang.String fieldName, java.lang.Class type)
PUBLIC: Add the field to the table, default sizes are used. Identity fields are used on Sybase for native sequencing, The field must be of numberish type and cannot have a subsize.

param
type is the Java class type coresponding to the database type.

        FieldDefinition fieldDef = new FieldDefinition(fieldName, type);
        fieldDef.setIsIdentity(true);
        fieldDef.setIsPrimaryKey(true);
        addField(fieldDef);
    
public voidaddIdentityField(java.lang.String fieldName, java.lang.Class type, int fieldSize)
PUBLIC: Add the field to the table, default sizes are used. Identity fields are used on Sybase for native sequencing, The field must be of numberish type and cannot have a subsize.

param
type is the Java class type coresponding to the database type.

        FieldDefinition fieldDef = new FieldDefinition(fieldName, type, fieldSize);
        fieldDef.setIsIdentity(true);
        fieldDef.setIsPrimaryKey(true);
        addField(fieldDef);
    
public voidaddPrimaryKeyField(java.lang.String fieldName, java.lang.Class type)
PUBLIC: Add the field to the table, default sizes are used. This field is set as part of the primary key.

param
type is the Java class type coresponding to the database type.

        FieldDefinition fieldDef = new FieldDefinition(fieldName, type);
        fieldDef.setIsPrimaryKey(true);
        addField(fieldDef);
    
public voidaddPrimaryKeyField(java.lang.String fieldName, java.lang.Class type, int fieldSize)
PUBLIC: Add the field to the table, default sizes are used. This field is set as part of the primary key.

param
type is the Java class type coresponding to the database type.

        FieldDefinition fieldDef = new FieldDefinition(fieldName, type, fieldSize);
        fieldDef.setIsPrimaryKey(true);
        addField(fieldDef);
    
public voidaddUniqueKeyConstraint(oracle.toplink.essentials.tools.schemaframework.UniqueKeyConstraint uniqueKey)
PUBLIC: Add a unique key constraint to the table.

        getUniqueKeys().addElement(uniqueKey);
    
public voidaddUniqueKeyConstraint(java.lang.String name, java.lang.String sourceField)
PUBLIC: Add a unique key constraint to the table.

        UniqueKeyConstraint uniqueKey = new UniqueKeyConstraint(name, sourceField);
        addUniqueKeyConstraint(uniqueKey);
    
public voidaddUniqueKeyConstraint(java.lang.String name, java.lang.String[] sourceFields)
PUBLIC: Add a unique key constraint to the table.

        UniqueKeyConstraint uniqueKey = new UniqueKeyConstraint(name, sourceFields);
        addUniqueKeyConstraint(uniqueKey);
    
public java.io.WriterbuildConstraintCreationWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, oracle.toplink.essentials.tools.schemaframework.ForeignKeyConstraint foreignKey, java.io.Writer writer)
INTERNAL: Return the alter table statement to add the constraints. This is done seperatly from the create because of dependecies.

        try {
            writer.write("ALTER TABLE " + getFullName());
            writer.write(" ADD CONSTRAINT ");
            if (!session.getPlatform().shouldPrintConstraintNameAfter()) {
                writer.write(foreignKey.getName() + " ");
            }
            foreignKey.appendDBString(writer, session);
            if (session.getPlatform().shouldPrintConstraintNameAfter()) {
                writer.write(" CONSTRAINT " + foreignKey.getName());
            }
        } catch (IOException ioException) {
            throw ValidationException.fileError(ioException);
        }
        return writer;
    
public java.io.WriterbuildConstraintDeletionWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, oracle.toplink.essentials.tools.schemaframework.ForeignKeyConstraint foreignKey, java.io.Writer writer)
INTERNAL: Return the alter table statement to drop the constraints. This is done seperatly to allow constraints to be dropped before the tables.

        try {
            writer.write("ALTER TABLE " + getFullName());
            writer.write(session.getPlatform().getConstraintDeletionString() + foreignKey.getName());
        } catch (IOException ioException) {
            throw ValidationException.fileError(ioException);
        }
        return writer;
    
public java.io.WriterbuildCreationWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer writer)
INTERNAL: Return the create table statement.

        try {
            writer.write(getCreationPrefix() + getFullName() + " (");
            for (Enumeration fieldsEnum = getFields().elements(); fieldsEnum.hasMoreElements();) {
                FieldDefinition field = (FieldDefinition)fieldsEnum.nextElement();
                field.appendDBString(writer, session, this);
                if (fieldsEnum.hasMoreElements()) {
                    writer.write(", ");
                }
            }
            Vector keyFields = getPrimaryKeyFieldNames();
            if ((!keyFields.isEmpty()) && session.getPlatform().supportsPrimaryKeyConstraint()) {
                writer.write(", ");
                if (session.getPlatform().requiresNamedPrimaryKeyConstraints()) {
                    writer.write("CONSTRAINT " + getFullName() + "_PK ");
                }
                writer.write("PRIMARY KEY (");
                for (Enumeration keyEnum = keyFields.elements(); keyEnum.hasMoreElements();) {
                    writer.write((String)keyEnum.nextElement());
                    if (keyEnum.hasMoreElements()) {
                        writer.write(", ");
                    }
                }
                writer.write(")");
            }
            writer.write(")");
            if(getCreationSuffix().length() > 0) {
                writer.write(getCreationSuffix());
            }
        } catch (IOException ioException) {
            throw ValidationException.fileError(ioException);
        }
        return writer;
    
public java.io.WriterbuildDeletionWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer writer)
INTERNAL: Return the drop table statement.

        try {
            writer.write("DROP TABLE " + getFullName());
        } catch (IOException ioException) {
            throw ValidationException.fileError(ioException);
        }
        return writer;
    
protected voidbuildFieldTypes(oracle.toplink.essentials.internal.sessions.AbstractSession session)
INTERNAL: Build the foriegn key constraints.

        
        FieldDefinition field = null;
        
        // The ForeignKeyConstraint object is the newer way of doing things.
        // We support FieldDefinition.getForeignKeyFieldName() due to backwards compatibility
        // by converting it. To allow mixing both ways, we just add converted one to foreignKeys list.
        
        for (Enumeration enumtr = getFields().elements(); enumtr.hasMoreElements();) {
            field = (FieldDefinition)enumtr.nextElement();
            if (field.getForeignKeyFieldName() != null) {
                addForeignKeyConstraint(buildForeignKeyConstraint(field, session.getPlatform()));
            }
        }

    
protected oracle.toplink.essentials.tools.schemaframework.ForeignKeyConstraintbuildForeignKeyConstraint(oracle.toplink.essentials.tools.schemaframework.FieldDefinition field, oracle.toplink.essentials.internal.databaseaccess.DatabasePlatform platform)
Build a foriegn key constraint using FieldDefinition.getForeignKeyFieldName().

        Vector sourceFields = new Vector();
        Vector targetFields = new Vector();
        ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
        DatabaseField tempTargetField = new DatabaseField(field.getForeignKeyFieldName());
        DatabaseField tempSourceField = new DatabaseField(field.getName());

        sourceFields.addElement(tempSourceField.getName());
        targetFields.addElement(tempTargetField.getName());

        fkConstraint.setSourceFields(sourceFields);
        fkConstraint.setTargetFields(targetFields);
        fkConstraint.setTargetTable(tempTargetField.getTable().getQualifiedName());
        String tempName = buildForeignKeyConstraintName(this.getName(), tempSourceField.getName(), platform.getMaxForeignKeyNameSize());

        fkConstraint.setName(tempName);
        return fkConstraint;
    
protected oracle.toplink.essentials.tools.schemaframework.ForeignKeyConstraintbuildForeignKeyConstraint(java.util.Vector fkFieldNames, java.util.Vector pkFieldNames, oracle.toplink.essentials.tools.schemaframework.TableDefinition targetTable, oracle.toplink.essentials.internal.databaseaccess.DatabasePlatform platform)
Build a foriegn key constraint.

        assert fkFieldNames.size() > 0 && fkFieldNames.size() == pkFieldNames.size();
        
        ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint();
        for(int i=0; i<fkFieldNames.size(); i++) {
            fkConstraint.getSourceFields().add((String)fkFieldNames.get(i));
            fkConstraint.getTargetFields().add((String)pkFieldNames.get(i));
        }

        fkConstraint.setTargetTable(targetTable.getFullName());
        String fkFieldName = (String)fkFieldNames.get(0);
        String name = buildForeignKeyConstraintName(this.getName(), fkFieldName, platform.getMaxForeignKeyNameSize());

        fkConstraint.setName(name);
        return fkConstraint;
    
protected java.lang.StringbuildForeignKeyConstraintName(java.lang.String tableName, java.lang.String fieldName, int maximumNameLength)
Return foreign key constraint name built from the table and field name with the specified maximum length. To make the name short enough we 1. Drop the "FK_" prefix. 2. Drop the underscore characters if any. 3. Drop the vowels from the table and field name. 4. Truncate the table name to zero length if necessary.

        String foreignKeyName = "FK_" + tableName + "_" + fieldName;
        if (foreignKeyName.length() > maximumNameLength) {
            // First Remove the "FK_" prefix.
            foreignKeyName = tableName + "_" + fieldName;
            if (foreignKeyName.length() > maximumNameLength) {
                // Still too long: remove the underscore characters
                foreignKeyName = Helper.removeAllButAlphaNumericToFit(tableName + fieldName, maximumNameLength);
                if (foreignKeyName.length() > maximumNameLength) {
                    // Still too long: remove vowels from the table name and field name.
                    String onlyAlphaNumericTableName = Helper.removeAllButAlphaNumericToFit(tableName, 0);
                    String onlyAlphaNumericFieldName = Helper.removeAllButAlphaNumericToFit(fieldName, 0);
                    foreignKeyName = Helper.shortenStringsByRemovingVowelsToFit(onlyAlphaNumericTableName, onlyAlphaNumericFieldName, maximumNameLength);
                    if (foreignKeyName.length() > maximumNameLength) {
                        // Still too long: remove vowels from the table name and field name and truncate the table name.
                        String shortenedFieldName = Helper.removeVowels(onlyAlphaNumericFieldName);
                        String shortenedTableName = Helper.removeVowels(onlyAlphaNumericTableName);
                        foreignKeyName = Helper.truncate(shortenedTableName, maximumNameLength - shortenedFieldName.length()) + shortenedFieldName;
                    }
                }
            }
        }
        return foreignKeyName;
    
public java.io.WriterbuildUniqueConstraintCreationWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, oracle.toplink.essentials.tools.schemaframework.UniqueKeyConstraint uniqueKey, java.io.Writer writer)
INTERNAL: Return the alter table statement to add the constraints. This is done seperatly from the create because of dependecies.

        try {
            writer.write("ALTER TABLE " + getFullName());
            writer.write(" ADD CONSTRAINT ");
            if (!session.getPlatform().shouldPrintConstraintNameAfter()) {
                writer.write(uniqueKey.getName() + " ");
            }
            uniqueKey.appendDBString(writer, session);
            if (session.getPlatform().shouldPrintConstraintNameAfter()) {
                writer.write(" CONSTRAINT " + uniqueKey.getName());
            }
        } catch (IOException ioException) {
            throw ValidationException.fileError(ioException);
        }
        return writer;
    
public java.io.WriterbuildUniqueConstraintDeletionWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, oracle.toplink.essentials.tools.schemaframework.UniqueKeyConstraint uniqueKey, java.io.Writer writer)
INTERNAL: Return the alter table statement to drop the constraints. This is done seperatly to allow constraints to be dropped before the tables.

        try {
            writer.write("ALTER TABLE " + getFullName());
            writer.write(session.getPlatform().getConstraintDeletionString() + uniqueKey.getName());
        } catch (IOException ioException) {
            throw ValidationException.fileError(ioException);
        }
        return writer;
    
protected oracle.toplink.essentials.tools.schemaframework.UniqueKeyConstraintbuildUniqueKeyConstraint(java.lang.String[] fieldNames, int serialNumber, oracle.toplink.essentials.internal.databaseaccess.DatabasePlatform platform)

        assert fieldNames.length > 0;
        
        UniqueKeyConstraint unqConstraint = new UniqueKeyConstraint();
        for(String fieldName : fieldNames) {
            unqConstraint.addSourceField(fieldName);
        }
        String name = buildUniqueKeyConstraintName(this.getName(), serialNumber, platform.getMaxUniqueKeyNameSize());
        unqConstraint.setName(name);
        return unqConstraint;
    
protected java.lang.StringbuildUniqueKeyConstraintName(java.lang.String tableName, int serialNumber, int maximumNameLength)
Return unique key constraint name built from the table name and sequence number with the specified maximum length. To make the name short enough we 1. Drop the "UNQ_" prefix. 2. Drop the underscore characters if any. 3. Drop the vowels from the table name. 4. Truncate the table name to zero length if necessary.

        String uniqueKeyName = "UNQ_" + tableName + "_" + serialNumber;
        if (uniqueKeyName.length() > maximumNameLength) {
            // First Remove the "UNQ_" prefix.
            uniqueKeyName = tableName + serialNumber;
            if (uniqueKeyName.length() > maximumNameLength) {
                // Still too long: remove the underscore characters
                uniqueKeyName = Helper.removeAllButAlphaNumericToFit(tableName + serialNumber, maximumNameLength);
                if (uniqueKeyName.length() > maximumNameLength) {
                    // Still too long: remove vowels from the table name
                    String onlyAlphaNumericTableName = Helper.removeAllButAlphaNumericToFit(tableName, 0);
                    String serialName = String.valueOf(serialNumber);
                    uniqueKeyName = Helper.shortenStringsByRemovingVowelsToFit(onlyAlphaNumericTableName, serialName, maximumNameLength);
                    if (uniqueKeyName.length() > maximumNameLength) {
                        // Still too long: remove vowels from the table name and truncate the table name.
                        String shortenedTableName = Helper.removeVowels(onlyAlphaNumericTableName);
                        uniqueKeyName = Helper.truncate(shortenedTableName, maximumNameLength - serialName.length()) + serialName;
                    }
                }
            }
        }
        return uniqueKeyName;
    
public java.lang.Objectclone()
PUBLIC: Performs a deep copy of this table definition.

        TableDefinition clone = (TableDefinition)super.clone();
        if (fields != null) {
            clone.setFields(new Vector(fields.size()));
            for (Enumeration enumtr = getFields().elements(); enumtr.hasMoreElements();) {
                FieldDefinition fieldDef = (FieldDefinition)enumtr.nextElement();
                clone.addField((FieldDefinition)fieldDef.clone());
            }
        }
        if (foreignKeyMap != null) {
            clone.setForeignKeyMap((HashMap) foreignKeyMap.clone());
        }
        if (uniqueKeys != null) {
            clone.setUniqueKeys((Vector)uniqueKeys.clone());
        }        
        return clone;
    
public voidcreateConstraints(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer schemaWriter)
INTERNAL: Execute the SQL alter table constraint creation string.

       
        createUniqueConstraints(session, schemaWriter);
        createForeignConstraints(session, schemaWriter);
    
public voidcreateConstraintsOnDatabase(oracle.toplink.essentials.internal.sessions.AbstractSession session)
INTERNAL: Execute the SQL alter table constraint creation string.

        createUniqueConstraintsOnDatabase(session);       
        createForeignConstraintsOnDatabase(session);
    
voidcreateForeignConstraints(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer schemaWriter)

        if (schemaWriter == null) {
            createForeignConstraintsOnDatabase(session);
            return;
        }
        
        for (ForeignKeyConstraint foreignKey : getForeignKeyMap().values()) {
            buildConstraintCreationWriter(session, foreignKey, schemaWriter).toString();
            try {
                if (createSQLFiles) {
                    schemaWriter.write(session.getPlatform().getStoredProcedureTerminationToken());
                }
                schemaWriter.write("\n");
            } catch (IOException exception) {
                throw ValidationException.fileError(exception);
            }
        }
    
voidcreateForeignConstraintsOnDatabase(oracle.toplink.essentials.internal.sessions.AbstractSession session)

        
        if ((!session.getPlatform().supportsForeignKeyConstraints()) || getForeignKeyMap().isEmpty()) {
            return;
        }

        for (ForeignKeyConstraint foreignKey : getForeignKeyMap().values()) {
            session.executeNonSelectingCall(new SQLCall(buildConstraintCreationWriter(session, foreignKey, new StringWriter()).toString()));
        }
    
voidcreateUniqueConstraints(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer schemaWriter)

        if (schemaWriter == null) {
            createUniqueConstraintsOnDatabase(session);
            return;
        }
        
        for (Enumeration uniqueKeysEnum = getUniqueKeys().elements();
                 uniqueKeysEnum.hasMoreElements();) {              
            UniqueKeyConstraint uniqueKey = (UniqueKeyConstraint)uniqueKeysEnum.nextElement();
            buildUniqueConstraintCreationWriter(session, uniqueKey, schemaWriter).toString();
            try {
                if (createSQLFiles) {
                    schemaWriter.write(session.getPlatform().getStoredProcedureTerminationToken());
                }
                schemaWriter.write("\n");
            } catch (IOException exception) {
                throw ValidationException.fileError(exception);
            }
        }            
    
voidcreateUniqueConstraintsOnDatabase(oracle.toplink.essentials.internal.sessions.AbstractSession session)

       
        if ((!session.getPlatform().supportsUniqueKeyConstraints()) || getUniqueKeys().isEmpty()) {
            return;
        }

        for (Enumeration uniqueKeysEnum = getUniqueKeys().elements();
                 uniqueKeysEnum.hasMoreElements();) {            
            UniqueKeyConstraint uniqueKey = (UniqueKeyConstraint)uniqueKeysEnum.nextElement();
            session.executeNonSelectingCall(new oracle.toplink.essentials.queryframework.SQLCall(buildUniqueConstraintCreationWriter(session, uniqueKey, new StringWriter()).toString()));
        } 
    
public java.lang.StringdeletionStringFor(oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor accessor)
INTERNAL: Return the delete SQL string.

        return "DROP TABLE " + this.getName();
    
public voiddropConstraints(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer schemaWriter)
INTERNAL: Execute the SQL alter table constraint creation string.

        if (schemaWriter == null) {
            this.dropConstraintsOnDatabase(session);
        } else {
            for (ForeignKeyConstraint foreignKey : getForeignKeyMap().values()) {
                buildConstraintDeletionWriter(session, foreignKey, schemaWriter).toString();
                try {
                    if (createSQLFiles) {
                        schemaWriter.write(session.getPlatform().getStoredProcedureTerminationToken());
                    }
                    schemaWriter.write("\n");
                } catch (IOException exception) {
                    throw ValidationException.fileError(exception);
                }
            }
                     
            for (Enumeration uniqueKeysEnum = getUniqueKeys().elements();
                     uniqueKeysEnum.hasMoreElements();) {        
                UniqueKeyConstraint uniqueKey = (UniqueKeyConstraint)uniqueKeysEnum.nextElement();
                buildUniqueConstraintDeletionWriter(session, uniqueKey, schemaWriter).toString();
                try {
                    if (createSQLFiles) {                    
                        schemaWriter.write(session.getPlatform().getStoredProcedureTerminationToken());
                    }
                    schemaWriter.write("\n");
                } catch (IOException exception) {
                    throw ValidationException.fileError(exception);
                }
            }
        }
    
public voiddropConstraintsOnDatabase(oracle.toplink.essentials.internal.sessions.AbstractSession session)
INTERNAL: Execute the SQL alter table constraint creation string. Exceptions are caught and masked so that all the foreign keys are dropped (even if they don't exist).

        dropForeignConstraintsOnDatabase(session);
        dropUniqueConstraintsOnDatabase(session);        
    
private voiddropForeignConstraintsOnDatabase(oracle.toplink.essentials.internal.sessions.AbstractSession session)

        
        if ((!session.getPlatform().supportsForeignKeyConstraints()) || getForeignKeyMap().isEmpty()) {
            return;
        } 

        for (ForeignKeyConstraint foreignKey : getForeignKeyMap().values()) {
            try {
                session.executeNonSelectingCall(new SQLCall(buildConstraintDeletionWriter(session, foreignKey, new StringWriter()).toString()));
            } catch (DatabaseException ex) {/* ignore */
            }
        }
    
private voiddropUniqueConstraintsOnDatabase(oracle.toplink.essentials.internal.sessions.AbstractSession session)

        
        if ((!session.getPlatform().supportsUniqueKeyConstraints()) || getUniqueKeys().isEmpty()) {
            return;
        }
        
        for (Enumeration uniqueKeysEnum = getUniqueKeys().elements();
                 uniqueKeysEnum.hasMoreElements();) {
            UniqueKeyConstraint uniqueKey = (UniqueKeyConstraint)uniqueKeysEnum.nextElement();
            try {
                session.executeNonSelectingCall(new oracle.toplink.essentials.queryframework.SQLCall(buildUniqueConstraintDeletionWriter(session, uniqueKey, new StringWriter()).toString()));
            } catch (DatabaseException ex) {/* ignore */
            }
        }        
    
public java.lang.StringgetCreationPrefix()
INTERNAL: Return the beginning of the sql create statement - the part before the name. Unless temp table is created should be "CREATE TABLE "

        return creationPrefix;    
    
public java.lang.StringgetCreationSuffix()
INTERNAL: Return the end of the sql create statement - the part after the field list. Unless temp table is created should be empty.

        return creationSuffix;
    
public java.util.VectorgetFields()
PUBLIC:

        return fields;
    
java.util.HashMapgetForeignKeyMap()
INTERNAL:

        return foreignKeyMap;
    
public java.util.VectorgetForeignKeys()
PUBLIC: Returns the ForeignKeyConstraint list.

        return new Vector<ForeignKeyConstraint>(foreignKeyMap.values());
    
public java.util.VectorgetPrimaryKeyFieldNames()
PUBLIC:

        Vector keyNames = new Vector();

        for (Enumeration fieldEnum = getFields().elements(); fieldEnum.hasMoreElements();) {
            FieldDefinition field = (FieldDefinition)fieldEnum.nextElement();
            if (field.isPrimaryKey()) {
                keyNames.addElement(field.getName());
            }
        }
        return keyNames;
    
public java.util.VectorgetUniqueKeys()
PUBLIC:

        return uniqueKeys;
    
public voidsetCreateSQLFiles(boolean genFlag)
PUBLIC:

        this.createSQLFiles = genFlag;
    
public voidsetCreationPrefix(java.lang.String creationPrefix)
INTERNAL: Set the beginning of the sql create statement - the part before the name. Use to create temp. table.

        this.creationPrefix = creationPrefix;
    
public voidsetCreationSuffix(java.lang.String creationSuffix)
INTERNAL: Set the end of the sql create statement - the part after the field list. Use to create temp table.

        this.creationSuffix = creationSuffix;
    
public voidsetFields(java.util.Vector fields)
PUBLIC:

        this.fields = fields;
    
voidsetForeignKeyMap(java.util.HashMap foreignKeyMap)
INTERNAL:

        this.foreignKeyMap = foreignKeyMap;
    
public voidsetForeignKeys(java.util.Vector foreignKeys)
PUBLIC: Set the ForeignKeyConstraint list. If the list contains the same name foreign key constraints, only the first one of that name will be added.

        foreignKeyMap.clear();
        if (foreignKeys != null) {
            for(ForeignKeyConstraint foreignKey : foreignKeys) {
                foreignKeyMap.put(foreignKey .getName(), foreignKey);
            }
        }
    
public voidsetUniqueKeys(java.util.Vector uniqueKeys)
PUBLIC:

        this.uniqueKeys = uniqueKeys;