com.ibm.dse.tools.workbench.base
Class EntitiesTable

java.lang.Object
  |
  +--com.ibm.dse.tools.workbench.base.AbstractTable
        |
        +--com.ibm.dse.tools.workbench.base.VersionableTable
              |
              +--com.ibm.dse.tools.workbench.base.EntitiesTable

public class EntitiesTable
extends VersionableTable

This class represents a table of entities


Field Summary
static int ACTIVE
          The identifier for the ACTIVE column
static int ALLOW_TAG
          The identifier for the ALLOW_TAG column
static int BASE_GROUP
          The identifier for the BASE_GROUP column
static int CK_ACTIVE
          The identifiers for the check constraint CK_ACTIVE
static int CK_ALLOW_TAG
          The identifiers for the check constraint CK_ALLOW_TAG
static int CK_COMPOSITE
          The identifiers for the check constraint CK_COMPOSITE
static int CK_EXTERNALIZE
          The identifiers for the check constraint CK_EXTERNALIZE
static int CK_INSTANTIABLE
          The identifiers for the check constraint CK_INSTANTIABLE
static int CK_PREDEFINED
          The identifiers for the check constraint CK_PREDEFINED
static int CK_RELEASED
          The identifiers for the check constraint CK_RELEASED
static int CK_ROOT
          The identifiers for the check constraint CK_ROOT
static int CK_SELF_DEFINED
          The identifiers for the check constraint CK_SELF_DEFINED
static int CK_VERSIONED
          The identifiers for the check constraint CK_VERSIONED
static int CLASS
          The identifier for the CLASS column
static int CODE
          The identifier for the CODE column
static int COMPOSITE
          The identifier for the COMPOSITE column
static int DESCRIPTION
          The identifier for the DESCRIPTION column
static int EXTERNALIZE
          The identifier for the EXTERNALIZE column
static int ICON
          The identifier for the ICON column
static int INSTANTIABLE
          The identifier for the INSTANTIABLE column
static int NAME
          The identifier for the NAME column
static int OWNER
          The identifier for the OWNER column
static int PREDEFINED
          The identifier for the PREDEFINED column
static int REL_ASSIGNED_GROUPS
          The identifiers for the relationship GRPENTEF
static int REL_COMPONENT_ENTITIES
          The identifiers for the relationship ENTENTCF
static int REL_OWNED_ATTRIBUTES
          The identifiers for the relationship ATTENTPF
static int REL_OWNER_ENTITIES
          The identifiers for the relationship ENTENTPF
static int REL_REFERRER_ATTRIBUTES
          The identifiers for the relationship ATTENTRF
static int REL_REFERRER_INSTANCES
          The identifiers for the relationship INSENTFK
static int REL_SUB_ENTITIES
          The identifiers for the relationship ENTENTFK
static int RELEASED
          The identifier for the RELEASED column
static int ROOT
          The identifier for the ROOT column
static int SELF_DEFINED
          The identifier for the SELF_DEFINED column
static int SUPER_ENTITY
          The identifier for the SUPER_ENTITY column
static int TAG
          The identifier for the TAG column
static int TIMESTAMP
          The identifier for the TIMESTAMP column
static int VERSION
          The identifier for the VERSION column
static int VERSIONED
          The identifier for the VERSIONED column
 
Fields inherited from class com.ibm.dse.tools.workbench.base.AbstractTable
alias, checks, columnLengths, columns, DATA_DELIMITER, DATA_SEPARATOR, deletedRows, ESCAPE_SEQUENCE, fks, indexes, insertedRows, modifiedRows, name, pk, relations, repository, required, rows, triggers
 
Constructor Summary
EntitiesTable(Repository rpstry)
          This constructor creates a EntitiesTable object in a repository
 
Method Summary
protected  void alterAllRelatedRows(TableRow origRow, TableRow finalRow)
          Replaces all the related rows referring to origRow to be pointing to finalRow
 void copyParentGroupsTree(TableRow tableRow, Repository destinationRep, boolean exactGroup)
          Copies all the parent groups hierarchy of an entity to a repository
 TableRow createOpenEdition(TableRow row)
          Creates an open edition of an entity row.
 void createRelations()
          This method creates the relationships for a table
 int getActiveColumn()
          Returns the Active column identifier
 TableRow[] getAttributesList(TableRow entity)
          Returns the attributes owned by an entity
 int getCodeColumn()
          Returns the Code column identifier
 TableRow getContainerGroup(TableRow versionableRow)
          This method returns the group containing the versionableRow passed as parameter
 TableRow[] getInheritedComposition(TableRow entity)
          Returns the list of composition rules of an entity including the inherited composition rules
 TableRow[] getMandatoryAttributesList(TableRow entity)
          Returns the mandatory attributes owned by an entity
 int getNameColumn()
          Returns the Name column identifier
 int getOwnerColumn()
          Returns the Owner column identifier
 int getReleasedColumn()
          Returns the Released column identifier
 TableRow[] getSubEntitiesTree(TableRow entity)
          Returns all the entities that extend from an entity including it
 TableRow[] getSuperEntitiesTree(TableRow entity)
          Returns all the hierarchy of entities from which an entity extends, including it
 int getTimeStampColumn()
          Returns the TimeStamp column identifier
 int getVersionColumn()
          Returns the Version column identifier
 int getVersionedColumn()
          Returns the Versioned column identifier
 boolean hasInheritedComposition(TableRow entity)
          Indicates if an entity has own or inherited composition
 boolean hasSelfGeneratedPk()
          This method indicates if the field in the primary key must be generated automatically
 void importToWorkspace(Workspace ws, TableRow row)
          Copies a group row from a repository to a workspace.
 TableRow[] rowsToBeRemoved(TableRow[] rows)
          Returns the rows that a remove process performed on a set of rows will remove.
protected  void rowsToBeRemoved(TableRow row, java.util.Hashtable rowList)
          Adds to a Hashtable the related rows that a remove process performed on a row will remove.
 void setContainerGroup(TableRow versionableRow, java.lang.String grpCode)
          This method sets the Container group of an entity row
 java.lang.String[] validate(TableRow row)
          This method checks the correctness of an entity row based on application rules
 TableRow version(TableRow versionableRow, java.lang.String newVersion, Repository repository)
          Versions an entity row, copying it to a repository
 
Methods inherited from class com.ibm.dse.tools.workbench.base.VersionableTable
alterFkFields, alterRelatedRows, copyOwner, copyParentGroupsTree, getContainerGroup, getContainerGroup, getDistinctNames, getVersions, getWorkspaceContainerGroup, isAValidVersionNumber, isVersioned, setContainerGroup, updateOpenEditionFields, updateVersionFields
 
Methods inherited from class com.ibm.dse.tools.workbench.base.AbstractTable
add, areTriggersActive, cleanRollbackData, count, createTableRow, createTableRow, exportToFile, flush, getAlias, getChecks, getChecks, getColumnLengths, getColumns, getColumnsString, getColumnsString, getConnection, getCreateChecksStrings, getCreateFksStrings, getCreateIndexesStrings, getCreatePkString, getCreateTableString, getDefaultVersion, getFks, getIndexes, getName, getPk, getPkValue, getRelated, getRelations, getRepository, getTimestamp, getUniqueValue, importFromString, isInPk, isRequired, postDelete, postInsert, postUpdate, preDelete, preInsert, preUpdate, registerDeletedRow, registerInsertedRow, registerModifiedRow, removeFromList, restoreRows, retrieveAll, retrieveByPk, retrieveDistinct, setAlias, setRepository, setTriggersState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CODE

public static final int CODE
The identifier for the CODE column

NAME

public static final int NAME
The identifier for the NAME column

VERSION

public static final int VERSION
The identifier for the VERSION column

BASE_GROUP

public static final int BASE_GROUP
The identifier for the BASE_GROUP column

COMPOSITE

public static final int COMPOSITE
The identifier for the COMPOSITE column

PREDEFINED

public static final int PREDEFINED
The identifier for the PREDEFINED column

CLASS

public static final int CLASS
The identifier for the CLASS column

TAG

public static final int TAG
The identifier for the TAG column

DESCRIPTION

public static final int DESCRIPTION
The identifier for the DESCRIPTION column

ROOT

public static final int ROOT
The identifier for the ROOT column

INSTANTIABLE

public static final int INSTANTIABLE
The identifier for the INSTANTIABLE column

ALLOW_TAG

public static final int ALLOW_TAG
The identifier for the ALLOW_TAG column

SUPER_ENTITY

public static final int SUPER_ENTITY
The identifier for the SUPER_ENTITY column

ICON

public static final int ICON
The identifier for the ICON column

OWNER

public static final int OWNER
The identifier for the OWNER column

RELEASED

public static final int RELEASED
The identifier for the RELEASED column

VERSIONED

public static final int VERSIONED
The identifier for the VERSIONED column

TIMESTAMP

public static final int TIMESTAMP
The identifier for the TIMESTAMP column

ACTIVE

public static final int ACTIVE
The identifier for the ACTIVE column

EXTERNALIZE

public static final int EXTERNALIZE
The identifier for the EXTERNALIZE column

SELF_DEFINED

public static final int SELF_DEFINED
The identifier for the SELF_DEFINED column

REL_OWNED_ATTRIBUTES

public static final int REL_OWNED_ATTRIBUTES
The identifiers for the relationship ATTENTPF

REL_REFERRER_ATTRIBUTES

public static final int REL_REFERRER_ATTRIBUTES
The identifiers for the relationship ATTENTRF

REL_COMPONENT_ENTITIES

public static final int REL_COMPONENT_ENTITIES
The identifiers for the relationship ENTENTCF

REL_OWNER_ENTITIES

public static final int REL_OWNER_ENTITIES
The identifiers for the relationship ENTENTPF

REL_REFERRER_INSTANCES

public static final int REL_REFERRER_INSTANCES
The identifiers for the relationship INSENTFK

REL_SUB_ENTITIES

public static final int REL_SUB_ENTITIES
The identifiers for the relationship ENTENTFK

REL_ASSIGNED_GROUPS

public static final int REL_ASSIGNED_GROUPS
The identifiers for the relationship GRPENTEF

CK_COMPOSITE

public static final int CK_COMPOSITE
The identifiers for the check constraint CK_COMPOSITE

CK_PREDEFINED

public static final int CK_PREDEFINED
The identifiers for the check constraint CK_PREDEFINED

CK_ROOT

public static final int CK_ROOT
The identifiers for the check constraint CK_ROOT

CK_RELEASED

public static final int CK_RELEASED
The identifiers for the check constraint CK_RELEASED

CK_VERSIONED

public static final int CK_VERSIONED
The identifiers for the check constraint CK_VERSIONED

CK_ACTIVE

public static final int CK_ACTIVE
The identifiers for the check constraint CK_ACTIVE

CK_INSTANTIABLE

public static final int CK_INSTANTIABLE
The identifiers for the check constraint CK_INSTANTIABLE

CK_ALLOW_TAG

public static final int CK_ALLOW_TAG
The identifiers for the check constraint CK_ALLOW_TAG

CK_EXTERNALIZE

public static final int CK_EXTERNALIZE
The identifiers for the check constraint CK_EXTERNALIZE

CK_SELF_DEFINED

public static final int CK_SELF_DEFINED
The identifiers for the check constraint CK_SELF_DEFINED
Constructor Detail

EntitiesTable

public EntitiesTable(Repository rpstry)
This constructor creates a EntitiesTable object in a repository
Parameters:
rpstry - com.ibm.dse.tools.workbench.base.Repository The repository in which create the table
Method Detail

alterAllRelatedRows

protected void alterAllRelatedRows(TableRow origRow,
                                   TableRow finalRow)
                            throws WorkbenchException
Replaces all the related rows referring to origRow to be pointing to finalRow
Parameters:
origRow - com.ibm.dse.tools.workbench.base.TableRow
finalRow - com.ibm.dse.tools.workbench.base.TableRow
Throws:
WorkbenchException -  

copyParentGroupsTree

public void copyParentGroupsTree(TableRow tableRow,
                                 Repository destinationRep,
                                 boolean exactGroup)
                          throws WorkbenchException
Copies all the parent groups hierarchy of an entity to a repository
Overrides:
copyParentGroupsTree in class VersionableTable
Parameters:
tableRow - com.ibm.dse.tools.workbench.base.TableRow The entity to copy
destinationRep - com.ibm.dse.tools.workbench.base.Repository The repository where to copy
exactGroup - boolean Indicator of whether the row has to be attached to the container group by CODE (true) or by NAME (false)
Throws:
WorkbenchException -  

createOpenEdition

public TableRow createOpenEdition(TableRow row)
                           throws WorkbenchException
Creates an open edition of an entity row.

Create an open edition of an entity implies:
Duplicate the row, changing its primary key.
Alter the attributes referring the original entity so as they refer to the open edition entity
Create open editions of the instances referring the original entity
Alter owned attributes to point to the open edition entity and create an open edition for the related instances
Alter component entities to point to the open edition entity
Alter owner entities to point to the open edition entity and create an open edition for them
Alter subentities to point to the open edition entity and create an open edition for them
Set the container group for the open edition row, and create and create an open edition for it

Overrides:
createOpenEdition in class VersionableTable
Parameters:
row - com.ibm.dse.tools.workbench.base.TableRow the original row
Returns:
com.ibm.dse.tools.workbench.base.TableRow the open edition row
Throws:
WorkbenchException -  

createRelations

public void createRelations()
                     throws WBInvalidArgumentException
This method creates the relationships for a table
Overrides:
createRelations in class AbstractTable
Throws:
WBInvalidArgumentException - There is an error creating relationships.

getActiveColumn

public int getActiveColumn()
Returns the Active column identifier
Overrides:
getActiveColumn in class VersionableTable
Returns:
int

getAttributesList

public TableRow[] getAttributesList(TableRow entity)
                             throws WorkbenchException
Returns the attributes owned by an entity
Parameters:
entity - com.ibm.dse.tools.workbench.base.Table the entity
Returns:
com.ibm.dse.tools.workbench.base.TableRow[]
Throws:
WorkbenchException - An error occurred while retrieving the attributes list

getCodeColumn

public int getCodeColumn()
Returns the Code column identifier
Returns:
int

getContainerGroup

public TableRow getContainerGroup(TableRow versionableRow)
                           throws WorkbenchException
This method returns the group containing the versionableRow passed as parameter
Overrides:
getContainerGroup in class VersionableTable
Parameters:
versionableRow - com.ibm.dse.tools.workbench.base.TableRow The row whose group must be returned
Returns:
com.ibm.dse.tools.workbench.base.TableRow The group containing the versionableRow
Throws:
WorkbenchException -  

getInheritedComposition

public TableRow[] getInheritedComposition(TableRow entity)
                                   throws WorkbenchException
Returns the list of composition rules of an entity including the inherited composition rules
Parameters:
entity - com.ibm.dse.tools.workbench.base.TableRow The row representing the entity
Returns:
com.ibm.dse.tools.workbench.base.TableRow[] The EntitiesEntitiesTable rows representing the composition rules
Throws:
WorkbenchException -  

getMandatoryAttributesList

public TableRow[] getMandatoryAttributesList(TableRow entity)
                                      throws WorkbenchException
Returns the mandatory attributes owned by an entity
Parameters:
entity - com.ibm.dse.tools.workbench.base.Table the entity
Returns:
com.ibm.dse.tools.workbench.base.TableRow[]
Throws:
WorkbenchException - An error occurred while retrieving the attributes list

getNameColumn

public int getNameColumn()
Returns the Name column identifier
Overrides:
getNameColumn in class VersionableTable
Returns:
int

getOwnerColumn

public int getOwnerColumn()
Returns the Owner column identifier
Overrides:
getOwnerColumn in class VersionableTable
Returns:
int

getReleasedColumn

public int getReleasedColumn()
Returns the Released column identifier
Overrides:
getReleasedColumn in class VersionableTable
Returns:
int

getSubEntitiesTree

public TableRow[] getSubEntitiesTree(TableRow entity)
                              throws WorkbenchException
Returns all the entities that extend from an entity including it
Parameters:
entity - com.ibm.dse.tools.workbench.base.TableRow The row representing the entity
Returns:
com.ibm.dse.tools.workbench.base.TableRow[]
Throws:
WorkbenchException -  

getSuperEntitiesTree

public TableRow[] getSuperEntitiesTree(TableRow entity)
                                throws WorkbenchException
Returns all the hierarchy of entities from which an entity extends, including it
Parameters:
entity - com.ibm.dse.tools.workbench.base.TableRow The row representing the entity
Returns:
com.ibm.dse.tools.workbench.base.TableRow[]
Throws:
WorkbenchException -  

getTimeStampColumn

public int getTimeStampColumn()
Returns the TimeStamp column identifier
Overrides:
getTimeStampColumn in class VersionableTable
Returns:
int

getVersionColumn

public int getVersionColumn()
Returns the Version column identifier
Overrides:
getVersionColumn in class VersionableTable
Returns:
int

getVersionedColumn

public int getVersionedColumn()
Returns the Versioned column identifier
Overrides:
getVersionedColumn in class VersionableTable
Returns:
int

hasInheritedComposition

public boolean hasInheritedComposition(TableRow entity)
                                throws WorkbenchException
Indicates if an entity has own or inherited composition
Parameters:
entity - com.ibm.dse.tools.workbench.base.TableRow
Returns:
boolean
Throws:
WorkbenchException -  

hasSelfGeneratedPk

public boolean hasSelfGeneratedPk()
This method indicates if the field in the primary key must be generated automatically
Overrides:
hasSelfGeneratedPk in class AbstractTable
Returns:
boolean

importToWorkspace

public void importToWorkspace(Workspace ws,
                              TableRow row)
                       throws WorkbenchException
Copies a group row from a repository to a workspace.

Rows in VersionableTable objects contained in a Workspace object can not be imported to a Workspace.

This method also copies the parent groups tree if needed.

Overrides:
importToWorkspace in class VersionableTable
Parameters:
ws - com.ibm.dse.tools.workbench.base.Workspace The destination repository.
row - com.ibm.dse.tools.workbench.base.TableRow The row to be copied.
Throws:
WorkbenchException - An error ocurred while importing to workspace.

rowsToBeRemoved

public TableRow[] rowsToBeRemoved(TableRow[] rows)
                           throws WorkbenchException
Returns the rows that a remove process performed on a set of rows will remove.
Overrides:
rowsToBeRemoved in class VersionableTable
Parameters:
rows - com.ibm.dse.tools.workbench.base.TableRow[] the rows
Returns:
com.ibm.dse.tools.workbench.base.TableRow[] the rows that would de removed
Throws:
WorkbenchException - An error ocurred while retrieving the rows to be removed.

rowsToBeRemoved

protected void rowsToBeRemoved(TableRow row,
                               java.util.Hashtable rowList)
                        throws WorkbenchException
Adds to a Hashtable the related rows that a remove process performed on a row will remove.
Overrides:
rowsToBeRemoved in class VersionableTable
Parameters:
row - com.ibm.dse.tools.workbench.base.TableRow The row to be removed
rowList - java.util.Hashtable The list of related rows
Throws:
WorkbenchException - An error ocurred while retrieving the rows to be removed.

setContainerGroup

public void setContainerGroup(TableRow versionableRow,
                              java.lang.String grpCode)
                       throws WorkbenchException
This method sets the Container group of an entity row
Overrides:
setContainerGroup in class VersionableTable
Parameters:
versionableRow - com.ibm.dse.tools.workbench.base.TableRow The entity row
grpCode - java.lang.String The code of the group to be set as container
Throws:
WorkbenchException -  

validate

public java.lang.String[] validate(TableRow row)
This method checks the correctness of an entity row based on application rules

It returns the list of error strings or null if there are no errors

Overrides:
validate in class AbstractTable
Parameters:
row - com.ibm.dse.tools.workbench.base.TableRow The row to validate
Returns:
java.lang.String[] the errors list

version

public TableRow version(TableRow versionableRow,
                        java.lang.String newVersion,
                        Repository repository)
                 throws WorkbenchException
Versions an entity row, copying it to a repository
Overrides:
version in class VersionableTable
Parameters:
versionableRow - com.ibm.dse.tools.workbench.base.TableRow the entity row to version
newVersion - java.lang.String The new version code
repository - com.ibm.dse.tools.workbench.base.Repository The repository where to store the versioned entity row
Returns:
com.ibm.dse.tools.workbench.base.TableRow the versioned entity row
Throws:
WorkbenchException - The row can not be versioned