class UserAndGroupsTasksPreprocessor extends UserTasksPreprocessor {

    @SuppressWarnings("rawtypes")
    @Override
    public void preprocess(DataSetLookup lookup) {
        if (identityProvider == null || userGroupCallback == null) {
            return;
        }

        ColumnFilter columnFilter;
        List<Comparable> orgEntities = new ArrayList<>();

        if (lookup.getFirstFilterOp() != null) {
            List<String> potOwners = new ArrayList<String>();
            List<CoreFunctionFilter> columnFilters = extractCoreFunctionFilter(lookup.getFirstFilterOp().getColumnFilterList());
            Iterator<CoreFunctionFilter> it = columnFilters.iterator();
            while (orgEntities.isEmpty() && it.hasNext()) {
                CoreFunctionFilter column = it.next();

                if (column.getColumnId().toUpperCase().equals(columnId)) {
                    potOwners.addAll(column.getParameters());

                    for (String potOwner : potOwners) {
                        addUserAndGroupsFromIdentityProvider(orgEntities, potOwner);
                    }

                    //  we have now a tree as expression. we need to traverse the entire tree for finding the filter.
                    removeCoreFunctionFilter(lookup.getFirstFilterOp().getColumnFilterList(), column);
                }

            }


            if (orgEntities.isEmpty()) {
                addUserAndGroupsFromIdentityProvider(orgEntities, identityProvider.getName());
            }

            columnFilter = AND(in(COLUMN_POTOWNER, orgEntities));
            lookup.getFirstFilterOp().addFilterColumn(columnFilter);
        } else {
            DataSetFilter filter = new DataSetFilter();
            addUserAndGroupsFromIdentityProvider(orgEntities, identityProvider.getName());

            columnFilter = AND(in(COLUMN_POTOWNER, orgEntities));
            filter.addFilterColumn(columnFilter);
            lookup.addOperation(filter);
        }

        LOGGER.debug("Adding column filter: {}", columnFilter);

        super.preprocess(lookup);
    }

    public  UserAndGroupsTasksPreprocessor(IdentityProvider identityProvider, UserGroupCallback userGroupCallback, 
                                          String columnId, DataSetMetadata metadata);

}