public abstract class EntityGraph
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
DataModel |
dataModel |
static java.lang.String |
DEPENDENCY
Name of the dependency-table.
|
static java.lang.String |
ENTITY
Name of the entity-table.
|
static java.lang.String |
ENTITY_GRAPH
Name of the graph-table.
|
static java.lang.String |
ENTITY_SET_ELEMENT
Name of the (helper) set-table.
|
protected ExecutionContext |
executionContext
The execution context.
|
int |
graphID
The unique ID of the graph.
|
protected ImportFilterManager |
importFilterManager
The
ImportFilterManager . |
protected boolean |
inDeleteMode |
protected boolean |
isTruncated |
Modifier | Constructor and Description |
---|---|
protected |
EntityGraph(int graphID,
DataModel dataModel,
ExecutionContext executionContext) |
Modifier and Type | Method and Description |
---|---|
abstract 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.
|
abstract long |
addEntities(Table table,
java.lang.String condition,
int today)
Adds entities to the graph.
|
abstract long |
addEntities(Table table,
java.lang.String condition,
int today,
SubjectLimitDefinition limitDefinition,
boolean joinWithEntity)
Adds limited number of entities to the graph.
|
protected void |
addExportedCount(long count) |
void |
checkExist(ExecutionContext executionContext)
Check if the graph still exists.
|
abstract void |
close()
Closes the graph.
|
abstract EntityGraph |
copy(int graphID,
Session session)
Copies an entity-graph.
|
EntityGraph |
copy(java.util.Set<Table> tables)
Copies some tables.
|
abstract long |
countEntities(Table table)
Counts the entities of a given table in this graph.
|
abstract EntityGraph |
createNewGraph()
Creates a new entity-graph of same type and session.
|
static int |
createUniqueGraphID()
Creates a unique ID for a new graph.
|
void |
delete()
Deletes the graph.
|
abstract void |
delete(boolean forced)
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 long |
deleteRows(Session session,
java.lang.String table,
java.lang.String where)
Deletes rows from table.
|
protected java.lang.String |
dmlTableReference(java.lang.String tableName,
Session session)
Gets table reference for DML statements for a given working table.
|
void |
dropMappingTables(java.io.OutputStreamWriter result,
DBMS targetDBMSConfiguration)
Creates the DROP-statements for the mapping tables.
|
void |
fillAndWriteMappingTables(JobManager jobManager,
java.io.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 int |
getAge()
Gets the age of the graph.
|
abstract DataModel |
getDatamodel() |
abstract java.util.Set<java.lang.Integer> |
getDistinctDependencyIDs()
Gets distinct association-ids of all edged.
|
long |
getExportedCount() |
ImportFilterManager |
getImportFilterManager()
Gets the
ImportFilterManager |
protected java.util.List<Column> |
getSelectionClause(Table table)
Gets all non-virtual columns of the table in the order in which they are selected.
|
abstract Session |
getSession()
Gets the session.
|
abstract 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.
|
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,
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.
|
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,
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.
|
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,
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.
|
abstract void |
readNonTraversedDependencies(Table table,
Session.ResultSetReader reader)
Reads all non-traversed dependencies.
|
abstract 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.
|
abstract 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 |
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,
EntityGraph otherGraph,
EntityGraph universum,
boolean forDelete)
Resolves an association.
|
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) |
void |
setImportFilterManager(ImportFilterManager importFilterManager)
Sets the
ImportFilterManager |
void |
setTransformerFactory(TransformerFactory transformerFactory)
Sets the
TransformerFactory . |
abstract void |
shutDown()
Shuts down statement-executor.
|
void |
truncate(ExecutionContext executionContext,
boolean checkExist)
Tries to delete this graph using "truncate".
|
protected int |
typeName(Table table) |
abstract 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.
|
public static final java.lang.String ENTITY_GRAPH
public static final java.lang.String ENTITY_SET_ELEMENT
public static final java.lang.String ENTITY
public static final java.lang.String DEPENDENCY
public final DataModel dataModel
protected boolean isTruncated
protected final ExecutionContext executionContext
protected boolean inDeleteMode
public final int graphID
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 java.sql.SQLException
graphID
- the unique ID of the graphsession
- for executing SQL-Statementsjava.sql.SQLException
public abstract EntityGraph createNewGraph() throws java.sql.SQLException
java.sql.SQLException
public EntityGraph copy(java.util.Set<Table> tables) throws java.sql.SQLException
tables
- tables to copyjava.sql.SQLException
public abstract int getAge() throws java.sql.SQLException
java.sql.SQLException
public abstract void setAge(int age) throws java.sql.SQLException
age
- the age of the graphjava.sql.SQLException
public abstract long getSize() throws java.sql.SQLException
java.sql.SQLException
public long getSize(java.util.Set<Table> tables) throws java.sql.SQLException
java.sql.SQLException
public final void delete() throws java.sql.SQLException
java.sql.SQLException
public abstract void delete(boolean forced)
forced
- force deletion. if true
, don't allow optimization.public abstract long addEntities(Table table, java.lang.String condition, int today) throws java.sql.SQLException
table
- the tablecondition
- the condition in SQL that the entities must fulfilltoday
- the birthday of the new entitiesjava.sql.SQLException
public abstract long addEntities(Table table, java.lang.String condition, int today, SubjectLimitDefinition limitDefinition, boolean joinWithEntity) throws java.sql.SQLException
table
- the tablecondition
- the condition in SQL that the entities must fulfilltoday
- the birthday of the new entitieslimitDefinition
- limitjava.sql.SQLException
public abstract long resolveAssociation(Table table, Association association, int today) throws java.sql.SQLException
table
- the tableassociation
- the association to resolvetoday
- the birthday of the new entitiesjava.sql.SQLException
public abstract long resolveAssociation(Table table, Association association, EntityGraph otherGraph, EntityGraph universum, boolean forDelete) throws java.sql.SQLException
table
- the tableassociation
- the association to resolvejava.sql.SQLException
public abstract 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
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 abstract java.util.Set<java.lang.Integer> getDistinctDependencyIDs() throws java.sql.SQLException
java.sql.SQLException
public abstract void markIndependentEntities(Table table) throws java.sql.SQLException
java.sql.SQLException
public abstract void markRoots(Table table) throws java.sql.SQLException
java.sql.SQLException
public abstract void readMarkedEntities(Table table, boolean orderByPK) throws java.sql.SQLException
table
- the tableorderByPK
- if true
, result will be ordered by primary keysjava.sql.SQLException
public abstract void readMarkedEntities(Table table, Session.ResultSetReader reader, java.lang.String selectionSchema, java.lang.String originalPKAliasPrefix, boolean orderByPK) throws java.sql.SQLException
reader
- for reading the result-settable
- the tableorderByPK
- if true
, result will be ordered by primary keysjava.sql.SQLException
public abstract void readEntities(Table table, boolean orderByPK) throws java.sql.SQLException
table
- the tableorderByPK
- if true
, result will be ordered by primary keysjava.sql.SQLException
public abstract 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
table
- the tablecolumns
- the columns;inSourceSchema
- if true
, use source-schema-mapping, else use schema-mappingreason
- to be written as commentjava.sql.SQLException
public abstract long readUnfilteredEntityColumns(Table table, java.util.List<Column> columns, Session.ResultSetReader reader) throws java.sql.SQLException
table
- the tablecolumns
- the columnsreader
- to readjava.sql.SQLException
public abstract void deleteIndependentEntities(Table table) throws java.sql.SQLException
java.sql.SQLException
public abstract long deleteEntities(Table table) throws java.sql.SQLException
java.sql.SQLException
public abstract long countEntities(Table table) throws java.sql.SQLException
table
- the tablejava.sql.SQLException
public abstract long removeAssociatedDestinations(Association association, boolean deletedEntitiesAreMarked, java.util.Set<Table> allTables) throws java.sql.SQLException
association
- the associationdeletedEntitiesAreMarked
- if true, consider entity as deleted if its birthday is negativeallTables
- set of tables from which there are entities in Ejava.sql.SQLException
public abstract 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
table
- the table from which to read entitiesassociation
- the dependencyresultSet
- current row is given entityreader
- reads the entitiesselectionSchema
- the selection schemajava.sql.SQLException
public abstract 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
association
- the dependencyresultSet
- current row is given entityjava.sql.SQLException
public abstract void readNonTraversedDependencies(Table table, Session.ResultSetReader reader) throws java.sql.SQLException
table
- the source of dependencies to look forreader
- reads the entitiesjava.sql.SQLException
public abstract void removeReflexiveDependencies(Table table) throws java.sql.SQLException
table
- the tablejava.sql.SQLException
public abstract long getTotalRowcount()
public abstract PrimaryKey getUniversalPrimaryKey()
public abstract void shutDown() throws java.sql.SQLException
java.sql.SQLException
public abstract Session getSession()
public static int createUniqueGraphID()
public int incLobCount()
public abstract DataModel getDatamodel()
public abstract void close() throws java.sql.SQLException
java.sql.SQLException
public void removeDependencies(Association association) throws java.sql.SQLException
association
- the asociationjava.sql.SQLException
public 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)
ImportFilterManager
importFilterManager
- the ImportFilterManager
public ImportFilterManager getImportFilterManager()
ImportFilterManager
ImportFilterManager
public void fillAndWriteMappingTables(JobManager jobManager, java.io.OutputStreamWriter dmlResultWriter, int numberOfEntities, Session targetSession, DBMS targetDBMSConfiguration, DBMS dbmsConfiguration) throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public void dropMappingTables(java.io.OutputStreamWriter result, DBMS targetDBMSConfiguration) throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
protected java.lang.String dmlTableReference(java.lang.String tableName, Session session) throws java.sql.SQLException
tableName
- the working tablesession
- holds connection to DBMSjava.sql.SQLException
protected long deleteRows(Session session, java.lang.String table, java.lang.String where) throws java.sql.SQLException
session
- the sessiontable
- the tablewhere
- the "where" conditionjava.sql.SQLException
public void truncate(ExecutionContext executionContext, boolean checkExist) throws java.sql.SQLException
checkExist
- if true
, checks existence of each graphjava.sql.SQLException
public void checkExist(ExecutionContext executionContext) throws java.sql.SQLException
java.sql.SQLException
protected void addExportedCount(long count)
public long getExportedCount()
protected java.util.List<Column> getSelectionClause(Table table)
java.lang.Exception
- if selection clause is empty