ExpressionItem convertToExpressionItem(List<RuleLine> ruleLines, int index) throws IllegalStateException { if (ruleLines != null && ruleLines.size() > index) { ExpressionRuleLine expressionRuleLine = (ExpressionRuleLine) ruleLines.get(index); if (expressionRuleLine != null) { ExpressionItem expressionItem = expressionRuleLine.toExpressionItem(); if (index == ruleLines.size() - 1) { return expressionItem; } else { return new BinaryExpression(expressionItem, convertToExpressionItem(ruleLines, ++index), OperatorKind.AND); } } } LoggerFactory.getLogger(ElementAttributeComparisonConditionRuleLine.class).warn("Element instance not found for" + this.toString()); return null; } }
private void addSimpleConditionsFromComplexExpressions(ExpressionItem expressionItem, Collection<BinaryExpression> simpleConditionsExpressionItems) { if (expressionItem instanceof BinaryExpression) { addSimpleConditionsFromExpressionItems(expressionItem, simpleConditionsExpressionItems); } else if (expressionItem instanceof Variable) { Variable variable = (Variable) expressionItem; simpleConditionsExpressionItems.add(new BinaryExpression(variable, new ConstantExpression("null"), OperatorKind.INEQUAL)); } }
private void addSimpleConditionsFromComplexExpressions(String guideId, ExpressionItem expressionItem, GraphNode graphNode) throws InternalErrorException { if (expressionItem instanceof BinaryExpression) { addExpressionNodes(guideId, expressionItem, graphNode); } else if (expressionItem instanceof Variable) { Variable variable = (Variable) expressionItem; BinaryExpression binaryExpression = new BinaryExpression(variable, new ConstantExpression("null"), OperatorKind.INEQUAL); addExpressionToNode(guideId, binaryExpression, graphNode); } }
public ExpressionItem toExpressionItem() { return new BinaryExpression( convertToExpressionItem(getLeftRuleLineBranch().getChildrenRuleLines().getRuleLines(), 0), convertToExpressionItem(getRightRuleLineBranch().getChildrenRuleLines().getRuleLines(), 0), OperatorKind.OR); }
public ExpressionItem toExpressionItem() throws IllegalStateException { ArchetypeElementVO archetypeElementVO = getArchetypeElement(); if (archetypeElementVO != null) { String path = archetypeElementVO.getPath(); OperatorKind operatorKind = getExistenceOperatorRuleLineElement().getOperator(); if (operatorKind == null) { throw new IllegalStateException("No operator set"); } String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); return new BinaryExpression( new Variable(null, name, path), new ConstantExpression(NULL_STR), operatorKind); } else { throw new IllegalStateException("Element instance not found for" + this.toString()); } }
public ExpressionItem toExpressionItem() throws IllegalStateException { if (archetypeElementAttributeRuleLineElement != null && getArchetypeElementAttributeRuleLineElement().getValue() != null) { String gtCode = getArchetypeElementAttributeRuleLineElement().getValue().getValue().getValue(); ExpressionRuleLineElement expressionRuleLineElement = getExpressionRuleLineElement(); OperatorKind operatorKind = getComparisonOperatorRuleLineElement().getValue(); if (operatorKind == null) { throw new IllegalStateException("No operator kind set"); } Variable var = new Variable(gtCode, null, null, getArchetypeElementAttributeRuleLineElement().getAttribute()); if (expressionRuleLineElement.getValue() == null) { throw new IllegalStateException("No expression set"); } return new BinaryExpression( var, expressionRuleLineElement.getValue(), operatorKind); } else { throw new IllegalStateException("Element instance not found for" + this.toString()); } }
public ExpressionItem toExpressionItem() throws IllegalStateException { ArchetypeElementVO archetypeElementVO = getArchetypeElementRuleLineElement().getArchetypeElementVO(); if (archetypeElementVO != null) { String gtCode = getArchetypeElementRuleLineElement().getValue().getValue(); OperatorKind operatorKind = getExistenceOperatorRuleLineElement().getOperator(); if (operatorKind == null) { log.debug("No operator set"); return null; } String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); return new BinaryExpression( new Variable(gtCode, null, name), new ConstantExpression(NULL_STR), operatorKind); } else { log.debug("Element instance not found for" + this.toString()); return null; } } }
public ExpressionItem toExpressionItem() throws IllegalStateException { ArchetypeElementVO archetypeElementVO = getArchetypeElementRuleLineElement().getArchetypeElementVO(); if (archetypeElementVO != null) { String gtCode = getArchetypeElementRuleLineElement().getValue().getValue(); DataValue dataValue = getArchetypeDataValueRuleLineElement().getValue(); ConstantExpression constantExpression; if (dataValue != null) { constantExpression = DVUtil.convertToExpression(dataValue); } else { log.debug("No data value set"); return null; } OperatorKind operatorKind = getComparisonOperatorRuleLineElement().getValue(); if (operatorKind == null) { log.debug("No operator set"); return null; } String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); return new BinaryExpression( new Variable(gtCode, null, name), constantExpression, operatorKind); } else { log.debug("Element instance not found for " + this.toString()); return null; } }
@Override public ExpressionItem toExpressionItem() { ArchetypeElementVO archetypeElementVO = getArchetypeElementRuleLineDefinitionElement().getValue(); String path = archetypeElementVO.getPath(); DataValue dataValue = getDataValueRuleLineElement().getValue(); OperatorKind operatorKind = getComparisonOperatorRuleLineElement().getValue(); ConstantExpression constantExpression; if (dataValue != null) { constantExpression = DVUtil.convertToExpression(dataValue); } else { throw new IllegalStateException("No data value set"); } String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); return new BinaryExpression( new Variable(null, name, path), constantExpression, operatorKind); }
public ExpressionItem toExpressionItem() throws IllegalStateException { ArchetypeElementVO archetypeElementVO = getArchetypeElementRuleLineElement().getArchetypeElementVO(); if (archetypeElementVO != null) { String gtCode = getArchetypeElementRuleLineElement().getValue().getValue(); if (getSecondArchetypeElementRuleLineElement().getValue() == null) { throw new IllegalStateException("No expression set"); } String secondGtCode = getSecondArchetypeElementRuleLineElement().getValue().getValue(); OperatorKind operatorKind = getComparisonOperatorRuleLineElement().getValue(); if (operatorKind == null) { throw new IllegalStateException("No operator kind set"); } String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); return new BinaryExpression( new Variable(gtCode, null, name), new Variable(secondGtCode), operatorKind); } else { throw new IllegalStateException("Invalid rule line: " + getArchetypeElementRuleLineElement()); } } }
return new BinaryExpression( new Variable( gtCode,
@Override public ExpressionItem toExpressionItem() { ArchetypeElementVO archetypeElementVO = getArchetypeElementAttributeRuleLineDefinitionElement().getValue(); String attribute = getArchetypeElementAttributeRuleLineDefinitionElement().getAttribute(); String path = archetypeElementVO.getPath() + "/value/" + attribute; ExpressionRuleLineElement expressionRuleLineElement = getExpressionRuleLineElement(); OperatorKind operatorKind = getComparisonOperatorRuleLineElement().getValue(); String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); return new BinaryExpression( new Variable(null, name, path), expressionRuleLineElement.getValue(), operatorKind); }
ret = new BinaryExpression(item, item2, op); break; default: