Search in sources :

Example 1 with EntityReplacementVisitor

use of eu.esdihumboldt.hale.common.filter.internal.EntityReplacementVisitor in project hale by halestudio.

the class AbstractGeotoolsFilter method migrateFilter.

@Override
public Optional<eu.esdihumboldt.hale.common.instance.model.Filter> migrateFilter(EntityDefinition context, AlignmentMigration migration, SimpleLog log) {
    EntityReplacementVisitor visitor = new EntityReplacementVisitor(migration, name -> resolveProperty(name, context, log), log);
    Object extraData = null;
    Filter copy = (Filter) internFilter.accept(visitor, extraData);
    try {
        String filterString = toFilterTerm(copy);
        return Optional.of(buildFilter(filterString));
    } catch (CQLException e) {
        log.error("Filter could not be automatically migrated", e);
        return Optional.empty();
    }
}
Also used : EntityReplacementVisitor(eu.esdihumboldt.hale.common.filter.internal.EntityReplacementVisitor) Filter(org.opengis.filter.Filter) EntityAwareFilter(eu.esdihumboldt.hale.common.align.instance.EntityAwareFilter) CQLException(org.geotools.filter.text.cql2.CQLException)

Aggregations

EntityAwareFilter (eu.esdihumboldt.hale.common.align.instance.EntityAwareFilter)1 EntityReplacementVisitor (eu.esdihumboldt.hale.common.filter.internal.EntityReplacementVisitor)1 CQLException (org.geotools.filter.text.cql2.CQLException)1 Filter (org.opengis.filter.Filter)1