FileDocCategorySizeDatePackage
TableDesc.javaAPI DocGlassfish v2 API6132Fri May 04 22:35:06 BST 2007com.sun.jdo.spi.persistence.support.sqlstore.model

TableDesc

public class TableDesc extends Object
This class is used to represent a database table.

Fields Summary
private KeyDesc
key
primary key for the table
private ArrayList
secondaryTableKeys
array of ReferenceKeyDescs referencing secondary tables
private ReferenceKeyDesc
primaryTableKey
ReferenceKeyDesc referencing the primary table
private org.netbeans.modules.dbschema.TableElement
tableElement
actual TableElement from the dbmodel
private int
consistencyLevel
Consistency level for this table defined in the model
private boolean
isJoinTable
indicates this table is a join table
private String
name
Name of the table
private LocalFieldDesc
versionField
Version field used for version consistency
Constructors Summary
public TableDesc(org.netbeans.modules.dbschema.TableElement tableElement)

        this.tableElement = tableElement;

        name = tableElement.getName().getName();
        consistencyLevel = MappingClassElement.NONE_CONSISTENCY;
    
Methods Summary
voidaddSecondaryTableKey(ReferenceKeyDesc key)
Add a new reference key to the list of secondary table keys.

param
key - ReferenceKeyDesc to be added

        if (secondaryTableKeys == null)
            secondaryTableKeys = new ArrayList();

        secondaryTableKeys.add(key);
    
public KeyDescgetKey()
Return the primary key for the table.

return
the KeyDesc representing the primary key for the table

        return key;
    
public java.lang.StringgetName()
Return the name of the table.

return
the name of the table.

        return name;
    
public ReferenceKeyDescgetPrimaryTableKey()
Return the reference key referencing the primary table.

return
the ReferenceKeyDesc referencing the primary table

        return primaryTableKey;
    
public java.util.ArrayListgetSecondaryTableKeys()
Return all secondary table keys.

return
an ArrayList of ReferenceKeyDescs for secondary tables

        return secondaryTableKeys;
    
public org.netbeans.modules.dbschema.TableElementgetTableElement()
Return the actual dbmodel TableElement for this table.

return
TableElement associated with this table

        return tableElement;
    
public LocalFieldDescgetVersionField()
Returns the field representing the version column for this table. The version column is used for verification with version consistency. Each table can have only one version column.

return
Version field.

        return versionField;
    
public booleanisJoinTable()
Return true if this table is a join table.

        return isJoinTable;
    
public booleanisUpdateLockRequired()
Determins if an update lock is required on this table.

        return consistencyLevel == MappingClassElement.LOCK_WHEN_LOADED_CONSISTENCY;
    
voidsetConsistencyLevel(int value)
Set consistencyLevel to value.

        consistencyLevel = value;
        //TODO :
        //if(isUpdateLockRequired() )
            //Check for DBVendorType.isUpdateLockSupported()
            //Log to trace if !DBVendorType.isUpdateLockSupported()
            //If this table is ever used, user would get an exception

    
voidsetJoinTable(boolean value)
Set isJoinTable to value

        isJoinTable = value;
    
voidsetKey(KeyDesc key)
Set the primary key for the table.

param
key - KeyDesc to be set as the primary key

        this.key = key;
    
voidsetPrimaryTableKey(ReferenceKeyDesc key)
Set the reference key referencing the primary table.

param
key - ReferenceKeyDesc to be added

        this.primaryTableKey = key;
    
voidsetVersionField(LocalFieldDesc field)

        versionField = field;