private Slot<ColumnView> addParentColumn(FilterLevel filterLevel, ResourceId formId) { return getDataColumn(filterLevel, formId, new FieldComponent("@parent")); }
private Slot<ColumnView> addSubFormJoinedColumn(FilterLevel filterLevel, NodeMatch match) { JoinNode node = match.getJoins().get(0); Slot<PrimaryKeyMap> primaryKey = addPrimaryKey(filterLevel, node.getLeftFormId()); Slot<ColumnView> parentColumn = addParentColumn(filterLevel, node.getRightFormId()); Slot<ColumnView> dataColumn = getDataColumn(filterLevel, match.getFormClass().getId(), match.getFieldComponent()); SubFormJoin join = new SubFormJoin(primaryKey, parentColumn); return new JoinedSubFormColumnViewSlot(Collections.singletonList(join), dataColumn, node.getAggregation().or(SumFunction.INSTANCE)); }
switch (match.getType()) { case FIELD: column = getDataColumn(filterLevel, match.getFormClass().getId(), match.getFieldComponent()); break; case RECORD_ID:
/** * Adds a query to the batch for a column derived from a single node within the FormTree, along * with any necessary join structures required to join this column to the base table, if the column * is nested. * * @return a ColumnView Slot that can be used to retrieve the result after the batch * has finished executing. */ public Slot<ColumnView> addColumn(FilterLevel filterLevel, NodeMatch match) { if (match.isJoined()) { // requires join return addJoinedColumn(filterLevel, match); } else { // form label column, id column, simple root column or embedded form switch (match.getType()) { case FORM_NAME: return addConstantColumn(filterLevel, match.getFormClass(), match.getFormClass().getLabel()); case RECORD_ID: return addRecordIdColumn(filterLevel, match.getFormClass().getId()); case FORM_ID: return addConstantColumn(filterLevel, match.getFormClass(), match.getFormClass().getId().asString()); case FIELD: return getDataColumn(filterLevel, match.getFormClass().getId(), match.getFieldComponent()); default: throw new UnsupportedOperationException("Type: " + match.getType()); } } }