public String toHTMLString(int level, String lang) { StringBuilder sb = new StringBuilder(); sb.append(getLevelSpace(level)); int index = 0; for (RuleLineElement ruleLineElement : getRuleLineElements()) { sb.append(ruleLineElement.getLabelTextHTML(lang)); index++; if (index < getRuleLineElements().size()) { sb.append(" "); } } return sb.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()); } }
ElementAttributeComparisonConditionRuleLine eaccrl = new ElementAttributeComparisonConditionRuleLine(); addRuleLine(eaccrl, ruleLines, parentRuleLine); eaccrl.getArchetypeElementAttributeRuleLineElement().setAttribute(attribute); ArchetypeElementRuleLineElement aerle = new ArchetypeElementRuleLineElement(eaccrl); aerle.setValue(gtCodeRuleLineElement); eaccrl.getArchetypeElementAttributeRuleLineElement().setValue(aerle); eaccrl.getExpressionRuleLineElement().setValue(binaryExpression.getRight()); eaccrl.getComparisonOperatorRuleLineElement().setValue(binaryExpression.getOperator());
public ElementAttributeComparisonConditionRuleLine() { super(OpenEHRLanguageManager.getMessage("CompareElementAttributeWithExpression"), OpenEHRLanguageManager.getMessage("CompareElementAttributeWithExpressionDesc")); archetypeElementAttributeRuleLineElement = new ArchetypeElementAttributeRuleLineElement(this); comparisonOperatorRuleLineElement = new AttributeComparisonOperatorRuleLineElement(this); expressionRuleLineElement = new ExpressionRuleLineElement(this); getRuleLineElements().add(new StaticTextRuleLineElement(this, "ElementRLE")); getRuleLineElements().add(archetypeElementAttributeRuleLineElement); getRuleLineElements().add(comparisonOperatorRuleLineElement); getRuleLineElements().add(expressionRuleLineElement); }