Search in sources :

Example 1 with MultiPatternDestinationDescr

use of org.drools.drl.ast.descr.MultiPatternDestinationDescr in project drools by kiegroup.

the class OrHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    final OrDescr orDescr = (OrDescr) parser.getCurrent();
    final Object parent = parser.getParent();
    if (!orDescr.getDescrs().isEmpty()) {
        if (parent instanceof RuleDescr || parent instanceof QueryDescr) {
            final RuleDescr ruleDescr = (RuleDescr) parent;
            ruleDescr.getLhs().addDescr(orDescr);
        } else if (parent instanceof MultiPatternDestinationDescr) {
            final MultiPatternDestinationDescr mpDescr = (MultiPatternDestinationDescr) parent;
            mpDescr.setInput(orDescr);
        } else if (parent instanceof ConditionalElementDescr) {
            final ConditionalElementDescr ceDescr = (ConditionalElementDescr) parent;
            ceDescr.addDescr(orDescr);
        }
    }
    return orDescr;
}
Also used : QueryDescr(org.drools.drl.ast.descr.QueryDescr) MultiPatternDestinationDescr(org.drools.drl.ast.descr.MultiPatternDestinationDescr) Element(org.w3c.dom.Element) RuleDescr(org.drools.drl.ast.descr.RuleDescr) OrDescr(org.drools.drl.ast.descr.OrDescr) ConditionalElementDescr(org.drools.drl.ast.descr.ConditionalElementDescr)

Example 2 with MultiPatternDestinationDescr

use of org.drools.drl.ast.descr.MultiPatternDestinationDescr in project drools by kiegroup.

the class AndHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    final AndDescr andDescr = (AndDescr) parser.getCurrent();
    final Object parent = parser.getParent();
    if (!andDescr.getDescrs().isEmpty()) {
        if (parent instanceof RuleDescr || parent instanceof QueryDescr) {
            final RuleDescr ruleDescr = (RuleDescr) parent;
            ruleDescr.setLhs(andDescr);
        } else if (parent instanceof MultiPatternDestinationDescr) {
            final MultiPatternDestinationDescr mpDescr = (MultiPatternDestinationDescr) parent;
            mpDescr.setInput(andDescr);
        } else if (parent instanceof ConditionalElementDescr) {
            final ConditionalElementDescr ceDescr = (ConditionalElementDescr) parent;
            ceDescr.addDescr(andDescr);
        }
    }
    return andDescr;
}
Also used : QueryDescr(org.drools.drl.ast.descr.QueryDescr) MultiPatternDestinationDescr(org.drools.drl.ast.descr.MultiPatternDestinationDescr) AndDescr(org.drools.drl.ast.descr.AndDescr) Element(org.w3c.dom.Element) RuleDescr(org.drools.drl.ast.descr.RuleDescr) ConditionalElementDescr(org.drools.drl.ast.descr.ConditionalElementDescr)

Aggregations

ConditionalElementDescr (org.drools.drl.ast.descr.ConditionalElementDescr)2 MultiPatternDestinationDescr (org.drools.drl.ast.descr.MultiPatternDestinationDescr)2 QueryDescr (org.drools.drl.ast.descr.QueryDescr)2 RuleDescr (org.drools.drl.ast.descr.RuleDescr)2 Element (org.w3c.dom.Element)2 AndDescr (org.drools.drl.ast.descr.AndDescr)1 OrDescr (org.drools.drl.ast.descr.OrDescr)1