DefaultDataDomainFlushAction (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.access.flush, class: DefaultDataDomainFlushAction

# Class DefaultDataDomainFlushAction

java.lang.Object
org.apache.cayenne.access.flush.DefaultDataDomainFlushAction

All Implemented Interfaces:
  `DataDomainFlushAction`

public class DefaultDataDomainFlushAction extends Object implements DataDomainFlushAction
Default implementation of `DataDomainFlushAction`.

Since:
  4.2

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static class`
  `DefaultDataDomainFlushAction.EmptyRowChecker`
  `protected static class`
  `DefaultDataDomainFlushAction.PhantomDbRowOpCleaner`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final DataDomain`
  `dataDomain`
  `protected final DbRowOpSorter`
  `dbRowOpSorter`
  `protected final JdbcEventLogger`
  `jdbcEventLogger`
  `protected final OperationObserver`
  `observer`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `DefaultDataDomainFlushAction(DataDomain dataDomain, DbRowOpSorter dbRowOpSorter, JdbcEventLogger jdbcEventLogger)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected List<DbRowOp>`
  `createDbRowOps(ObjectStore objectStore, ObjectStoreGraphDiff changes)`
  Create ops based on incoming graph changes
  `protected List<? extends Query>`
  `createQueries(List<DbRowOp> dbRowOps)`
  `protected void`
  `createReplacementIds(ObjectStore store, CompoundDiff afterCommitDiff, List<DbRowOp> dbRowOps)`
  Set final `ObjectId` for persistent objects
  `protected void`
  `executeQueries(List<? extends Query> queries)`
  Execute queries, grouping them by nodes
  `protected 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)`
  Notify `ObjectStore` and it's data row cache about actual changes we performed.
  `protected List<DbRowOp>`
  `sort(List<DbRowOp> dbRowOps)`
  Sort all operations
  `protected void`
  `updateObjectIds(Collection<DbRowOp> dbRowOps)`
  Fill in replacement IDs' data for given operations

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### dataDomain

    protected final DataDomain dataDomain

  - ### dbRowOpSorter

    protected final DbRowOpSorter dbRowOpSorter

  - ### jdbcEventLogger

    protected final JdbcEventLogger jdbcEventLogger

  - ### observer

    protected final OperationObserver observer

- ## Constructor Details

  - ### DefaultDataDomainFlushAction

    protected DefaultDataDomainFlushAction(DataDomain dataDomain, DbRowOpSorter dbRowOpSorter, JdbcEventLogger jdbcEventLogger)

- ## Method Details

  - ### flush

    public GraphDiff flush(DataContext context, GraphDiff changes)
    Specified by:
      `flush` in interface `DataDomainFlushAction`

  - ### createDbRowOps

    protected List<DbRowOp> createDbRowOps(ObjectStore objectStore, ObjectStoreGraphDiff changes)
    Create ops based on incoming graph changes
    Parameters:
      `objectStore` - originating object store
      `changes` - 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 of `DbRowOp`

  - ### mergeSameObjectIds

    protected List<DbRowOp> mergeSameObjectIds(List<DbRowOp> dbRowOps)
    Parameters:
      `dbRowOps` - collection of `DbRowOp`
    Returns:
      collection of ops with merged duplicates

  - ### filterOps

    protected List<DbRowOp> filterOps(List<DbRowOp> dbRowOps)

  - ### sort

    protected List<DbRowOp> sort(List<DbRowOp> dbRowOps)
    Sort all operations
    Parameters:
      `dbRowOps` - collection of `DbRowOp`
    Returns:
      sorted collection of operations
    See Also:
      - interface and it's default implementation

  - ### createQueries

    protected List<? extends Query> createQueries(List<DbRowOp> dbRowOps)
    Parameters:
      `dbRowOps` - collection of `DbRowOp`
    Returns:
      collection of `Query` to perform

  - ### 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 final `ObjectId` for persistent objects
    Parameters:
      `store` - object store
      `afterCommitDiff` - result graph diff
      `dbRowOps` - collection of `DbRowOp`

  - ### postprocess

    protected void postprocess(DataContext context, ObjectStoreGraphDiff changes, CompoundDiff afterCommitDiff, List<DbRowOp> dbRowOps)
    Notify `ObjectStore` and it's data row cache about actual changes we performed.
    Parameters:
      `context` - originating context
      `changes` - incoming diff
      `afterCommitDiff` - resulting diff
      `dbRowOps` - collection of `DbRowOp`