Search in sources :

Example 6 with ColumnModel

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

the class DefaultQueryBuilder method build.

public QueryModel build() {
    LOGGER.info("No query fields provided, querying all.");
    addFields("", new FieldPath(), tree.getRootFields());
    this.queryModel = new QueryModel(tree.getRootFormId());
    this.queryModel.selectResourceId().as("@id");
    for (ColumnModel columnModel : columns.values()) {
        this.queryModel.addColumn(columnModel);
    }
    return queryModel;
}
Also used : FieldPath(org.activityinfo.model.formTree.FieldPath) ColumnModel(org.activityinfo.model.query.ColumnModel) QueryModel(org.activityinfo.model.query.QueryModel)

Example 7 with ColumnModel

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

the class GeoPointFormat method getColumnModels.

@Override
public List<ColumnModel> getColumnModels() {
    ColumnModel latitudeModel = new ColumnModel();
    latitudeModel.setId(getLatitudeId());
    latitudeModel.setFormula(new CompoundExpr(formula, new SymbolNode("latitude")));
    ColumnModel longitudeModel = new ColumnModel();
    longitudeModel.setId(getLongitudeId());
    longitudeModel.setFormula(new CompoundExpr(formula, new SymbolNode("longitude")));
    return Arrays.asList(latitudeModel, longitudeModel);
}
Also used : CompoundExpr(org.activityinfo.model.formula.CompoundExpr) SymbolNode(org.activityinfo.model.formula.SymbolNode) ColumnModel(org.activityinfo.model.query.ColumnModel)

Example 8 with ColumnModel

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

the class MultiEnumFormat method getColumnModels.

@Override
public List<ColumnModel> getColumnModels() {
    List<ColumnModel> columns = new ArrayList<>();
    for (EnumItem enumItem : enumType.getValues()) {
        ColumnModel model = new ColumnModel();
        model.setId(getItemId(enumItem));
        model.setFormula(new CompoundExpr(formula, new SymbolNode(enumItem.getId())));
        columns.add(model);
    }
    return columns;
}
Also used : CompoundExpr(org.activityinfo.model.formula.CompoundExpr) SymbolNode(org.activityinfo.model.formula.SymbolNode) ArrayList(java.util.ArrayList) ColumnModel(org.activityinfo.model.query.ColumnModel) EnumItem(org.activityinfo.model.type.enumerated.EnumItem)

Example 9 with ColumnModel

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

the class SimpleColumnFormat method getColumnModels.

@Override
public final List<ColumnModel> getColumnModels() {
    ColumnModel columnModel = new ColumnModel();
    columnModel.setId(id);
    columnModel.setFormula(formula);
    return Collections.singletonList(columnModel);
}
Also used : ColumnModel(org.activityinfo.model.query.ColumnModel)

Example 10 with ColumnModel

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

the class AdminDimBinding method getColumnQuery.

@Override
public List<ColumnModel> getColumnQuery(FormTree formTree) {
    ResourceId levelClassId = adminLevelFormClass(model.getLevelId());
    Optional<FormClass> adminClass = formTree.getFormClassIfPresent(levelClassId);
    if (adminClass.isPresent()) {
        ColumnModel id = new ColumnModel();
        id.setFormula(new CompoundExpr(levelClassId, ColumnModel.ID_SYMBOL));
        id.setId(idColumn);
        ColumnModel label = new ColumnModel();
        label.setFormula(new FieldPath(levelClassId, field(levelClassId, NAME_FIELD)));
        label.setId(labelColumn);
        return Arrays.asList(id, label);
    } else {
        return Collections.emptyList();
    }
}
Also used : CompoundExpr(org.activityinfo.model.formula.CompoundExpr) ResourceId(org.activityinfo.model.resource.ResourceId) FormClass(org.activityinfo.model.form.FormClass) FieldPath(org.activityinfo.model.formTree.FieldPath) ColumnModel(org.activityinfo.model.query.ColumnModel)

Aggregations

ColumnModel (org.activityinfo.model.query.ColumnModel)16 CompoundExpr (org.activityinfo.model.formula.CompoundExpr)6 QueryModel (org.activityinfo.model.query.QueryModel)6 FieldPath (org.activityinfo.model.formTree.FieldPath)5 SymbolNode (org.activityinfo.model.formula.SymbolNode)5 Nullable (javax.annotation.Nullable)4 DimensionCategory (org.activityinfo.legacy.shared.reports.content.DimensionCategory)4 ColumnSet (org.activityinfo.model.query.ColumnSet)4 FormTree (org.activityinfo.model.formTree.FormTree)3 ColumnView (org.activityinfo.model.query.ColumnView)2 ResourceId (org.activityinfo.model.resource.ResourceId)2 EnumItem (org.activityinfo.model.type.enumerated.EnumItem)2 ActivityField (org.activityinfo.store.mysql.metadata.ActivityField)2 ArrayList (java.util.ArrayList)1 FormClass (org.activityinfo.model.form.FormClass)1 EnumType (org.activityinfo.model.type.enumerated.EnumType)1 QueryFilter (org.activityinfo.server.command.QueryFilter)1 Activity (org.activityinfo.store.mysql.metadata.Activity)1 LinkedActivity (org.activityinfo.store.mysql.metadata.LinkedActivity)1