use of org.activityinfo.model.type.FieldType in project activityinfo by bedatadriven.
the class PivotAdapter method selectedIndicators.
private List<ActivityField> selectedIndicators(Activity activity) {
if (filter.isRestricted(DimensionType.Activity)) {
if (!filter.getRestrictions(DimensionType.Activity).contains(activity.getId())) {
return Collections.emptyList();
}
}
if (filter.isRestricted(DimensionType.Database)) {
if (!filter.getRestrictions(DimensionType.Database).contains(activity.getDatabaseId())) {
return Collections.emptyList();
}
}
List<ActivityField> matching = Lists.newArrayList();
Set<Integer> restrictedIndicatorIds = filter.getRestrictions(DimensionType.Indicator);
for (ActivityField field : activity.getIndicatorFields()) {
FieldType type = field.getFormField().getType();
if (type instanceof QuantityType || type instanceof CalculatedFieldType) {
if (restrictedIndicatorIds.isEmpty() || restrictedIndicatorIds.contains(field.getId())) {
matching.add(field);
}
}
}
return matching;
}
Aggregations