@Override public String getPredicateDescription() { StringBuilder sb = new StringBuilder(); ArchetypeElementRuleLineDefinitionElement aerlde = getArchetypeElementRuleLineDefinitionElement(); if (aerlde != null) { ArchetypeElementVO archetypeElementVO = aerlde.getValue(); if (archetypeElementVO != null) { OperatorKind operator = getExistenceOperatorRuleLineElement().getOperator(); String opStr = "??"; if (operator != null) { opStr = operator.getSymbol(); } String name = aerlde.getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); sb.append(name).append(opStr).append("null"); } else { LoggerFactory.getLogger(ArchetypeReference.class).warn("Unknown predicate for AR '" + aerlde.toString() + "'"); sb.append("*UNKNOWN PREDICATE*"); } } return sb.toString(); } }
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()); } }
airl.addChildRuleLine(wepedrl); wepedrl.getArchetypeElementRuleLineDefinitionElement().setValue(archetypeElementVO); wepedrl.getExistenceOperatorRuleLineElement().setValue(binaryExpression.getOperator().getSymbol() + "null");