public class DataModel extends Object
| Modifier and Type | Class and Description |
|---|---|
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 |
|---|---|
static String |
DEFAULT_NAME
Default model name.
|
static String |
MODELNAME_CSV_FILE |
Map<String,Association> |
namedAssociations
Maps association-names to associations;
|
static boolean |
printClosures
Printing-mode.
|
static 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(Map<String,String> sourceSchemaMapping,
ExecutionContext executionContext,
boolean failOnMissingTables)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(PrimaryKeyFactory primaryKeyFactory,
Map<String,String> sourceSchemaMapping,
ExecutionContext executionContext)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(String additionalTablesFile,
String additionalAssociationsFile,
ExecutionContext executionContext)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(String additionalTablesFile,
String additionalAssociationsFile,
Map<String,String> sourceSchemaMapping,
CsvFile.LineFilter assocFilter,
ExecutionContext executionContext)
Reads in
table.csv and association.csv
and builds the relational data model. |
DataModel(String additionalTablesFile,
String additionalAssociationsFile,
Map<String,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(String additionalTablesFile,
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 |
|---|---|
void |
assignAssociationIDs()
Assigns a unique ID to each association.
|
void |
checkForPrimaryKey(Set<Table> subjects,
boolean forDeletion)
Checks whether all tables in the closure of a given subject have primary keys.
|
void |
deriveFilters()
Removes all derived filters and renews them.
|
static String |
getAssociationsFile(ExecutionContext executionContext)
Gets name of file containing the association definitions.
|
static String |
getColumnsFile(ExecutionContext executionContext)
Gets name of file containing the column definitions.
|
static String |
getDatamodelFolder(ExecutionContext executionContext)
Gets name of data model folder.
|
String |
getDisplayName(Table table)
Gets display name of a table
|
static String |
getDisplayNamesFile(ExecutionContext executionContext)
Gets name of file containing the display names.
|
static String |
getExcludeFromDeletionFile(ExecutionContext executionContext)
List of tables to be excluded from deletion.
|
String |
getExportModus()
Gets export modus, SQL or XML.
|
List<FilterTemplate> |
getFilterTemplates()
Gets the
FilterTemplates ordered by priority. |
Set<Table> |
getIndependentTables(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.
|
Set<Table> |
getIndependentTables(Set<Table> tableSet,
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.
|
Long |
getLastModified()
Gets time of last modification.
|
String |
getLastModifiedAsString()
Gets
getLastModified() as String. |
static String |
getModelNameFile(ExecutionContext executionContext)
Gets name of file containing the model name
|
String |
getName()
Gets name of the model.
|
SortedSet<String> |
getParameters(String subjectCondition,
List<ExtractionModel.AdditionalSubject> additionalSubjects)
Gets all parameters which occur in subject condition, association restrictions or XML templates.
|
RestrictionModel |
getRestrictionModel()
Gets the restriction model.
|
List<Table> |
getSortedTables()
Gets list of tables sorted by name.
|
Table |
getTable(String name)
Gets a table by name.
|
Table |
getTableByDisplayName(String displayName)
Gets a table by display name.
|
Table |
getTableByOrdinal(int ordinal)
Gets table by
Table.getOrdinal(). |
Collection<Table> |
getTables()
Gets all tables.
|
static String |
getTablesFile(ExecutionContext executionContext)
Gets name of file containing the table definitions.
|
long |
getVersion()
Gets internal version number.
|
static String |
getVersionFile(ExecutionContext executionContext)
Name of file containing the version number.
|
DataModel.XmlSettings |
getXmlSettings()
Gets XML settings for exportation into XML files.
|
Set<Table> |
normalize(Set<Table> tables)
Normalizes a set of tables.
|
void |
save(String file,
Table stable,
String subjectCondition,
ScriptFormat scriptFormat,
List<RestrictionDefinition> restrictionDefinitions,
Map<String,Map<String,double[]>> positions,
List<ExtractionModel.AdditionalSubject> additionalSubjects,
String currentModelSubfolder)
Saves the data model.
|
void |
saveRestrictions(File file,
List<RestrictionDefinition> restrictionDefinitions)
Saves restrictions only.
|
void |
setExportModus(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.
|
String |
toString()
Stringifies the data model.
|
void |
transpose()
Transposes the data-model.
|
public static final String TABLE_CSV_FILE
public static final String MODELNAME_CSV_FILE
public Map<String,Association> namedAssociations
public long version
public static final String DEFAULT_NAME
public static boolean printClosures
public DataModel(PrimaryKeyFactory primaryKeyFactory, Map<String,String> sourceSchemaMapping, ExecutionContext executionContext) throws IOException
table.csv and association.csv
and builds the relational data model.IOExceptionpublic DataModel(ExecutionContext executionContext) throws IOException
table.csv and association.csv
and builds the relational data model.IOExceptionpublic DataModel(Map<String,String> sourceSchemaMapping, ExecutionContext executionContext, boolean failOnMissingTables) throws IOException
table.csv and association.csv
and builds the relational data model.IOExceptionpublic DataModel(String additionalTablesFile, String additionalAssociationsFile, PrimaryKeyFactory primaryKeyFactory, ExecutionContext executionContext) throws IOException
table.csv and association.csv
and builds the relational data model.additionalTablesFile - table file to read tooadditionalAssociationsFile - association file to read tooIOExceptionpublic DataModel(String additionalTablesFile, String additionalAssociationsFile, ExecutionContext executionContext) throws IOException
table.csv and association.csv
and builds the relational data model.additionalTablesFile - table file to read tooadditionalAssociationsFile - association file to read tooIOExceptionpublic DataModel(String additionalTablesFile, String additionalAssociationsFile, Map<String,String> sourceSchemaMapping, CsvFile.LineFilter assocFilter, ExecutionContext executionContext) throws IOException
table.csv and association.csv
and builds the relational data model.additionalTablesFile - table file to read tooadditionalAssociationsFile - association file to read tooIOExceptionpublic DataModel(String additionalTablesFile, String additionalAssociationsFile, Map<String,String> sourceSchemaMapping, CsvFile.LineFilter assocFilter, PrimaryKeyFactory primaryKeyFactory, ExecutionContext executionContext, boolean failOnMissingTables) throws IOException
table.csv and association.csv
and builds the relational data model.additionalTablesFile - table file to read tooadditionalAssociationsFile - association file to read tooIOExceptionpublic static String getDatamodelFolder(ExecutionContext executionContext)
public static String getTablesFile(ExecutionContext executionContext)
public static String getModelNameFile(ExecutionContext executionContext)
public static String getDisplayNamesFile(ExecutionContext executionContext)
public static String getColumnsFile(ExecutionContext executionContext)
public static String getAssociationsFile(ExecutionContext executionContext)
public static String getExcludeFromDeletionFile(ExecutionContext executionContext)
public static String getVersionFile(ExecutionContext executionContext)
public Table getTable(String name)
name - the name of the tablenull iff no table with the name existspublic Table getTableByDisplayName(String displayName)
displayName - the display name of the tablenull iff no table with the display name existspublic String getName()
public Long getLastModified()
public String getDisplayName(Table table)
table - the tablepublic Collection<Table> getTables()
public RestrictionModel getRestrictionModel()
public void setRestrictionModel(RestrictionModel restrictionModel)
restrictionModel - the restriction modelpublic Set<Table> getIndependentTables(Set<Table> tableSet)
tableSet - the table-setpublic Set<Table> getIndependentTables(Set<Table> tableSet, Set<Association> associations)
tableSet - the table-setassociations - the associations to consider, null for all associationspublic void transpose()
public List<Table> getSortedTables()
public Set<Table> normalize(Set<Table> tables)
tables - set of tablestablespublic void assignAssociationIDs()
public String getExportModus()
public void setExportModus(String modus)
public DataModel.XmlSettings getXmlSettings()
public void setXmlSettings(DataModel.XmlSettings xmlSettings)
public long getVersion()
public void checkForPrimaryKey(Set<Table> subjects, boolean forDeletion) throws DataModel.NoPrimaryKeyException
subject - the subjectDataModel.NoPrimaryKeyException - if a table has no primary keypublic SortedSet<String> getParameters(String subjectCondition, List<ExtractionModel.AdditionalSubject> additionalSubjects)
subjectCondition - the subject conditionpublic String getLastModifiedAsString()
getLastModified() as String.getLastModified() as Stringpublic void save(String file, Table stable, String subjectCondition, ScriptFormat scriptFormat, List<RestrictionDefinition> restrictionDefinitions, Map<String,Map<String,double[]>> positions, List<ExtractionModel.AdditionalSubject> additionalSubjects, String currentModelSubfolder) throws FileNotFoundException
file - the file namestable - stable - the subject tablesubjectCondition - scriptFormat - positions - table positions or nulladditionalSubjects - FileNotFoundExceptionpublic void saveRestrictions(File file, List<RestrictionDefinition> restrictionDefinitions) throws FileNotFoundException
file - to save restrictions intoFileNotFoundExceptionpublic Table getTableByOrdinal(int ordinal)
Table.getOrdinal().ordinal - the ordinalpublic List<FilterTemplate> getFilterTemplates()
FilterTemplates ordered by priority.public void deriveFilters()