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, graphID, importFilterManager, inDeleteMode, isTruncated
Modifier | Constructor and Description |
---|---|
protected |
RemoteEntityGraph(DataModel dataModel,
int graphID,
Session session,
PrimaryKey universalPrimaryKey,
java.lang.Runnable updateStatistics,
ExecutionContext executionContext)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addDependencies(Table from,
java.lang.String fromAlias,
Table to,
java.lang.String toAlias,
java.lang.String condition,
int aggregationId,
int dependencyId,
boolean isAssociationReversed)
Adds dependencies.
|
long |
addEntities(Table table,
java.lang.String condition,
int today)
Adds entities to the graph.
|
long |
addEntities(Table table,
java.lang.String condition,
int today,
SubjectLimitDefinition limitDefinition,
boolean joinWithEntity)
Adds limited number of 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,
java.lang.Runnable updateStatistics,
ExecutionContext executionContext)
Creates a new entity-graph.
|
EntityGraph |
createNewGraph()
Creates a new entity-graph of same type and session.
|
void |
delete(boolean force)
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 java.lang.String |
filteredSelectionClause(Table table,
boolean appylImportFilter)
Gets select clause for reading rows of given type
with respect of the column filters.
|
protected java.lang.String |
filteredSelectionClause(Table table,
java.lang.String columnPrefix,
Quoting quoting,
boolean appylImportFilter)
Gets select clause for reading rows of given type
with respect of the column filters.
|
int |
getAge()
Gets the age of the graph.
|
DataModel |
getDatamodel() |
java.util.Set<java.lang.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(java.util.Set<Table> tables)
Gets the number of entities from 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,
java.sql.ResultSet resultSet,
java.sql.ResultSetMetaData resultSetMetaData,
java.util.Map<java.lang.String,java.lang.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 java.lang.String |
pkEqualsEntityID(Table table,
java.lang.String tableAlias,
java.lang.String entityAlias)
Gets a SQL comparition expression for comparing rows with entities.
|
protected java.lang.String |
prefixColumnName(java.lang.String prefix,
Quoting quoting,
Column column)
Adds a prefix to a column name.
|
void |
readDependentEntities(Table table,
Association association,
java.sql.ResultSet resultSet,
java.sql.ResultSetMetaData resultSetMetaData,
Session.ResultSetReader reader,
java.util.Map<java.lang.String,java.lang.Integer> typeCache,
java.lang.String selectionSchema,
java.lang.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,
java.lang.String selectionSchema,
java.lang.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,
java.util.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,
java.util.Set<Table> allTables)
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,
EntityGraph otherGraph,
EntityGraph universum,
boolean forDelete)
Resolves an association.
|
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 |
shutDown()
Shuts down statement-executor.
|
void |
updateEntities(Table table,
java.util.Set<Column> columns,
java.io.OutputStreamWriter scriptFileWriter,
DBMS targetConfiguration,
boolean inSourceSchema,
java.lang.String reason)
Updates columns of a table.
|
addExportedCount, checkExist, copy, createUniqueGraphID, delete, deleteRows, dmlTableReference, dropMappingTables, fillAndWriteMappingTables, getExportedCount, getImportFilterManager, getSelectionClause, getTransformerFactory, incLobCount, removeDependencies, setDeleteMode, setImportFilterManager, setTransformerFactory, truncate, typeName
public final Session session
protected final PrimaryKey universalPrimaryKey
protected int birthdayOfSubject
protected final RowIdSupport rowIdSupport
protected RemoteEntityGraph(DataModel dataModel, int graphID, Session session, PrimaryKey universalPrimaryKey, java.lang.Runnable updateStatistics, ExecutionContext executionContext) throws java.sql.SQLException
graphID
- the unique ID of the graphsession
- for executing SQL-StatementsuniversalPrimaryKey
- the universal primary keyjava.sql.SQLException
public void setBirthdayOfSubject(int birthdayOfSubject)
setBirthdayOfSubject
in class EntityGraph
birthdayOfSubject
- birthday of subject rowspublic static RemoteEntityGraph create(DataModel dataModel, int graphID, Session session, PrimaryKey universalPrimaryKey, java.lang.Runnable updateStatistics, ExecutionContext executionContext) throws java.sql.SQLException
graphID
- the unique ID of the graphsession
- for executing SQL-StatementsuniversalPrimaryKey
- the universal primary keyjava.sql.SQLException
protected 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 java.sql.SQLException
copy
in class EntityGraph
newGraphID
- the unique ID of the new graphsession
- for executing SQL-Statementsjava.sql.SQLException
public EntityGraph createNewGraph() throws java.sql.SQLException
createNewGraph
in class EntityGraph
java.sql.SQLException
public int getAge() throws java.sql.SQLException
getAge
in class EntityGraph
java.sql.SQLException
public void setAge(int age) throws java.sql.SQLException
setAge
in class EntityGraph
age
- the age of the graphjava.sql.SQLException
public long getSize() throws java.sql.SQLException
getSize
in class EntityGraph
java.sql.SQLException
public long getSize(java.util.Set<Table> tables) throws java.sql.SQLException
getSize
in class EntityGraph
java.sql.SQLException
public void delete(boolean force)
delete
in class EntityGraph
force
- force deletion. if true
, don't allow optimization.public long addEntities(Table table, java.lang.String condition, int today) throws java.sql.SQLException
addEntities
in class EntityGraph
table
- the tablecondition
- the condition in SQL that the entities must fulfilltoday
- the birthday of the new entitiesjava.sql.SQLException
public long addEntities(Table table, java.lang.String condition, int today, SubjectLimitDefinition limitDefinition, boolean joinWithEntity) throws java.sql.SQLException
addEntities
in class EntityGraph
table
- the tablecondition
- the condition in SQL that the entities must fulfilltoday
- the birthday of the new entitieslimitDefinition
- limitjava.sql.SQLException
public long resolveAssociation(Table table, Association association, int today) throws java.sql.SQLException
resolveAssociation
in class EntityGraph
table
- the tableassociation
- the association to resolvetoday
- the birthday of the new entitiesjava.sql.SQLException
public long resolveAssociation(Table table, Association association, EntityGraph otherGraph, EntityGraph universum, boolean forDelete) throws java.sql.SQLException
resolveAssociation
in class EntityGraph
table
- the tableassociation
- the association to resolvejava.sql.SQLException
public void addDependencies(Table from, java.lang.String fromAlias, Table to, java.lang.String toAlias, java.lang.String condition, int aggregationId, int dependencyId, boolean isAssociationReversed) throws java.sql.SQLException
addDependencies
in class EntityGraph
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 dependencyjava.sql.SQLException
public java.util.Set<java.lang.Integer> getDistinctDependencyIDs() throws java.sql.SQLException
getDistinctDependencyIDs
in class EntityGraph
java.sql.SQLException
public void markIndependentEntities(Table table) throws java.sql.SQLException
markIndependentEntities
in class EntityGraph
java.sql.SQLException
public void markRoots(Table table) throws java.sql.SQLException
markRoots
in class EntityGraph
java.sql.SQLException
public void readMarkedEntities(Table table, boolean orderByPK) throws java.sql.SQLException
readMarkedEntities
in class EntityGraph
table
- the tableorderByPK
- if true
, result will be ordered by primary keysjava.sql.SQLException
public void readMarkedEntities(Table table, Session.ResultSetReader reader, java.lang.String selectionSchema, java.lang.String originalPKAliasPrefix, boolean orderByPK) throws java.sql.SQLException
readMarkedEntities
in class EntityGraph
reader
- for reading the result-settable
- the tableorderByPK
- if true
, result will be ordered by primary keysjava.sql.SQLException
public void readEntities(Table table, boolean orderByPK) throws java.sql.SQLException
readEntities
in class EntityGraph
table
- the tableorderByPK
- if true
, result will be ordered by primary keysjava.sql.SQLException
public long readUnfilteredEntityColumns(Table table, java.util.List<Column> columns, Session.ResultSetReader reader) throws java.sql.SQLException
readUnfilteredEntityColumns
in class EntityGraph
table
- the tablecolumns
- the columnsreader
- to readjava.sql.SQLException
protected long readEntities(Table table, boolean orderByPK, Session.ResultSetReader reader) throws java.sql.SQLException
table
- the tableorderByPK
- if true
, result will be ordered by primary keysjava.sql.SQLException
public void updateEntities(Table table, java.util.Set<Column> columns, java.io.OutputStreamWriter scriptFileWriter, DBMS targetConfiguration, boolean inSourceSchema, java.lang.String reason) throws java.sql.SQLException
updateEntities
in class EntityGraph
table
- the tablecolumns
- the columns;inSourceSchema
- if true
, use source-schema-mapping, else use schema-mappingreason
- to be written as commentjava.sql.SQLException
protected java.lang.String filteredSelectionClause(Table table, boolean appylImportFilter)
table
- the table to read rows fromprotected java.lang.String filteredSelectionClause(Table table, java.lang.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 java.lang.String prefixColumnName(java.lang.String prefix, Quoting quoting, Column column)
public void deleteIndependentEntities(Table table) throws java.sql.SQLException
deleteIndependentEntities
in class EntityGraph
java.sql.SQLException
public long deleteEntities(Table table) throws java.sql.SQLException
deleteEntities
in class EntityGraph
java.sql.SQLException
public long countEntities(Table table) throws java.sql.SQLException
countEntities
in class EntityGraph
table
- the tablejava.sql.SQLException
public long removeAssociatedDestinations(Association association, boolean deletedEntitiesAreMarked, java.util.Set<Table> allTables) throws java.sql.SQLException
removeAssociatedDestinations
in class EntityGraph
deletedEntitiesAreMarked
- if true, consider entity as deleted if its birthday is negativeallTables
- set of tables from which there are entities in Eassociation
- the associationjava.sql.SQLException
public void readDependentEntities(Table table, Association association, java.sql.ResultSet resultSet, java.sql.ResultSetMetaData resultSetMetaData, Session.ResultSetReader reader, java.util.Map<java.lang.String,java.lang.Integer> typeCache, java.lang.String selectionSchema, java.lang.String originalPKAliasPrefix) throws java.sql.SQLException
readDependentEntities
in class EntityGraph
table
- the table from which to read entitiesassociation
- the dependencyresultSet
- current row is given entityreader
- reads the entitiesselectionSchema
- the selection schemajava.sql.SQLException
public void markDependentEntitiesAsTraversed(Association association, java.sql.ResultSet resultSet, java.sql.ResultSetMetaData resultSetMetaData, java.util.Map<java.lang.String,java.lang.Integer> typeCache) throws java.sql.SQLException
markDependentEntitiesAsTraversed
in class EntityGraph
association
- the dependencyresultSet
- current row is given entityjava.sql.SQLException
public void readNonTraversedDependencies(Table table, Session.ResultSetReader reader) throws java.sql.SQLException
readNonTraversedDependencies
in class EntityGraph
table
- the source of dependencies to look forreader
- reads the entitiesjava.sql.SQLException
public void removeReflexiveDependencies(Table table) throws java.sql.SQLException
removeReflexiveDependencies
in class EntityGraph
table
- the tablejava.sql.SQLException
protected java.lang.String pkEqualsEntityID(Table table, java.lang.String tableAlias, java.lang.String entityAlias)
table
- the tabletable
with entitiespublic long getTotalRowcount()
getTotalRowcount
in class EntityGraph
public PrimaryKey getUniversalPrimaryKey()
getUniversalPrimaryKey
in class EntityGraph
public void shutDown() throws java.sql.SQLException
shutDown
in class EntityGraph
java.sql.SQLException
public Session getSession()
EntityGraph
getSession
in class EntityGraph
public DataModel getDatamodel()
getDatamodel
in class EntityGraph
public void close() throws java.sql.SQLException
EntityGraph
close
in class EntityGraph
java.sql.SQLException
public Session getTargetSession()
getTargetSession
in class EntityGraph