public abstract class EntityGraph extends Object
| Modifier and Type | Field and Description |
|---|---|
DataModel |
dataModel |
static String |
DEPENDENCY
Name of the dependency-table.
|
static String |
ENTITY
Name of the entity-table.
|
static String |
ENTITY_GRAPH
Name of the graph-table.
|
static String |
ENTITY_SET_ELEMENT
Name of the (helper) set-table.
|
protected ExecutionContext |
executionContext
The execution context.
|
Map<Association,Integer> |
explainIdOfAssociation
Unique IDs for each association to be used for explanation.
|
int |
graphID
The unique ID of the graph.
|
protected ImportFilterManager |
importFilterManager
The
ImportFilterManager. |
protected boolean |
inDeleteMode |
static long |
maxTotalRowcount |
| Modifier | Constructor and Description |
|---|---|
protected |
EntityGraph(int graphID,
DataModel dataModel,
ExecutionContext executionContext) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
addDependencies(Table from,
String fromAlias,
Table to,
String toAlias,
String condition,
int aggregationId,
int dependencyId,
boolean isAssociationReversed)
Adds dependencies.
|
abstract long |
addEntities(Table table,
String condition,
int today)
Adds entities to the graph.
|
abstract void |
close()
Closes the graph.
|
abstract EntityGraph |
copy(int graphID,
Session session)
Copies an entity-graph.
|
abstract long |
countEntities(Table table)
Counts the entities of a given table in this graph.
|
static int |
createUniqueGraphID()
Creates a unique ID for a new graph.
|
abstract void |
delete()
Deletes the graph.
|
abstract long |
deleteEntities(Table table)
Deletes all entities from a given table.
|
abstract void |
deleteIndependentEntities(Table table)
Deletes all entities which are marked as independent.
|
protected String |
dmlTableReference(String tableName,
Session session)
Gets table reference for DML statements for a given working table.
|
void |
dropMappingTables(OutputStreamWriter result,
DBMS targetDBMSConfiguration)
Creates the DROP-statements for the mapping tables.
|
void |
fillAndWriteMappingTables(JobManager jobManager,
OutputStreamWriter dmlResultWriter,
int numberOfEntities,
Session targetSession,
DBMS targetDBMSConfiguration,
DBMS dbmsConfiguration)
Insert the values of columns with non-derived-import-filters into the local database.
|
abstract EntityGraph |
find(int graphID,
Session session,
PrimaryKey universalPrimaryKey)
Finds an entity-graph.
|
abstract int |
getAge()
Gets the age of the graph.
|
abstract DataModel |
getDatamodel() |
abstract Set<Integer> |
getDistinctDependencyIDs()
Gets distinct association-ids of all edged.
|
ImportFilterManager |
getImportFilterManager()
Gets the
ImportFilterManager |
abstract Session |
getSession()
Gets the session.
|
abstract long |
getSize()
Gets the number of entities in the graph.
|
long |
getSize(Set<Table> tables)
Gets the number of entities form given tables in the graph.
|
abstract Session |
getTargetSession() |
abstract long |
getTotalRowcount()
Gets total row-count.
|
TransformerFactory |
getTransformerFactory()
Gets the
TransformerFactory. |
abstract PrimaryKey |
getUniversalPrimaryKey()
Gets the universal primary key.
|
int |
incLobCount()
Increments lob-counter and returns new value.
|
abstract void |
markDependentEntitiesAsTraversed(Association association,
ResultSet resultSet,
ResultSetMetaData resultSetMetaData,
Map<String,Integer> typeCache)
Marks all entities which depends on given entity as traversed.
|
abstract void |
markIndependentEntities(Table table)
Marks all entities of a given table which don't dependent on other entities,
s.t. they can be read and deleted.
|
abstract void |
markRoots(Table table)
Marks all rows which are not target of a dependency.
|
abstract void |
readDependentEntities(Table table,
Association association,
ResultSet resultSet,
ResultSetMetaData resultSetMetaData,
Session.ResultSetReader reader,
Map<String,Integer> typeCache,
String selectionSchema,
String originalPKAliasPrefix)
Reads all entities which depends on given entity.
|
abstract void |
readEntities(Table table,
boolean orderByPK)
Reads all entities of a given table.
|
abstract void |
readMarkedEntities(Table table,
boolean orderByPK)
Reads all entities of a given table which are marked as independent or as roots.
|
abstract void |
readMarkedEntities(Table table,
Session.ResultSetReader reader,
String selectionSchema,
String originalPKAliasPrefix,
boolean orderByPK)
Reads all entities of a given table which are marked as independent or as roots.
|
abstract void |
readNonTraversedDependencies(Table table,
Session.ResultSetReader reader)
Reads all non-traversed dependencies.
|
abstract long |
readUnfilteredEntityColumns(Table table,
List<Column> columns,
Session.ResultSetReader reader)
Reads some columns of all entities of a given table without using filters.
|
abstract long |
removeAssociatedDestinations(Association association,
boolean deletedEntitiesAreMarked)
Removes all entities from this graph which are associated with an entity
outside the graph.
|
void |
removeDependencies(Association association)
Removes all dependencies for a given association.
|
abstract void |
removeReflexiveDependencies(Table table)
Removes all reflexive dependencies of given table.
|
abstract long |
resolveAssociation(Table table,
Association association,
int today)
Resolves an association.
|
abstract void |
setAge(int age)
Sets the age of the graph.
|
abstract void |
setBirthdayOfSubject(int birthdayOfSubject)
Sets birthday of subject rows.
|
void |
setDeleteMode(boolean deleteMode) |
abstract void |
setExplain(boolean explain)
Whether or not to store additional information in order to create a 'explain.log'.
|
void |
setImportFilterManager(ImportFilterManager importFilterManager)
Sets the
ImportFilterManager |
void |
setTransformerFactory(TransformerFactory transformerFactory)
Sets the
TransformerFactory. |
abstract void |
shutDown()
Shuts down statement-executor.
|
protected int |
typeName(Table table) |
abstract void |
uniteWith(EntityGraph graph)
Unites the graph with another one and deletes the other graph.
|
abstract void |
updateEntities(Table table,
Set<Column> columns,
OutputStreamWriter scriptFileWriter,
DBMS targetConfiguration)
Updates columns of a table.
|
public static final String ENTITY_GRAPH
public static final String ENTITY_SET_ELEMENT
public static final String ENTITY
public static final String DEPENDENCY
public final DataModel dataModel
protected final ExecutionContext executionContext
protected boolean inDeleteMode
public final int graphID
public Map<Association,Integer> explainIdOfAssociation
public static long maxTotalRowcount
protected ImportFilterManager importFilterManager
ImportFilterManager.protected EntityGraph(int graphID,
DataModel dataModel,
ExecutionContext executionContext)
public abstract void setBirthdayOfSubject(int birthdayOfSubject)
birthdayOfSubject - birthday of subject rowspublic abstract EntityGraph copy(int graphID, Session session) throws SQLException
graph - the graph to copygraphID - the unique ID of the graphsession - for executing SQL-StatementsExceptionSQLExceptionpublic abstract EntityGraph find(int graphID, Session session, PrimaryKey universalPrimaryKey) throws SQLException, Exception
graphID - the unique ID of the graphuniversalPrimaryKey - the universal primary keysession - for executing SQL-StatementsExceptionSQLExceptionpublic abstract int getAge()
throws SQLException
SQLExceptionpublic abstract void setAge(int age)
throws SQLException
age - the age of the graphSQLExceptionpublic abstract long getSize()
throws SQLException
SQLExceptionpublic long getSize(Set<Table> tables) throws SQLException
SQLExceptionpublic abstract void delete()
throws SQLException
SQLExceptionpublic abstract long addEntities(Table table, String condition, int today) throws SQLException
table - the tablecondition - the condition in SQL that the entities must fulfilltoday - the birthday of the new entitiesSQLExceptionpublic abstract long resolveAssociation(Table table, Association association, int today) throws SQLException
table - the tableassociation - the association to resolvetoday - the birthday of the new entitiesSQLExceptionpublic abstract void addDependencies(Table from, String fromAlias, Table to, String toAlias, String condition, int aggregationId, int dependencyId, boolean isAssociationReversed) throws SQLException
from - source of dependencyfromAlias - alias for from-tableto - destination of dependencytoAlias - alias for to-tablecondition - condition of dependencyaggregationId - id of aggregation association (for XML export), 0 if not applicabledependencyId - id of dependencySQLExceptionpublic abstract Set<Integer> getDistinctDependencyIDs() throws SQLException
SQLExceptionpublic abstract void markIndependentEntities(Table table) throws SQLException
SQLExceptionpublic abstract void markRoots(Table table) throws SQLException
SQLExceptionpublic abstract void readMarkedEntities(Table table, boolean orderByPK) throws SQLException
table - the tableorderByPK - if true, result will be ordered by primary keysSQLExceptionpublic abstract void readMarkedEntities(Table table, Session.ResultSetReader reader, String selectionSchema, String originalPKAliasPrefix, boolean orderByPK) throws SQLException
reader - for reading the result-settable - the tableorderByPK - if true, result will be ordered by primary keysSQLExceptionpublic abstract void uniteWith(EntityGraph graph) throws SQLException
graph - the graph to be united with this graphSQLExceptionpublic abstract void readEntities(Table table, boolean orderByPK) throws SQLException
table - the tableorderByPK - if true, result will be ordered by primary keysSQLExceptionpublic abstract void updateEntities(Table table, Set<Column> columns, OutputStreamWriter scriptFileWriter, DBMS targetConfiguration) throws SQLException
table - the tablecolumns - the columns;SQLExceptionpublic abstract long readUnfilteredEntityColumns(Table table, List<Column> columns, Session.ResultSetReader reader) throws SQLException
table - the tablecolumns - the columnsreader - to readSQLExceptionpublic abstract void deleteIndependentEntities(Table table) throws SQLException
SQLExceptionpublic abstract long deleteEntities(Table table) throws SQLException
SQLExceptionpublic abstract long countEntities(Table table) throws SQLException
table - the tableSQLExceptionpublic abstract long removeAssociatedDestinations(Association association, boolean deletedEntitiesAreMarked) throws SQLException
deletedEntitiesAreMarked - if true, consider entity as deleted if its birthday is negativeassociation - the associationSQLExceptionpublic abstract void readDependentEntities(Table table, Association association, ResultSet resultSet, ResultSetMetaData resultSetMetaData, Session.ResultSetReader reader, Map<String,Integer> typeCache, String selectionSchema, String originalPKAliasPrefix) throws SQLException
table - the table from which to read entitiesassociation - the dependencyresultSet - current row is given entityreader - reads the entitiesselectionSchema - the selection schemaSQLExceptionpublic abstract void markDependentEntitiesAsTraversed(Association association, ResultSet resultSet, ResultSetMetaData resultSetMetaData, Map<String,Integer> typeCache) throws SQLException
table - the table from which to read entitiesassociation - the dependencyresultSet - current row is given entitySQLExceptionpublic abstract void readNonTraversedDependencies(Table table, Session.ResultSetReader reader) throws SQLException
table - the source of dependencies to look forreader - reads the entitiesSQLExceptionpublic abstract void removeReflexiveDependencies(Table table) throws SQLException
table - the tableSQLExceptionpublic abstract long getTotalRowcount()
public abstract void setExplain(boolean explain)
explain - true iff predecessors of each entity must be storedpublic abstract PrimaryKey getUniversalPrimaryKey()
public abstract void shutDown()
throws SQLException
SQLExceptionpublic abstract Session getSession()
public static int createUniqueGraphID()
public int incLobCount()
public abstract DataModel getDatamodel()
public abstract void close()
throws SQLException
SQLExceptionpublic void removeDependencies(Association association) throws SQLException
association - the asociationSQLExceptionpublic abstract Session getTargetSession()
public void setDeleteMode(boolean deleteMode)
protected int typeName(Table table)
public void setTransformerFactory(TransformerFactory transformerFactory)
TransformerFactory.transformerFactory - the factorypublic TransformerFactory getTransformerFactory()
TransformerFactory.public void setImportFilterManager(ImportFilterManager importFilterManager)
ImportFilterManagerimportFilterManager - the ImportFilterManagerpublic ImportFilterManager getImportFilterManager()
ImportFilterManagerImportFilterManagerpublic void fillAndWriteMappingTables(JobManager jobManager, OutputStreamWriter dmlResultWriter, int numberOfEntities, Session targetSession, DBMS targetDBMSConfiguration, DBMS dbmsConfiguration) throws SQLException, IOException
SQLExceptionIOExceptionpublic void dropMappingTables(OutputStreamWriter result, DBMS targetDBMSConfiguration) throws IOException, SQLException
IOExceptionSQLExceptionprotected String dmlTableReference(String tableName, Session session) throws SQLException
tableName - the working tablesession - holds connection to DBMSSQLException