# Interface DataChannelSyncFilter

All Known Implementing Classes:
  `CommitLogFilter, TransactionFilter`

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface DataChannelSyncFilter
An interface of a filter that allows to intercept DataChannel sync operations. Sync filters allow to implement chains of custom processors around a DataChannel.

Example:

    public class MySyncFilter implements DataChannelSyncFilter {
        public GraphDiff onSync(ObjectContext originatingContext,
                                GraphDiff changes,
                                int syncType,
                                DataChannelSyncFilterChain filterChain) {
            System.out.println("Do something before sync");
            // process changes or return some custom diff
            GraphDiff diff = filterChain.onSync(originatingContext, changes, syncType);
            System.out.println("Do something after sync");
            return diff;
        }
    }

Since:
  4.1
See Also:
  - `DataChannelQueryFilter`
  - `CoreModuleExtender.addSyncFilter(Class, boolean)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `GraphDiff`
  `onSync(ObjectContext originatingContext, GraphDiff changes, int syncType, DataChannelSyncFilterChain filterChain)`

- ## Method Details

  - ### onSync

    GraphDiff onSync(ObjectContext originatingContext, GraphDiff changes, int syncType, DataChannelSyncFilterChain filterChain)
    Parameters:
      `originatingContext` - originating context of changes
      `changes` - diff that is being processed
      `syncType` - type of sync; possible values: `DataChannel.FLUSH_NOCASCADE_SYNC`, `DataChannel.FLUSH_CASCADE_SYNC`, `DataChannel.ROLLBACK_CASCADE_SYNC`
      `filterChain` - chain of sync filters to invoke after this filter
    Returns:
      final context diff
    See Also:
      - `DataChannel.FLUSH_NOCASCADE_SYNC`
      - `DataChannel.FLUSH_CASCADE_SYNC`
      - `DataChannel.ROLLBACK_CASCADE_SYNC`