use of org.drools.drl.ast.descr.ConditionalElementDescr 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;
}
use of org.drools.drl.ast.descr.ConditionalElementDescr in project drools by kiegroup.
the class NotHandler method end.
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
final Element element = parser.endElementBuilder();
final NotDescr notDescr = (NotDescr) parser.getCurrent();
if ((notDescr.getDescrs().size() != 1) && (notDescr.getDescrs().get(0).getClass() != PatternDescr.class)) {
throw new SAXParseException("<not> can only have a single <pattern...> as a child element", parser.getLocator());
}
final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parser.getParent();
parentDescr.addDescr(notDescr);
return null;
}
use of org.drools.drl.ast.descr.ConditionalElementDescr in project drools by kiegroup.
the class ExistsHandler method end.
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
final Element element = parser.endElementBuilder();
final ExistsDescr existsDescr = (ExistsDescr) parser.getCurrent();
if ((existsDescr.getDescrs().size() != 1) && (existsDescr.getDescrs().get(0).getClass() != PatternDescr.class)) {
throw new SAXParseException("<exists> can only have a single <pattern...> as a child element", parser.getLocator());
}
final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parser.getParent();
parentDescr.addDescr(existsDescr);
return existsDescr;
}
use of org.drools.drl.ast.descr.ConditionalElementDescr in project drools by kiegroup.
the class AccumulateHandler method end.
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
final Element element = parser.endElementBuilder();
final AccumulateDescr accumulateDescr = (AccumulateDescr) parser.getCurrent();
final Object parent = parser.getParent();
if (parent.getClass().getName().equals(FromDescr.class.getName())) {
final PatternDescr result = (PatternDescr) parser.getParent(1);
result.setSource(accumulateDescr);
} else if (parent instanceof ConditionalElementDescr) {
final ConditionalElementDescr parentDescr = (ConditionalElementDescr) parent;
parentDescr.addDescr(accumulateDescr);
}
return accumulateDescr;
}
use of org.drools.drl.ast.descr.ConditionalElementDescr 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;
}
Aggregations