Search in sources :

Example 6 with PatternFilter

use of org.apache.cayenne.dbsync.reverse.filters.PatternFilter in project cayenne by apache.

the class DbRelationshipDictionary method filter.

/**
 * @since 4.1
 */
private Collection<DbRelationship> filter() {
    if (filtersConfig == null) {
        return container.getRelationships();
    }
    Collection<DbRelationship> existingFiltered = new LinkedList<>();
    TableFilter tableFilter = filtersConfig.tableFilter(container.getCatalog(), container.getSchema());
    if (tableFilter != null && tableFilter.isIncludeTable(container.getName())) {
        PatternFilter patternFilter = tableFilter.getIncludeTableColumnFilter(container.getName());
        for (DbRelationship rel : container.getRelationships()) {
            if (patternFilter.isIncluded(rel.getName())) {
                existingFiltered.add(rel);
            }
        }
    }
    return existingFiltered;
}
Also used : PatternFilter(org.apache.cayenne.dbsync.reverse.filters.PatternFilter) TableFilter(org.apache.cayenne.dbsync.reverse.filters.TableFilter) DbRelationship(org.apache.cayenne.map.DbRelationship) LinkedList(java.util.LinkedList)

Aggregations

PatternFilter (org.apache.cayenne.dbsync.reverse.filters.PatternFilter)6 TableFilter (org.apache.cayenne.dbsync.reverse.filters.TableFilter)3 TreeSet (java.util.TreeSet)2 Pattern (java.util.regex.Pattern)2 FiltersConfig (org.apache.cayenne.dbsync.reverse.filters.FiltersConfig)2 IncludeTableFilter (org.apache.cayenne.dbsync.reverse.filters.IncludeTableFilter)2 Procedure (org.apache.cayenne.map.Procedure)2 Logger (org.slf4j.Logger)2 LinkedList (java.util.LinkedList)1 DbAttribute (org.apache.cayenne.map.DbAttribute)1 DbEntity (org.apache.cayenne.map.DbEntity)1 DbRelationship (org.apache.cayenne.map.DbRelationship)1 Test (org.junit.Test)1