@Override public String getPredicateDescription() { StringBuilder sb = new StringBuilder(); ArchetypeElementRuleLineDefinitionElement aerlde = getArchetypeElementRuleLineDefinitionElement(); if (aerlde != null) { ArchetypeElementVO archetypeElementVO = aerlde.getValue(); if (archetypeElementVO != null) { String name = aerlde.getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); sb.append(name) .append("=") .append(DVDefSerializer.getReadableValue(getDataValueRuleLineElement().getValue(), null)); } else { LoggerFactory.getLogger(ArchetypeReference.class).warn("Unknown predicate for AR '" + aerlde.toString() + "'"); sb.append("*UNKNOWN PREDICATE*"); } } return sb.toString(); } }
@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); }
WithElementPredicateAttributeDefinitionRuleLine wepdrl = new WithElementPredicateAttributeDefinitionRuleLine(); airl.addChildRuleLine(wepdrl); wepdrl.getArchetypeElementRuleLineDefinitionElement().setValue(archetypeElementVO); String rmType = archetypeElementVO.getType(); if (OpenEHRDataValues.DV_TEXT.equals(rmType)