use of org.activityinfo.shared.command.GetDimensionLabels.DimensionLabels in project activityinfo by bedatadriven.
the class BaseGenerator method generateFilterDescriptions.
protected List<FilterDescription> generateFilterDescriptions(Filter filter, Set<DimensionType> excludeDims, User user) {
List<FilterDescription> list = new ArrayList<FilterDescription>();
Set<DimensionType> filterDims = filter.getRestrictedDimensions();
filterDims.removeAll(excludeDims);
for (DimensionType type : filterDims) {
DimensionLabels labels = dispatcher.execute(new GetDimensionLabels(type, filter.getRestrictions(type)));
list.add(new FilterDescription(type, labels.getLabels()));
}
return list;
}
use of org.activityinfo.shared.command.GetDimensionLabels.DimensionLabels in project activityinfo by bedatadriven.
the class GetDimensionLabelsHandler method execute.
@Override
public void execute(GetDimensionLabels command, ExecutionContext context, final AsyncCallback<DimensionLabels> callback) {
SqlQuery query = composeQuery(command);
query.execute(context.getTransaction(), new SqlResultCallback() {
@Override
public void onSuccess(SqlTransaction tx, SqlResultSet results) {
Map<Integer, String> labels = Maps.newHashMap();
for (SqlResultSetRow row : results.getRows()) {
labels.put(row.getInt("id"), row.getString("name"));
}
callback.onSuccess(new DimensionLabels(labels));
}
});
}
Aggregations