Package org.apache.cayenne.access.flush
Class DefaultDataDomainFlushAction
- java.lang.Object
-
- org.apache.cayenne.access.flush.DefaultDataDomainFlushAction
-
- All Implemented Interfaces:
DataDomainFlushAction
public class DefaultDataDomainFlushAction extends Object implements DataDomainFlushAction
Default implementation ofDataDomainFlushAction
.- Since:
- 4.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DefaultDataDomainFlushAction.PhantomDbRowOpCleaner
-
Field Summary
Fields Modifier and Type Field Description protected DataDomain
dataDomain
protected DbRowOpSorter
dbRowOpSorter
protected JdbcEventLogger
jdbcEventLogger
protected OperationObserver
observer
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultDataDomainFlushAction(DataDomain dataDomain, DbRowOpSorter dbRowOpSorter, JdbcEventLogger jdbcEventLogger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<DbRowOp>
createDbRowOps(ObjectStore objectStore, ObjectStoreGraphDiff changes)
Create ops based on incoming graph changesprotected List<? extends Query>
createQueries(List<DbRowOp> dbRowOps)
protected void
createReplacementIds(ObjectStore store, CompoundDiff afterCommitDiff, List<DbRowOp> dbRowOps)
Set finalObjectId
for persistent objectsprotected void
executeQueries(List<? extends Query> queries)
Execute queries, grouping them by nodesprotected List<DbRowOp>
filterOps(List<DbRowOp> dbRowOps)
GraphDiff
flush(DataContext context, GraphDiff changes)
protected List<DbRowOp>
mergeSameObjectIds(List<DbRowOp> dbRowOps)
protected void
postprocess(DataContext context, ObjectStoreGraphDiff changes, CompoundDiff afterCommitDiff, List<DbRowOp> dbRowOps)
NotifyObjectStore
and it's data row cache about actual changes we performed.protected List<DbRowOp>
sort(List<DbRowOp> dbRowOps)
Sort all operationsprotected void
updateObjectIds(Collection<DbRowOp> dbRowOps)
Fill in replacement IDs' data for given operations
-
-
-
Field Detail
-
dataDomain
protected final DataDomain dataDomain
-
dbRowOpSorter
protected final DbRowOpSorter dbRowOpSorter
-
jdbcEventLogger
protected final JdbcEventLogger jdbcEventLogger
-
observer
protected final OperationObserver observer
-
-
Constructor Detail
-
DefaultDataDomainFlushAction
protected DefaultDataDomainFlushAction(DataDomain dataDomain, DbRowOpSorter dbRowOpSorter, JdbcEventLogger jdbcEventLogger)
-
-
Method Detail
-
flush
public GraphDiff flush(DataContext context, GraphDiff changes)
- Specified by:
flush
in interfaceDataDomainFlushAction
-
createDbRowOps
protected List<DbRowOp> createDbRowOps(ObjectStore objectStore, ObjectStoreGraphDiff changes)
Create ops based on incoming graph changes- Parameters:
objectStore
- originating object storechanges
- object graph diff- Returns:
- collection of
DbRowOp
-
updateObjectIds
protected void updateObjectIds(Collection<DbRowOp> dbRowOps)
Fill in replacement IDs' data for given operations- Parameters:
dbRowOps
- collection ofDbRowOp
-
mergeSameObjectIds
protected List<DbRowOp> mergeSameObjectIds(List<DbRowOp> dbRowOps)
- Parameters:
dbRowOps
- collection ofDbRowOp
- Returns:
- collection of ops with merged duplicates
-
sort
protected List<DbRowOp> sort(List<DbRowOp> dbRowOps)
Sort all operations- Parameters:
dbRowOps
- collection ofDbRowOp
- Returns:
- sorted collection of operations
- See Also:
interface and it's default implementation
-
executeQueries
protected void executeQueries(List<? extends Query> queries)
Execute queries, grouping them by nodes- Parameters:
queries
- to execute
-
createReplacementIds
protected void createReplacementIds(ObjectStore store, CompoundDiff afterCommitDiff, List<DbRowOp> dbRowOps)
Set finalObjectId
for persistent objects- Parameters:
store
- object storeafterCommitDiff
- result graph diffdbRowOps
- collection ofDbRowOp
-
postprocess
protected void postprocess(DataContext context, ObjectStoreGraphDiff changes, CompoundDiff afterCommitDiff, List<DbRowOp> dbRowOps)
NotifyObjectStore
and it's data row cache about actual changes we performed.- Parameters:
context
- originating contextchanges
- incoming diffafterCommitDiff
- resulting diffdbRowOps
- collection ofDbRowOp
-
-