Interface DataChannelQueryFilter

  • All Known Subinterfaces:
    DataChannelFilter
    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 DataChannelQueryFilter
    An interface of a filter that allows to intercept DataChannel query operations. Query filters allow to implement chains of custom processors around a DataChannel.

    Example:

    
     public class MyQueryFilter implements DataChannelQueryFilter {
         public QueryResponse onQuery(ObjectContext originatingContext, Query query,
                                      DataChannelQueryFilterChain filterChain) {
             System.out.println("Do something before query");
             // process query or return some custom response
             QueryResponse response = filterChain.onQuery(originatingContext, query);
             System.out.println("Do something after query");
             return response;
         }
     }
    Since:
    4.1
    See Also:
    DataChannelSyncFilter, ServerModule.contributeDomainQueryFilters(org.apache.cayenne.di.Binder)
    • Method Detail

      • onQuery

        QueryResponse onQuery​(ObjectContext originatingContext,
                              Query query,
                              DataChannelQueryFilterChain filterChain)
        Parameters:
        originatingContext - originating context of query
        query - that is processed
        filterChain - chain of query filters to invoke after this filter
        Returns:
        query response