de.fesenmeyer.dbnormalizer.core.algorithms
Class NormalizationProposal

java.lang.Object
  extended by de.fesenmeyer.dbnormalizer.core.algorithms.NormalizationProposal

public class NormalizationProposal
extends Object

Class representing a normalization proposal.

Author:
DF
See Also:
AbstractNormalizationAlgorithm.normalize(Table)

Field Summary
private  SortedSet<Table> createdTables
          The tables to be created due to the normalization proposal.
private  NormalizationFKsProposal fksProposal
          The foreign keys (FKs) to be created due to the normalization proposal.
private static DBNormalizerLogger logger
          The logger for this class.
private  Table oldTable
          The old table (the table for which the normalization proposal has been generated).
private  String sqlScript
          The SQL script generated for normalization.
 
Constructor Summary
NormalizationProposal(Table oldTable)
          Class Constructor specifying the old table (the table for which the normalization proposal has been generated).
 
Method Summary
 void addCreatedTable(Table table)
          Adds a table to the tables to be created due to the normalization proposal.
 SortedSet<Table> getCreatedTables()
          Gets the tables to be created due to the normalization proposal.
 NormalizationFKsProposal getFksProposal()
          Gets the foreign keys (FKs) to be created due to the normalization proposal.
 NormalForm getNf()
          Gets normal form of the normalization proposal (the lowest normal form of the created tables).
 Table getOldTable()
          Gets the old table (the table for which the normalization proposal has been generated).
 String getSqlScript()
          Gets the SQL script generated for normalization.
 void setFksProposal(NormalizationFKsProposal fksProposal)
          Sets the foreign keys (FKs) to be created due to the normalization proposal.
 void setSqlScript(String sqlScript)
          Sets the SQL script generated for normalization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static DBNormalizerLogger logger
The logger for this class.


oldTable

private Table oldTable
The old table (the table for which the normalization proposal has been generated).


createdTables

private SortedSet<Table> createdTables
The tables to be created due to the normalization proposal.


fksProposal

private NormalizationFKsProposal fksProposal
The foreign keys (FKs) to be created due to the normalization proposal.


sqlScript

private String sqlScript
The SQL script generated for normalization. Is null, if the old table does not exist in a DB.

Constructor Detail

NormalizationProposal

public NormalizationProposal(Table oldTable)
Class Constructor specifying the old table (the table for which the normalization proposal has been generated).

Parameters:
oldTable - the old table
Method Detail

getOldTable

public Table getOldTable()
Gets the old table (the table for which the normalization proposal has been generated).

Returns:
the old table

addCreatedTable

public void addCreatedTable(Table table)
Adds a table to the tables to be created due to the normalization proposal.

Parameters:
table - a table

getCreatedTables

public SortedSet<Table> getCreatedTables()
Gets the tables to be created due to the normalization proposal.

Returns:
a set of tables

getFksProposal

public NormalizationFKsProposal getFksProposal()
Gets the foreign keys (FKs) to be created due to the normalization proposal.

Returns:
a NormalizationFKsProposal object containing the FKs to be created

setFksProposal

public void setFksProposal(NormalizationFKsProposal fksProposal)
Sets the foreign keys (FKs) to be created due to the normalization proposal.

Parameters:
fksProposal - a NormalizationFKsProposal object containing the FKs to be created

getNf

public NormalForm getNf()
Gets normal form of the normalization proposal (the lowest normal form of the created tables).

Returns:
the normal form; may be null, if there have not yet any tables been added to the normalization proposal

getSqlScript

public String getSqlScript()
Gets the SQL script generated for normalization.

Returns:
the sql script; null, if the old table does not exist in a DB.

setSqlScript

public void setSqlScript(String sqlScript)
Sets the SQL script generated for normalization.

Parameters:
sqlScript - the sql script
See Also:
NormalizationScriptBuilder