PathogenGeographyMapFilter.java
/*
* Copyright 2026 Global Crop Diversity Trust
* Licensed under the Apache License, Version 2.0
* See LICENSE file in project root folder or http://www.apache.org/licenses/LICENSE-2.0
*/
package org.gringlobal.service.filter;
import java.util.List;
import org.genesys.blocks.model.filters.StringFilter;
import org.gringlobal.model.community.PathogenGeographyMap;
import org.gringlobal.model.community.QPathogenGeographyMap;
import com.querydsl.core.types.Predicate;
/**
* Filters for {@link PathogenGeographyMap}
*/
public class PathogenGeographyMapFilter extends CooperatorOwnedModelFilter<PathogenGeographyMapFilter, PathogenGeographyMap, QPathogenGeographyMap> {
private static final long serialVersionUID = -1234567890123456789L;
/** The pathogen. */
public PathogenFilter pathogen;
/** The geography. */
public GeographyFilter geography;
/** Is on the quarantine list in this country? */
public Boolean isQuarantine;
/** The note. */
public StringFilter note;
@Override
public List<Predicate> collectPredicates() {
return collectPredicates(QPathogenGeographyMap.pathogenGeographyMap);
}
/**
* Builds the query.
*
* @param pathogenGeographyMap the pathogen geography map
* @return the predicate list
*/
public List<Predicate> collectPredicates(QPathogenGeographyMap pathogenGeographyMap) {
final List<Predicate> predicates = super.collectSuperPredicates(pathogenGeographyMap, pathogenGeographyMap._super);
if (pathogen != null) {
predicates.add(pathogen.nestedPredicate(pathogenGeographyMap.pathogen()));
}
if (geography != null) {
predicates.add(geography.nestedPredicate(pathogenGeographyMap.geography()));
}
if (isQuarantine != null) {
predicates.add(pathogenGeographyMap.isQuarantine.eq(convertToString(isQuarantine)));
}
if (note != null) {
predicates.add(note.buildQuery(pathogenGeographyMap.note));
}
return predicates;
}
}