Search in sources :

Example 41 with ColumnView

use of org.activityinfo.model.query.ColumnView in project activityinfo by bedatadriven.

the class AdminEntityBinding method extractFieldData.

@Override
public BaseModelData[] extractFieldData(BaseModelData[] dataArray, ColumnSet columnSet) {
    ColumnView adminEntityId = columnSet.getColumnView(ADMIN_ENTITY_ID_COLUMN.asExpression());
    ColumnView adminEntityName = columnSet.getColumnView(ADMIN_ENTITY_NAME_COLUMN.asExpression());
    for (int i = 0; i < columnSet.getNumRows(); i++) {
        if (adminEntityId.isMissing(i)) {
            continue;
        }
        AdminEntityDTO adminEntity = new AdminEntityDTO(adminLevel, CuidAdapter.getLegacyIdFromCuid(adminEntityId.getString(i)), adminEntityName.getString(i));
        adminEntity.setLevelName(adminLevelName);
        if (adminLevelParentId != null) {
            adminEntity.setParentId(CuidAdapter.getLegacyIdFromCuid(adminLevelParentId));
        }
        dataArray[i].set(AdminLevelDTO.getPropertyName(adminEntity.getLevelId()), adminEntity);
    }
    return dataArray;
}
Also used : AdminEntityDTO(org.activityinfo.legacy.shared.model.AdminEntityDTO) ColumnView(org.activityinfo.model.query.ColumnView)

Example 42 with ColumnView

use of org.activityinfo.model.query.ColumnView in project activityinfo by bedatadriven.

the class DateDimBinding method extractCategories.

@Override
public DimensionCategory[] extractCategories(Activity activity, ColumnSet columnSet) {
    ColumnView column = columnSet.getColumnView(DATE_COLUMN_ID);
    DimensionCategory[] c = new DimensionCategory[column.numRows()];
    for (int i = 0; i < column.numRows(); i++) {
        c[i] = categoryOf(column.getString(i));
    }
    return c;
}
Also used : ColumnView(org.activityinfo.model.query.ColumnView)

Example 43 with ColumnView

use of org.activityinfo.model.query.ColumnView in project activityinfo by bedatadriven.

the class DimBinding method extractEntityCategories.

protected final DimensionCategory[] extractEntityCategories(ColumnSet columnSet, String idColumn, String labelColumn) {
    ColumnView id = columnSet.getColumnView(idColumn);
    ColumnView label = columnSet.getColumnView(labelColumn);
    int numRows = columnSet.getNumRows();
    DimensionCategory[] categories = new DimensionCategory[numRows];
    for (int i = 0; i < numRows; i++) {
        categories[i] = extractEntityCategory(id, label, i);
    }
    return categories;
}
Also used : DimensionCategory(org.activityinfo.legacy.shared.reports.content.DimensionCategory) ColumnView(org.activityinfo.model.query.ColumnView)

Example 44 with ColumnView

use of org.activityinfo.model.query.ColumnView in project activityinfo by bedatadriven.

the class PartnerDimBinding method extractFieldData.

@Override
public BaseModelData[] extractFieldData(BaseModelData[] dataArray, ColumnSet columnSet) {
    ColumnView id = columnSet.getColumnView(PARTNER_ID_COLUMN);
    ColumnView label = columnSet.getColumnView(PARTNER_LABEL_COLUMN);
    for (int i = 0; i < columnSet.getNumRows(); i++) {
        String partnerId = id.getString(i);
        String partnerLabel = label.getString(i);
        if (partnerId != null && !Strings.isNullOrEmpty(partnerLabel)) {
            PartnerDTO partner = new PartnerDTO(CuidAdapter.getLegacyIdFromCuid(partnerId), partnerLabel);
            dataArray[i].set(PARTNER_FIELD, partner);
        }
    }
    return dataArray;
}
Also used : PartnerDTO(org.activityinfo.legacy.shared.model.PartnerDTO) ColumnView(org.activityinfo.model.query.ColumnView)

Example 45 with ColumnView

use of org.activityinfo.model.query.ColumnView in project activityinfo by bedatadriven.

the class GenericLocationFieldBinding method extractFieldData.

@Override
public BaseModelData[] extractFieldData(BaseModelData[] dataArray, ColumnSet columnSet) {
    ColumnView id = columnSet.getColumnView(LOCATION_ID_COLUMN);
    ColumnView name = columnSet.getColumnView(LOCATION_NAME_COLUMN);
    ColumnView code = columnSet.getColumnView(LOCATION_CODE_COLUMN);
    for (int i = 0; i < columnSet.getNumRows(); i++) {
        String idVal = id.getString(i);
        dataArray[i].set(LOCATION_ID_COLUMN, CuidAdapter.getLegacyIdFromCuid(idVal));
        dataArray[i].set(LOCATION_NAME_COLUMN, name.getString(i));
        dataArray[i].set(LOCATION_CODE_COLUMN, code.getString(i));
    }
    return dataArray;
}
Also used : ColumnView(org.activityinfo.model.query.ColumnView)

Aggregations

ColumnView (org.activityinfo.model.query.ColumnView)67 ColumnSet (org.activityinfo.model.query.ColumnSet)22 Test (org.junit.Test)22 QueryModel (org.activityinfo.model.query.QueryModel)21 ColumnSetBuilder (org.activityinfo.store.query.server.ColumnSetBuilder)8 ResourceId (org.activityinfo.model.resource.ResourceId)7 NullFormSupervisor (org.activityinfo.store.query.shared.NullFormSupervisor)7 DoubleArrayColumnView (org.activityinfo.model.query.DoubleArrayColumnView)6 NullFormScanCache (org.activityinfo.store.query.shared.NullFormScanCache)6 DimensionCategory (org.activityinfo.legacy.shared.reports.content.DimensionCategory)5 FormClass (org.activityinfo.model.form.FormClass)5 FormTree (org.activityinfo.model.formTree.FormTree)5 FormulaNode (org.activityinfo.model.formula.FormulaNode)4 Nullable (javax.annotation.Nullable)3 FormulaSyntaxException (org.activityinfo.model.formula.diagnostic.FormulaSyntaxException)3 ColumnModel (org.activityinfo.model.query.ColumnModel)3 RecordRef (org.activityinfo.model.type.RecordRef)3 PrintWriter (java.io.PrintWriter)2 HashSet (java.util.HashSet)2 EntityCategory (org.activityinfo.legacy.shared.reports.content.EntityCategory)2