public class RemoteEntityGraph extends EntityGraph
| Modifier and Type | Field and Description |
|---|---|
protected int |
birthdayOfSubject
Birthday of subject rows.
|
protected RowIdSupport |
rowIdSupport
|
Session |
session
For executing SQL-Statements.
|
protected PrimaryKey |
universalPrimaryKey
The universal primary key.
|
dataModel, DEPENDENCY, ENTITY, ENTITY_GRAPH, ENTITY_SET_ELEMENT, executionContext, explainIdOfAssociation, graphID, importFilterManager, inDeleteMode, maxTotalRowcount| Modifier | Constructor and Description |
|---|---|
protected |
RemoteEntityGraph(DataModel dataModel,
int graphID,
Session session,
PrimaryKey universalPrimaryKey,
ExecutionContext executionContext)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDependencies(Table from,
String fromAlias,
Table to,
String toAlias,
String condition,
int aggregationId,
int dependencyId,
boolean isAssociationReversed)
Adds dependencies.
|
long |
addEntities(Table table,
String condition,
int today)
Adds entities to the graph.
|
void |
close()
Closes the graph.
|
EntityGraph |
copy(int newGraphID,
Session session)
Copies an entity-graph.
|
long |
countEntities(Table table)
Counts the entities of a given table in this graph.
|
static RemoteEntityGraph |
create(DataModel dataModel,
int graphID,
Session session,
PrimaryKey universalPrimaryKey,
ExecutionContext executionContext)
Creates a new entity-graph.
|
void |
delete()
Deletes the graph.
|
long |
deleteEntities(Table table)
Deletes all entities from a given table.
|
void |
deleteIndependentEntities(Table table)
Deletes all entities which are marked as independent.
|
protected String |
filteredSelectionClause(Table table,
boolean appylImportFilter)
Gets select clause for reading rows of given type
with respect of the column filters.
|
protected String |
filteredSelectionClause(Table table,
String columnPrefix,
Quoting quoting,
boolean appylImportFilter)
Gets select clause for reading rows of given type
with respect of the column filters.
|
EntityGraph |
find(int graphID,
Session session,
PrimaryKey universalPrimaryKey)
Finds an entity-graph.
|
int |
getAge()
Gets the age of the graph.
|
DataModel |
getDatamodel() |
Set<Integer> |
getDistinctDependencyIDs()
Gets distinct association-ids of all edged.
|
Session |
getSession()
Gets the session.
|
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.
|
Session |
getTargetSession() |
long |
getTotalRowcount()
Gets total row-count.
|
PrimaryKey |
getUniversalPrimaryKey()
Gets the universal primary key.
|
protected static void |
init(int graphID,
Session session,
ExecutionContext executionContext)
Initializes a new entity-graph.
|
void |
markDependentEntitiesAsTraversed(Association association,
ResultSet resultSet,
ResultSetMetaData resultSetMetaData,
Map<String,Integer> typeCache)
Marks all entities which depends on given entity as traversed.
|
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.
|
void |
markRoots(Table table)
Marks all rows which are not target of a dependency.
|
protected String |
pkEqualsEntityID(Table table,
String tableAlias,
String entityAlias)
Gets a SQL comparition expression for comparing rows with entities.
|
protected String |
prefixColumnName(String prefix,
Quoting quoting,
Column column)
Adds a prefix to a column name.
|
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.
|
void |
readEntities(Table table,
boolean orderByPK)
Reads all entities of a given table.
|
protected long |
readEntities(Table table,
boolean orderByPK,
Session.ResultSetReader reader)
Reads all entities of a given table.
|
void |
readMarkedEntities(Table table,
boolean orderByPK)
Reads all entities of a given table which are marked as independent or as roots.
|
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.
|
void |
readNonTraversedDependencies(Table table,
Session.ResultSetReader reader)
Reads all non-traversed dependencies.
|
long |
readUnfilteredEntityColumns(Table table,
List<Column> columns,
Session.ResultSetReader reader)
Reads some columns of all entities of a given table without using filters.
|
long |
removeAssociatedDestinations(Association association,
boolean deletedEntitiesAreMarked)
Removes all entities from this graph which are associated with an entity
outside the graph.
|
void |
removeReflexiveDependencies(Table table)
Removes all reflexive dependencies of given table.
|
long |
resolveAssociation(Table table,
Association association,
int today)
Resolves an association.
|
void |
setAge(int age)
Sets the age of the graph.
|
void |
setBirthdayOfSubject(int birthdayOfSubject)
Sets birthday of subject rows.
|
void |
setExplain(boolean explain)
Whether or not to store additional information in order to create a 'explain.log'.
|
void |
shutDown()
Shuts down statement-executor.
|
void |
uniteWith(EntityGraph graph)
Unites the graph with another one and deletes the other graph.
|
void |
updateEntities(Table table,
Set<Column> columns,
OutputStreamWriter scriptFileWriter,
DBMS targetConfiguration)
Updates columns of a table.
|
createUniqueGraphID, dmlTableReference, dropMappingTables, fillAndWriteMappingTables, getImportFilterManager, getTransformerFactory, incLobCount, removeDependencies, setDeleteMode, setImportFilterManager, setTransformerFactory, typeNamepublic final Session session
protected final PrimaryKey universalPrimaryKey
protected int birthdayOfSubject
protected final RowIdSupport rowIdSupport
protected RemoteEntityGraph(DataModel dataModel, int graphID, Session session, PrimaryKey universalPrimaryKey, ExecutionContext executionContext) throws SQLException
graphID - the unique ID of the graphsession - for executing SQL-StatementsuniversalPrimaryKey - the universal primary keySQLExceptionpublic void setBirthdayOfSubject(int birthdayOfSubject)
setBirthdayOfSubject in class EntityGraphbirthdayOfSubject - birthday of subject rowspublic static RemoteEntityGraph create(DataModel dataModel, int graphID, Session session, PrimaryKey universalPrimaryKey, ExecutionContext executionContext) throws SQLException
graphID - the unique ID of the graphsession - for executing SQL-StatementsuniversalPrimaryKey - the universal primary keySQLExceptionprotected static void init(int graphID,
Session session,
ExecutionContext executionContext)
graphID - the unique ID of the graphsession - for executing SQL-Statementspublic EntityGraph copy(int newGraphID, Session session) throws SQLException
copy in class EntityGraphnewGraphID - the unique ID of the new graphsession - for executing SQL-StatementsSQLExceptionpublic EntityGraph find(int graphID, Session session, PrimaryKey universalPrimaryKey) throws SQLException
find in class EntityGraphgraphID - the unique ID of the graphuniversalPrimaryKey - the universal primary keysession - for executing SQL-StatementsSQLExceptionpublic int getAge()
throws SQLException
getAge in class EntityGraphSQLExceptionpublic void setAge(int age)
throws SQLException
setAge in class EntityGraphage - the age of the graphSQLExceptionpublic long getSize()
throws SQLException
getSize in class EntityGraphSQLExceptionpublic long getSize(Set<Table> tables) throws SQLException
getSize in class EntityGraphSQLExceptionpublic void delete()
throws SQLException
delete in class EntityGraphSQLExceptionpublic long addEntities(Table table, String condition, int today) throws SQLException
addEntities in class EntityGraphtable - the tablecondition - the condition in SQL that the entities must fulfilltoday - the birthday of the new entitiesSQLExceptionpublic long resolveAssociation(Table table, Association association, int today) throws SQLException
resolveAssociation in class EntityGraphtable - the tableassociation - the association to resolvetoday - the birthday of the new entitiesSQLExceptionpublic void addDependencies(Table from, String fromAlias, Table to, String toAlias, String condition, int aggregationId, int dependencyId, boolean isAssociationReversed) throws SQLException
addDependencies in class EntityGraphfrom - 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 Set<Integer> getDistinctDependencyIDs() throws SQLException
getDistinctDependencyIDs in class EntityGraphSQLExceptionpublic void markIndependentEntities(Table table) throws SQLException
markIndependentEntities in class EntityGraphSQLExceptionpublic void markRoots(Table table) throws SQLException
markRoots in class EntityGraphSQLExceptionpublic void readMarkedEntities(Table table, boolean orderByPK) throws SQLException
readMarkedEntities in class EntityGraphtable - the tableorderByPK - if true, result will be ordered by primary keysSQLExceptionpublic void readMarkedEntities(Table table, Session.ResultSetReader reader, String selectionSchema, String originalPKAliasPrefix, boolean orderByPK) throws SQLException
readMarkedEntities in class EntityGraphreader - for reading the result-settable - the tableorderByPK - if true, result will be ordered by primary keysSQLExceptionpublic void uniteWith(EntityGraph graph) throws SQLException
uniteWith in class EntityGraphgraph - the graph to be united with this graphSQLExceptionpublic void readEntities(Table table, boolean orderByPK) throws SQLException
readEntities in class EntityGraphtable - the tableorderByPK - if true, result will be ordered by primary keysSQLExceptionpublic long readUnfilteredEntityColumns(Table table, List<Column> columns, Session.ResultSetReader reader) throws SQLException
readUnfilteredEntityColumns in class EntityGraphtable - the tablecolumns - the columnsreader - to readSQLExceptionprotected long readEntities(Table table, boolean orderByPK, Session.ResultSetReader reader) throws SQLException
table - the tableorderByPK - if true, result will be ordered by primary keysSQLExceptionpublic void updateEntities(Table table, Set<Column> columns, OutputStreamWriter scriptFileWriter, DBMS targetConfiguration) throws SQLException
updateEntities in class EntityGraphtable - the tablecolumns - the columns;SQLExceptionprotected String filteredSelectionClause(Table table, boolean appylImportFilter)
table - the table to read rows fromprotected String filteredSelectionClause(Table table, String columnPrefix, Quoting quoting, boolean appylImportFilter)
table - the table to read rows fromcolumnPrefix - optional prefix for aliasesquoting - for unquoting of column names if columnPrefix is givenprotected String prefixColumnName(String prefix, Quoting quoting, Column column)
public void deleteIndependentEntities(Table table) throws SQLException
deleteIndependentEntities in class EntityGraphSQLExceptionpublic long deleteEntities(Table table) throws SQLException
deleteEntities in class EntityGraphSQLExceptionpublic long countEntities(Table table) throws SQLException
countEntities in class EntityGraphtable - the tableSQLExceptionpublic long removeAssociatedDestinations(Association association, boolean deletedEntitiesAreMarked) throws SQLException
removeAssociatedDestinations in class EntityGraphdeletedEntitiesAreMarked - if true, consider entity as deleted if its birthday is negativeassociation - the associationSQLExceptionpublic void readDependentEntities(Table table, Association association, ResultSet resultSet, ResultSetMetaData resultSetMetaData, Session.ResultSetReader reader, Map<String,Integer> typeCache, String selectionSchema, String originalPKAliasPrefix) throws SQLException
readDependentEntities in class EntityGraphtable - the table from which to read entitiesassociation - the dependencyresultSet - current row is given entityreader - reads the entitiesselectionSchema - the selection schemaSQLExceptionpublic void markDependentEntitiesAsTraversed(Association association, ResultSet resultSet, ResultSetMetaData resultSetMetaData, Map<String,Integer> typeCache) throws SQLException
markDependentEntitiesAsTraversed in class EntityGraphtable - the table from which to read entitiesassociation - the dependencyresultSet - current row is given entitySQLExceptionpublic void readNonTraversedDependencies(Table table, Session.ResultSetReader reader) throws SQLException
readNonTraversedDependencies in class EntityGraphtable - the source of dependencies to look forreader - reads the entitiesSQLExceptionpublic void removeReflexiveDependencies(Table table) throws SQLException
removeReflexiveDependencies in class EntityGraphtable - the tableSQLExceptionprotected String pkEqualsEntityID(Table table, String tableAlias, String entityAlias)
table - the tabletable with entitiespublic long getTotalRowcount()
getTotalRowcount in class EntityGraphpublic void setExplain(boolean explain)
setExplain in class EntityGraphexplain - true iff predecessors of each entity must be storedpublic PrimaryKey getUniversalPrimaryKey()
getUniversalPrimaryKey in class EntityGraphpublic void shutDown()
throws SQLException
shutDown in class EntityGraphSQLExceptionpublic Session getSession()
EntityGraphgetSession in class EntityGraphpublic DataModel getDatamodel()
getDatamodel in class EntityGraphpublic void close()
throws SQLException
EntityGraphclose in class EntityGraphSQLExceptionpublic Session getTargetSession()
getTargetSession in class EntityGraph