Search in sources :

Example 1 with BatchingFormTreeBuilder

use of org.activityinfo.store.spi.BatchingFormTreeBuilder in project activityinfo by bedatadriven.

the class PivotAdapter method queryFormTrees.

private Map<ResourceId, FormTree> queryFormTrees() {
    treeTime.start();
    Set<ResourceId> formIds = new HashSet<>();
    for (Activity activity : activities) {
        formIds.add(activity.getLeafFormClassId());
        if (command.getValueType() == PivotSites.ValueType.TOTAL_SITES) {
            formIds.add(activity.getSiteFormClassId());
        }
        for (LinkedActivity linkedActivity : activity.getLinkedActivities()) {
            formIds.add(linkedActivity.getLeafFormClassId());
            if (command.getValueType() == PivotSites.ValueType.TOTAL_SITES) {
                formIds.add(activity.getSiteFormClassId());
            }
        }
    }
    BatchingFormTreeBuilder formTreeBuilder = new BatchingFormTreeBuilder(catalog);
    Map<ResourceId, FormTree> trees = formTreeBuilder.queryTrees(formIds);
    treeTime.stop();
    return trees;
}
Also used : LinkedActivity(org.activityinfo.store.mysql.metadata.LinkedActivity) FormTree(org.activityinfo.model.formTree.FormTree) ResourceId(org.activityinfo.model.resource.ResourceId) Activity(org.activityinfo.store.mysql.metadata.Activity) LinkedActivity(org.activityinfo.store.mysql.metadata.LinkedActivity) BatchingFormTreeBuilder(org.activityinfo.store.spi.BatchingFormTreeBuilder)

Example 2 with BatchingFormTreeBuilder

use of org.activityinfo.store.spi.BatchingFormTreeBuilder in project activityinfo by bedatadriven.

the class GetSitesHandler method initialiseHandler.

private void initialiseHandler(GetSites command, User user) {
    catalog = catalogProvider.get();
    if (catalog != null) {
        this.command = command;
        builder = new ColumnSetBuilder(catalog, new AppEngineFormScanCache(), new FormSupervisorAdapter(catalog, user.getId()));
        linkedBuilder = new ColumnSetBuilder(catalog, new AppEngineFormScanCache(), new NullFormSupervisor());
        batchFormTreeBuilder = new BatchingFormTreeBuilder(catalog);
        batch = builder.createNewBatch();
        linkedBatch = linkedBuilder.createNewBatch();
        selfLinkedActivities = Maps.newHashMap();
        sortInfo = command.getSortInfo();
        offset = command.getOffset();
        limit = command.getLimit();
        totalResultLength = 0;
    } else {
        throw new CommandException("Could not retrieve form catalog");
    }
}
Also used : ColumnSetBuilder(org.activityinfo.store.query.server.ColumnSetBuilder) AppEngineFormScanCache(org.activityinfo.store.hrd.AppEngineFormScanCache) FormSupervisorAdapter(org.activityinfo.store.query.server.FormSupervisorAdapter) NullFormSupervisor(org.activityinfo.store.query.shared.NullFormSupervisor) CommandException(org.activityinfo.legacy.shared.exception.CommandException) BatchingFormTreeBuilder(org.activityinfo.store.spi.BatchingFormTreeBuilder)

Aggregations

BatchingFormTreeBuilder (org.activityinfo.store.spi.BatchingFormTreeBuilder)2 CommandException (org.activityinfo.legacy.shared.exception.CommandException)1 FormTree (org.activityinfo.model.formTree.FormTree)1 ResourceId (org.activityinfo.model.resource.ResourceId)1 AppEngineFormScanCache (org.activityinfo.store.hrd.AppEngineFormScanCache)1 Activity (org.activityinfo.store.mysql.metadata.Activity)1 LinkedActivity (org.activityinfo.store.mysql.metadata.LinkedActivity)1 ColumnSetBuilder (org.activityinfo.store.query.server.ColumnSetBuilder)1 FormSupervisorAdapter (org.activityinfo.store.query.server.FormSupervisorAdapter)1 NullFormSupervisor (org.activityinfo.store.query.shared.NullFormSupervisor)1