use of org.activityinfo.model.form.CatalogEntry in project activityinfo by bedatadriven.
the class GeodbFolder method queryCountryForms.
private List<CatalogEntry> queryCountryForms(String countryId) throws SQLException {
List<CatalogEntry> entries = new ArrayList<>();
// Query Admin Levels
try (ResultSet rs = executor.query("SELECT adminlevelid, name FROM adminlevel WHERE countryId IN " + " (SELECT countryId FROM country WHERE iso2 = ?) ", countryId)) {
while (rs.next()) {
String formId = CuidAdapter.adminLevelFormClass(rs.getInt(1)).asString();
String label = rs.getString(2);
entries.add(new CatalogEntry(formId, label, CatalogEntryType.FORM));
}
}
// Query Location Types
try (ResultSet rs = executor.query("SELECT locationTypeId, name FROM locationtype WHERE " + "boundAdminLevelId IS NULL AND " + "databaseId IS NULL AND " + "countryId IN (SELECT countryId FROM country WHERE iso2 = ?) ", countryId)) {
while (rs.next()) {
String formId = CuidAdapter.locationFormClass(rs.getInt(1)).asString();
String label = rs.getString(2);
entries.add(new CatalogEntry(formId, label, CatalogEntryType.FORM));
}
}
return entries;
}
use of org.activityinfo.model.form.CatalogEntry in project activityinfo by bedatadriven.
the class CatalogView method openTable.
private void openTable(SelectEvent event) {
if (treeView.getSelectedEntry().isLoaded() && treeView.getSelectedEntry().get().isPresent()) {
CatalogEntry catalogEntry = treeView.getSelectedEntry().get().get();
if (catalogEntry.getType() == CatalogEntryType.FORM) {
String url = Window.Location.createUrlBuilder().setHash("table/" + catalogEntry.getId()).buildString();
Window.open(url, null, null);
} else if (catalogEntry.getType() == CatalogEntryType.ANALYSIS) {
String url = Window.Location.createUrlBuilder().setHash("analysis/" + catalogEntry.getId()).buildString();
Window.open(url, null, null);
}
}
}
Aggregations