/** * Constructs a new LookupKey for the given form using the raw record id. */ LookupKey(int keyIndex, FormClass formClass) { this(keyIndex, null, null, formClass, new SymbolNode(ColumnModel.RECORD_ID_SYMBOL), "ID"); }
public SymbolNotFoundException(SymbolNode symbolNode) { this(symbolNode.getName()); }
public DimensionMapping(ResourceId formId, ResourceId fieldId) { this.formId = formId; this.formula = new SymbolNode(fieldId).asExpression(); this.type = Type.VALUE; }
private static boolean filterContainsPartner(String filter, ResourceId partnerFormId, ResourceId partnerId) { FormulaNode filterFormula = FormulaParser.parse(filter); SymbolNode expectedPartnerForm = new SymbolNode(partnerFormId); ConstantNode expectedPartnerRecord = new ConstantNode(partnerId.asString()); if (!(filterFormula instanceof FunctionCallNode)) { return false; } if (!(((FunctionCallNode) filterFormula).getFunction() instanceof EqualFunction)) { return false; } if (((FunctionCallNode) filterFormula).getArgumentCount() != 2) { return false; } FunctionCallNode equalFunctionCall = (FunctionCallNode) filterFormula; if (!(equalFunctionCall.getArgument(0 ) instanceof SymbolNode)) { return false; } if (!(equalFunctionCall.getArgument(1) instanceof ConstantNode)) { return false; } SymbolNode partnerFormNode = (SymbolNode) equalFunctionCall.getArgument(0); ConstantNode partnerFieldNode = (ConstantNode) equalFunctionCall.getArgument(1); if (!partnerFormNode.equals(expectedPartnerForm)) { return false; } if (!partnerFieldNode.equals(expectedPartnerRecord)) { return false; } return true; }
@Override public String toString() { return asExpression(); } }
private static SimpleCondition parseEnumCondition(CompoundExpr node) { ResourceId fieldId = parseFieldId(node.getValue()); ResourceId enumItem = node.getField().asResourceId(); return new SimpleCondition(fieldId, SimpleOperator.INCLUDES, new EnumValue(enumItem)); }
@Override public String asExpression() { return value.asExpression() + "." + field.asExpression(); }
public ParentKey(LookupKey key, String fieldId) { this(key); this.fieldId = fieldId == null ? null : new SymbolNode(fieldId); }
public QueryPath(SymbolNode expr) { path = Lists.newArrayList(expr.getName()); }
public IdNode(FormClass formClass) { this.formClass = formClass; this.formula = new SymbolNode(ColumnModel.RECORD_ID_SYMBOL); }
public Slot<ForeignKey> addForeignKey(FormulaNode referenceField, ResourceId rightFormId) { if(referenceField instanceof SymbolNode) { return addForeignKey(((SymbolNode) referenceField).getName(), rightFormId); } else { throw new UnsupportedOperationException("TODO: " + referenceField); } }
public static SymbolNode symbol(String name) { return new SymbolNode(name); }
private static ResourceId parseFieldId(FormulaNode argument) { if(argument instanceof SymbolNode) { return ResourceId.valueOf(((SymbolNode) argument).getName()); } throw new IllegalArgumentException("Expected symbol: " + argument); }
public static SymbolNode symbol(ResourceId resourceId) { return new SymbolNode(resourceId); }
public Optional<FormField> tryResolveSymbol(SymbolNode value) { return tryResolveSymbol(value.getName()); } }
public CompoundExpr(@Nonnull ResourceId value, @Nonnull String field) { this.value = new SymbolNode(value); this.field = new SymbolNode(field); }
private String resolveSymbol(SymbolNode symbolNode) throws XSymbolException { return symbolHandler.resolveSymbol(symbolNode.getName()); }
public FormulaNode toExpr() { Iterator<ResourceId> it = path.iterator(); FormulaNode expr = new SymbolNode(it.next()); while(it.hasNext()) { expr = new CompoundExpr(expr, new SymbolNode(it.next())); } return expr; }
public FormField resolveSymbol(SymbolNode symbolNode) { return resolveSymbol(symbolNode.getName()); }
private static FormulaNode toExpr(List<FormTree.Node> partition) { Iterator<FormTree.Node> it = partition.iterator(); FormulaNode expr = new SymbolNode(it.next().getFieldId()); while(it.hasNext()) { expr = new CompoundExpr(expr, new SymbolNode(it.next().getFieldId())); } return expr; }