private ArchetypeInstantiationRuleLine getArchetypeInstantiationRuleLine() { return (ArchetypeInstantiationRuleLine) getParentRuleLine(); }
@Override public String getPredicateDescription() { StringBuilder sb = new StringBuilder(); PredicateArchetypeElementAttributeRuleLineElement paearle = getArchetypeElementAttributeRuleLineDefinitionElement(); PredicateAttributeComparisonOperatorRuleLineElement pacorl = getComparisonOperatorRuleLineElement(); ExpressionRuleLineElement ere = getExpressionRuleLineElement(); if (paearle != null) { ArchetypeElementVO archetypeElementVO = paearle.getValue(); String attribute = paearle.getAttribute(); if (archetypeElementVO != null && pacorl.getValue() != null) { String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); sb.append(name).append(".").append(attribute).append(" ").append(pacorl.getValue().getSymbol()).append(" ").append(ere.toString()); } else { LoggerFactory.getLogger(ArchetypeReference.class).warn("Unknown predicate for AR '" + paearle.toString() + "'"); sb.append("*UNKNOWN PREDICATE*"); } } return sb.toString(); } }
WithElementPredicateExpressionDefinitionRuleLine wepdrl = new WithElementPredicateExpressionDefinitionRuleLine(airl); String path = variable.getPath(); String attribute = StringUtils.substringAfterLast(path, "/value/"); wepdrl.getArchetypeElementAttributeRuleLineDefinitionElement().setAttribute(attribute); path = StringUtils.substringBeforeLast(path, "/value/"); ArchetypeElementVO archetypeElementVO = + ")" : "") + "' not found!"); wepdrl.getArchetypeElementAttributeRuleLineDefinitionElement().setValue(archetypeElementVO); ExpressionItem expressionItemAux = binaryExpression.getRight(); wepdrl.getExpressionRuleLineElement().setValue(expressionItemAux); wepdrl.getComparisonOperatorRuleLineElement().setValue(binaryExpression.getOperator());
public WithElementPredicateExpressionDefinitionRuleLine( ArchetypeInstantiationRuleLine archetypeInstantiationRuleLine) { super(OpenEHRLanguageManager.getMessage("ElementPredicateExpression"), OpenEHRLanguageManager.getMessage("ElementPredicateExpressionDesc")); archetypeElementAttributeRuleLineDefinitionElement = new PredicateArchetypeElementAttributeRuleLineElement(this); comparisonOperatorRuleLineElement = new PredicateAttributeComparisonOperatorRuleLineElement(this); expressionRuleLineElement = new ExpressionRuleLineElement(this); if (archetypeInstantiationRuleLine != null) { archetypeInstantiationRuleLine.addChildRuleLine(this); } getRuleLineElements().add(new StaticTextRuleLineElement(this, "WithElementRLE")); getRuleLineElements().add(archetypeElementAttributeRuleLineDefinitionElement); getRuleLineElements().add(comparisonOperatorRuleLineElement); getRuleLineElements().add(expressionRuleLineElement); }
@Override public ArchetypeReference getArchetypeReference() { return getArchetypeInstantiationRuleLine().getArchetypeReferenceRuleLineDefinitionElement().getValue(); }
@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); }