use of org.activityinfo.store.mysql.metadata.CountryInstance in project activityinfo by bedatadriven.
the class GetSitesHandler method buildLocationQuery.
private QueryModel buildLocationQuery(QueryModel query, FormTree formTree, FormClass form) {
Optional<FormField> potentialLocationField = form.getFieldIfPresent(CuidAdapter.field(form.getId(), CuidAdapter.LOCATION_FIELD));
if (potentialLocationField.isPresent()) {
FormField locationField = potentialLocationField.get();
// Location binding will take care of the details wrt geo fields/admin field
addBinding(new LocationFieldBinding(locationField), query, formTree);
} else {
// country form, get country instance from ActivityLoader
CountryInstance country = getCountryInstance(form.getId());
if (country != null) {
addBinding(new CountryFieldBinding(country), query, formTree);
}
}
return query;
}
Aggregations