public class DataModel
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DataModel.ColumnOrderPriority
Order priority of a column.
|
static class |
DataModel.NoPrimaryKeyException
Thrown if a table has no primary key.
|
static class |
DataModel.XmlSettings
Holds XML settings for exportation into XML files.
|
Modifier and Type | Field and Description |
---|---|
java.util.Map<java.lang.String,DataModel.ColumnOrderPriority> |
columnOrderPrio
Maps normalized column name to order priority.
|
java.util.Set<java.lang.String> |
decisionPending
Set of names of associations for which no decision has been made.
|
static java.lang.String |
DEFAULT_NAME
Default model name.
|
static java.lang.String |
MODELNAME_CSV_FILE |
java.util.Map<java.lang.String,Association> |
namedAssociations
Maps association-names to associations;
|
static java.lang.String |
TABLE_CSV_FILE |
long |
version
Internal version number.
|
Constructor and Description |
---|
DataModel(ExecutionContext executionContext)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(KnownIdentifierMap knownIdentifiers,
ExecutionContext executionContext)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping,
ExecutionContext executionContext,
boolean failOnMissingTables)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(PrimaryKeyFactory primaryKeyFactory,
java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping,
ExecutionContext executionContext)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(java.lang.String additionalTablesFile,
java.lang.String additionalAssociationsFile,
ExecutionContext executionContext)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(java.lang.String additionalTablesFile,
java.lang.String additionalAssociationsFile,
java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping,
CsvFile.LineFilter assocFilter,
ExecutionContext executionContext)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(java.lang.String additionalTablesFile,
java.lang.String additionalAssociationsFile,
java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping,
CsvFile.LineFilter assocFilter,
PrimaryKeyFactory primaryKeyFactory,
ExecutionContext executionContext,
boolean failOnMissingTables)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(java.lang.String additionalTablesFile,
java.lang.String additionalAssociationsFile,
java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping,
CsvFile.LineFilter assocFilter,
PrimaryKeyFactory primaryKeyFactory,
ExecutionContext executionContext,
boolean failOnMissingTables,
KnownIdentifierMap knownIdentifiers)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(java.lang.String additionalTablesFile,
java.lang.String additionalAssociationsFile,
PrimaryKeyFactory primaryKeyFactory,
ExecutionContext executionContext)
Reads in
table.csv and association.csv
and builds the relational data model. |
Modifier and Type | Method and Description |
---|---|
static void |
addRestrictedDependencyWithNulledFK(java.util.Set<Table> tables) |
void |
assignAssociationIDs()
Assigns a unique ID to each association.
|
java.util.Set<Table> |
checkForPrimaryKey(java.util.Set<Table> subjects,
boolean hasRowID)
Checks whether all tables in the closure of a given subject have primary keys.
|
void |
deriveFilters()
Removes all derived filters and renews them.
|
static java.lang.String |
getAssociationsFile(ExecutionContext executionContext)
Gets name of file containing the association definitions.
|
static java.lang.String |
getColumnsFile(ExecutionContext executionContext)
Gets name of file containing the column definitions.
|
java.lang.String |
getComment(Table table,
Column column) |
static java.lang.String |
getCommentsFile(ExecutionContext executionContext)
Gets name of file containing the comments.
|
static java.lang.String |
getDatamodelFolder(ExecutionContext executionContext)
Gets name of data model folder.
|
java.lang.String |
getDisplayName(Table table)
Gets display name of a table
|
static java.lang.String |
getDisplayNamesFile(ExecutionContext executionContext)
Gets name of file containing the display names.
|
static java.lang.String |
getExcludeFromDeletionFile(ExecutionContext executionContext)
List of tables to be excluded from deletion.
|
java.lang.String |
getExportModus()
Gets export modus, SQL or XML.
|
java.util.List<FilterTemplate> |
getFilterTemplates()
Gets the
FilterTemplate s ordered by priority. |
java.util.Set<Table> |
getIndependentTables(java.util.Set<Table> tableSet)
Gets all independent tables
(i.e. tables which don't depend on other tables in the set)
of a given table-set.
|
java.util.Set<Table> |
getIndependentTables(java.util.Set<Table> tableSet,
java.util.Set<Association> associations)
Gets all independent tables
(i.e. tables which don't depend on other tables in the set)
of a given table-set.
|
java.lang.Long |
getLastModified()
Gets time of last modification.
|
java.lang.String |
getLastModifiedAsString()
Gets
getLastModified() as String. |
static java.lang.String |
getModelNameFile(ExecutionContext executionContext)
Gets name of file containing the model name
|
java.lang.String |
getName()
Gets name of the model.
|
java.util.SortedSet<java.lang.String> |
getParameters(java.lang.String subjectCondition,
java.util.List<ExtractionModel.AdditionalSubject> additionalSubjects)
Gets all parameters which occur in subject condition, association restrictions or XML templates.
|
RestrictionModel |
getRestrictionModel()
Gets the restriction model.
|
java.util.List<Table> |
getSortedTables()
Gets list of tables sorted by name.
|
Table |
getTable(java.lang.String name)
Gets a table by name.
|
Table |
getTableByDisplayName(java.lang.String displayName)
Gets a table by display name.
|
Table |
getTableByOrdinal(int ordinal)
Gets table by
Table.getOrdinal() . |
java.util.Collection<Table> |
getTables()
Gets all tables.
|
static java.lang.String |
getTablesFile(ExecutionContext executionContext)
Gets name of file containing the table definitions.
|
long |
getVersion()
Gets internal version number.
|
static java.lang.String |
getVersionFile(ExecutionContext executionContext)
Name of file containing the version number.
|
DataModel.XmlSettings |
getXmlSettings()
Gets XML settings for exportation into XML files.
|
java.util.Set<Table> |
normalize(java.util.Set<Table> tables)
Normalizes a set of tables.
|
void |
save(java.lang.String file,
Table stable,
SubjectLimitDefinition subjectLimitDefinition,
java.lang.String subjectCondition,
ScriptFormat scriptFormat,
java.util.List<RestrictionDefinition> restrictionDefinitions,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,double[]>> positions,
java.util.List<ExtractionModel.AdditionalSubject> additionalSubjects,
java.lang.String currentModelSubfolder)
Saves the data model.
|
void |
saveColumnOrderPrio()
Saves the order priority of the columns.
|
void |
saveRestrictions(java.io.File file,
java.util.List<RestrictionDefinition> restrictionDefinitions)
Saves restrictions only.
|
void |
setExportModus(java.lang.String modus)
Sets export modus, SQL or XML.
|
void |
setRestrictionModel(RestrictionModel restrictionModel)
Sets the restriction model.
|
void |
setXmlSettings(DataModel.XmlSettings xmlSettings)
Sets XML settings for exportation into XML files.
|
java.lang.String |
toString()
Stringifies the data model.
|
void |
transpose()
Transposes the data-model.
|
public static final java.lang.String TABLE_CSV_FILE
public static final java.lang.String MODELNAME_CSV_FILE
public java.util.Map<java.lang.String,Association> namedAssociations
public java.util.Set<java.lang.String> decisionPending
public final java.util.Map<java.lang.String,DataModel.ColumnOrderPriority> columnOrderPrio
public long version
public static final java.lang.String DEFAULT_NAME
public DataModel(PrimaryKeyFactory primaryKeyFactory, java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping, ExecutionContext executionContext) throws java.io.IOException
table.csv
and association.csv
and builds the relational data model.java.io.IOException
public DataModel(ExecutionContext executionContext) throws java.io.IOException
table.csv
and association.csv
and builds the relational data model.java.io.IOException
public DataModel(KnownIdentifierMap knownIdentifiers, ExecutionContext executionContext) throws java.io.IOException
table.csv
and association.csv
and builds the relational data model.knownIdentifiers
- java.io.IOException
public DataModel(java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping, ExecutionContext executionContext, boolean failOnMissingTables) throws java.io.IOException
table.csv
and association.csv
and builds the relational data model.java.io.IOException
public DataModel(java.lang.String additionalTablesFile, java.lang.String additionalAssociationsFile, PrimaryKeyFactory primaryKeyFactory, ExecutionContext executionContext) throws java.io.IOException
table.csv
and association.csv
and builds the relational data model.additionalTablesFile
- table file to read tooadditionalAssociationsFile
- association file to read toojava.io.IOException
public DataModel(java.lang.String additionalTablesFile, java.lang.String additionalAssociationsFile, ExecutionContext executionContext) throws java.io.IOException
table.csv
and association.csv
and builds the relational data model.additionalTablesFile
- table file to read tooadditionalAssociationsFile
- association file to read toojava.io.IOException
public DataModel(java.lang.String additionalTablesFile, java.lang.String additionalAssociationsFile, java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping, CsvFile.LineFilter assocFilter, ExecutionContext executionContext) throws java.io.IOException
table.csv
and association.csv
and builds the relational data model.additionalTablesFile
- table file to read tooadditionalAssociationsFile
- association file to read toojava.io.IOException
public DataModel(java.lang.String additionalTablesFile, java.lang.String additionalAssociationsFile, java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping, CsvFile.LineFilter assocFilter, PrimaryKeyFactory primaryKeyFactory, ExecutionContext executionContext, boolean failOnMissingTables) throws java.io.IOException
table.csv
and association.csv
and builds the relational data model.additionalTablesFile
- table file to read tooadditionalAssociationsFile
- association file to read toojava.io.IOException
public DataModel(java.lang.String additionalTablesFile, java.lang.String additionalAssociationsFile, java.util.Map<java.lang.String,java.lang.String> sourceSchemaMapping, CsvFile.LineFilter assocFilter, PrimaryKeyFactory primaryKeyFactory, ExecutionContext executionContext, boolean failOnMissingTables, KnownIdentifierMap knownIdentifiers) throws java.io.IOException
table.csv
and association.csv
and builds the relational data model.additionalTablesFile
- table file to read tooadditionalAssociationsFile
- association file to read toojava.io.IOException
public static java.lang.String getDatamodelFolder(ExecutionContext executionContext)
public static java.lang.String getTablesFile(ExecutionContext executionContext)
public static java.lang.String getModelNameFile(ExecutionContext executionContext)
public static java.lang.String getDisplayNamesFile(ExecutionContext executionContext)
public static java.lang.String getColumnsFile(ExecutionContext executionContext)
public static java.lang.String getAssociationsFile(ExecutionContext executionContext)
public static java.lang.String getCommentsFile(ExecutionContext executionContext)
public static java.lang.String getExcludeFromDeletionFile(ExecutionContext executionContext)
public static java.lang.String getVersionFile(ExecutionContext executionContext)
public Table getTable(java.lang.String name)
name
- the name of the tablenull
iff no table with the name existspublic Table getTableByDisplayName(java.lang.String displayName)
displayName
- the display name of the tablenull
iff no table with the display name existspublic java.lang.String getName()
public java.lang.Long getLastModified()
public java.lang.String getDisplayName(Table table)
table
- the tablepublic java.util.Collection<Table> getTables()
public RestrictionModel getRestrictionModel()
public void setRestrictionModel(RestrictionModel restrictionModel)
restrictionModel
- the restriction modelpublic java.util.Set<Table> getIndependentTables(java.util.Set<Table> tableSet)
tableSet
- the table-setpublic java.util.Set<Table> getIndependentTables(java.util.Set<Table> tableSet, java.util.Set<Association> associations)
tableSet
- the table-setassociations
- the associations to consider, null
for all associationspublic void transpose()
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.List<Table> getSortedTables()
public java.util.Set<Table> normalize(java.util.Set<Table> tables)
tables
- set of tablestables
public void assignAssociationIDs()
public java.lang.String getExportModus()
public void setExportModus(java.lang.String modus)
public DataModel.XmlSettings getXmlSettings()
public void setXmlSettings(DataModel.XmlSettings xmlSettings)
public long getVersion()
public java.util.Set<Table> checkForPrimaryKey(java.util.Set<Table> subjects, boolean hasRowID) throws DataModel.NoPrimaryKeyException
subjects
- the subjectshasRowID
- DataModel.NoPrimaryKeyException
- if a table has no primary keypublic java.util.SortedSet<java.lang.String> getParameters(java.lang.String subjectCondition, java.util.List<ExtractionModel.AdditionalSubject> additionalSubjects)
subjectCondition
- the subject conditionpublic java.lang.String getLastModifiedAsString()
getLastModified()
as String.getLastModified()
as Stringpublic void save(java.lang.String file, Table stable, SubjectLimitDefinition subjectLimitDefinition, java.lang.String subjectCondition, ScriptFormat scriptFormat, java.util.List<RestrictionDefinition> restrictionDefinitions, java.util.Map<java.lang.String,java.util.Map<java.lang.String,double[]>> positions, java.util.List<ExtractionModel.AdditionalSubject> additionalSubjects, java.lang.String currentModelSubfolder) throws java.io.FileNotFoundException
file
- the file namestable
- stable
- the subject tablesubjectLimitDefinition
- limit of subjectsubjectCondition
- scriptFormat
- positions
- table positions or null
additionalSubjects
- java.io.FileNotFoundException
public void saveRestrictions(java.io.File file, java.util.List<RestrictionDefinition> restrictionDefinitions) throws java.io.FileNotFoundException
file
- to save restrictions intojava.io.FileNotFoundException
public void saveColumnOrderPrio() throws java.io.FileNotFoundException
java.io.FileNotFoundException
public Table getTableByOrdinal(int ordinal)
Table.getOrdinal()
.ordinal
- the ordinalpublic java.util.List<FilterTemplate> getFilterTemplates()
FilterTemplate
s ordered by priority.public void deriveFilters()
public static void addRestrictedDependencyWithNulledFK(java.util.Set<Table> tables)