Search in sources :

Example 6 with FieldType

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;
}
Also used : CalculatedFieldType(org.activityinfo.model.type.expr.CalculatedFieldType) QuantityType(org.activityinfo.model.type.number.QuantityType) ActivityField(org.activityinfo.store.mysql.metadata.ActivityField) FieldType(org.activityinfo.model.type.FieldType) CalculatedFieldType(org.activityinfo.model.type.expr.CalculatedFieldType)

Aggregations

FieldType (org.activityinfo.model.type.FieldType)6 QuantityType (org.activityinfo.model.type.number.QuantityType)4 CalculatedFieldType (org.activityinfo.model.type.expr.CalculatedFieldType)3 NarrativeType (org.activityinfo.model.type.NarrativeType)2 EnumType (org.activityinfo.model.type.enumerated.EnumType)2 BooleanType (org.activityinfo.model.type.primitive.BooleanType)2 TextType (org.activityinfo.model.type.primitive.TextType)2 LocalDateType (org.activityinfo.model.type.time.LocalDateType)2 ArgumentException (org.activityinfo.model.formula.diagnostic.ArgumentException)1 ReferenceType (org.activityinfo.model.type.ReferenceType)1 SerialNumberType (org.activityinfo.model.type.SerialNumberType)1 AttachmentType (org.activityinfo.model.type.attachment.AttachmentType)1 BarcodeType (org.activityinfo.model.type.barcode.BarcodeType)1 GeoPointType (org.activityinfo.model.type.geo.GeoPointType)1 LocalDateIntervalType (org.activityinfo.model.type.time.LocalDateIntervalType)1 ActivityField (org.activityinfo.store.mysql.metadata.ActivityField)1 AttachmentUploadFieldWidget (org.activityinfo.ui.client.component.form.field.attachment.AttachmentUploadFieldWidget)1 ImageUploadFieldWidget (org.activityinfo.ui.client.component.form.field.attachment.ImageUploadFieldWidget)1 HSSFRow (org.apache.poi.hssf.usermodel.HSSFRow)1