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; } }
public ElementComparisonWithDVConditionRuleLine() { super(OpenEHRLanguageManager.getMessage("CompareElementWithDataValue"), OpenEHRLanguageManager.getMessage("CompareElementWithDataValueDesc")); archetypeElementRuleLineElement = new ArchetypeElementRuleLineElement(this); comparisonOperatorRuleLineElement = new ElementComparisonOperatorRuleLineElement(this); archetypeDataValueRuleLineElement = new ArchetypeDataValueRuleLineElement(this); getRuleLineElements().add(new StaticTextRuleLineElement(this, "ElementRLE")); getRuleLineElements().add(archetypeElementRuleLineElement); getRuleLineElements().add(comparisonOperatorRuleLineElement); getRuleLineElements().add(archetypeDataValueRuleLineElement); }
ElementComparisonWithDVConditionRuleLine eccrl = new ElementComparisonWithDVConditionRuleLine(); addRuleLine(eccrl, ruleLines, parentRuleLine); eccrl.getArchetypeElementRuleLineElement().setValue(gtCodeRuleLineElement); eccrl.getArchetypeDataValueRuleLineElement().setValue(dv); eccrl.getArchetypeDataValueRuleLineElement().setArchetypeElementVO(archetypeElementVO); eccrl.getComparisonOperatorRuleLineElement().setValue(binaryExpression.getOperator()); } else { ElementInitializedConditionRuleLine eicrl = new ElementInitializedConditionRuleLine();