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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations