Search in sources :

Example 1 with ConnectiveDescr

use of org.drools.compiler.lang.descr.ConnectiveDescr in project drools by kiegroup.

the class QualifiedIdentifierRestrictionHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    final String expression = ((org.w3c.dom.Text) element.getChildNodes().item(0)).getWholeText();
    emptyContentCheck(localName, expression, parser);
    ConnectiveDescr c = (ConnectiveDescr) parser.getParent();
    String s = ((String) parser.getCurrent()) + expression;
    c.add(s);
    return null;
}
Also used : Element(org.w3c.dom.Element) ConnectiveDescr(org.drools.compiler.lang.descr.ConnectiveDescr)

Example 2 with ConnectiveDescr

use of org.drools.compiler.lang.descr.ConnectiveDescr in project drools by kiegroup.

the class FieldConstraintHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    final ConnectiveDescr c = (ConnectiveDescr) parser.getCurrent();
    Object p = parser.getParent();
    if (p instanceof PatternDescr) {
        StringBuilder sb = new StringBuilder();
        c.buildExpression(sb);
        ExprConstraintDescr expr = new ExprConstraintDescr();
        expr.setExpression(sb.toString());
        final PatternDescr patternDescr = (PatternDescr) parser.getParent();
        patternDescr.addConstraint(expr);
    } else if (p instanceof ConnectiveDescr) {
        ((ConnectiveDescr) p).add(c);
    }
    return c;
}
Also used : PatternDescr(org.drools.compiler.lang.descr.PatternDescr) Element(org.w3c.dom.Element) ConnectiveDescr(org.drools.compiler.lang.descr.ConnectiveDescr) ExprConstraintDescr(org.drools.compiler.lang.descr.ExprConstraintDescr)

Example 3 with ConnectiveDescr

use of org.drools.compiler.lang.descr.ConnectiveDescr in project drools by kiegroup.

the class ReturnValueRestrictionHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    final String expression = ((org.w3c.dom.Text) element.getChildNodes().item(0)).getWholeText();
    emptyContentCheck(localName, expression, parser);
    ConnectiveDescr c = (ConnectiveDescr) parser.getParent();
    String s = ((String) parser.getCurrent()) + "(" + expression + ")";
    c.add(s);
    return null;
}
Also used : Element(org.w3c.dom.Element) ConnectiveDescr(org.drools.compiler.lang.descr.ConnectiveDescr)

Example 4 with ConnectiveDescr

use of org.drools.compiler.lang.descr.ConnectiveDescr in project drools by kiegroup.

the class LiteralRestrictionHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    ConnectiveDescr c = (ConnectiveDescr) parser.getParent();
    String s = (String) parser.getCurrent();
    c.add(s);
    return null;
}
Also used : Element(org.w3c.dom.Element) ConnectiveDescr(org.drools.compiler.lang.descr.ConnectiveDescr)

Example 5 with ConnectiveDescr

use of org.drools.compiler.lang.descr.ConnectiveDescr in project drools by kiegroup.

the class RestrictionConnectiveHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    Object op = parser.getParent();
    ConnectiveDescr c = (ConnectiveDescr) parser.getCurrent();
    if (op instanceof PatternDescr) {
        StringBuilder sb = new StringBuilder();
        c.buildExpression(sb);
        ExprConstraintDescr expr = new ExprConstraintDescr();
        expr.setExpression(sb.toString());
        final PatternDescr patternDescr = (PatternDescr) op;
        patternDescr.addConstraint(expr);
    } else {
        ConnectiveDescr p = (ConnectiveDescr) op;
        p.add(c);
    }
    return c;
}
Also used : PatternDescr(org.drools.compiler.lang.descr.PatternDescr) Element(org.w3c.dom.Element) ConnectiveDescr(org.drools.compiler.lang.descr.ConnectiveDescr) RestrictionConnectiveDescr(org.drools.compiler.lang.descr.RestrictionConnectiveDescr) ExprConstraintDescr(org.drools.compiler.lang.descr.ExprConstraintDescr)

Aggregations

ConnectiveDescr (org.drools.compiler.lang.descr.ConnectiveDescr)7 Element (org.w3c.dom.Element)6 ExprConstraintDescr (org.drools.compiler.lang.descr.ExprConstraintDescr)2 PatternDescr (org.drools.compiler.lang.descr.PatternDescr)2 RestrictionConnectiveDescr (org.drools.compiler.lang.descr.RestrictionConnectiveDescr)1