Search in sources :

Example 1 with Iterator

use of org.kie.dmn.trisotech.model.api.Iterator in project drools by kiegroup.

the class IteratorConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    Iterator filter = (Iterator) parent;
    String type = reader.getAttribute(TYPE);
    if (type == null) {
        type = "for";
    }
    switch(type) {
        case "for":
        default:
            filter.setIteratorType(Iterator.IteratorType.FOR);
            break;
        case "some":
            filter.setIteratorType(Iterator.IteratorType.SOME);
            break;
        case "every":
            filter.setIteratorType(Iterator.IteratorType.EVERY);
            break;
    }
    filter.setVariable(reader.getAttribute(VARIABLE));
}
Also used : Iterator(org.kie.dmn.trisotech.model.api.Iterator) TIterator(org.kie.dmn.trisotech.model.v1_3.TIterator)

Example 2 with Iterator

use of org.kie.dmn.trisotech.model.api.Iterator in project drools by kiegroup.

the class IteratorConverter method assignChildElement.

@Override
protected void assignChildElement(Object parent, String nodeName, Object child) {
    Iterator filter = (Iterator) parent;
    if (IN.equals(nodeName)) {
        Expression expression = ((NamedExpression) child).getExpression();
        if (((NamedExpression) child).getTypeRef() != null) {
            expression.setTypeRef(((NamedExpression) child).getTypeRef());
        }
        filter.setIn(expression);
    } else if (RETURN.equals(nodeName)) {
        filter.setReturn(((NamedExpression) child).getExpression());
    } else {
        super.assignChildElement(parent, nodeName, child);
    }
}
Also used : Expression(org.kie.dmn.model.api.Expression) TNamedExpression(org.kie.dmn.trisotech.model.v1_3.TNamedExpression) NamedExpression(org.kie.dmn.trisotech.model.api.NamedExpression) TNamedExpression(org.kie.dmn.trisotech.model.v1_3.TNamedExpression) NamedExpression(org.kie.dmn.trisotech.model.api.NamedExpression) Iterator(org.kie.dmn.trisotech.model.api.Iterator) TIterator(org.kie.dmn.trisotech.model.v1_3.TIterator)

Example 3 with Iterator

use of org.kie.dmn.trisotech.model.api.Iterator in project drools by kiegroup.

the class IteratorConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    Iterator it = (Iterator) parent;
    writeChildrenNode(writer, context, new TNamedExpression(IN, it.getIn(), it.getTypeRef()), IN);
    writeChildrenNode(writer, context, new TNamedExpression(RETURN, it.getReturn()), RETURN);
}
Also used : Iterator(org.kie.dmn.trisotech.model.api.Iterator) TIterator(org.kie.dmn.trisotech.model.v1_3.TIterator) TNamedExpression(org.kie.dmn.trisotech.model.v1_3.TNamedExpression)

Example 4 with Iterator

use of org.kie.dmn.trisotech.model.api.Iterator in project drools by kiegroup.

the class IteratorConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    Iterator it = (Iterator) parent;
    writer.addAttribute(TYPE, it.getIteratorType().toString().toLowerCase());
    writer.addAttribute(VARIABLE, it.getVariable());
}
Also used : Iterator(org.kie.dmn.trisotech.model.api.Iterator) TIterator(org.kie.dmn.trisotech.model.v1_3.TIterator)

Aggregations

Iterator (org.kie.dmn.trisotech.model.api.Iterator)4 TIterator (org.kie.dmn.trisotech.model.v1_3.TIterator)4 TNamedExpression (org.kie.dmn.trisotech.model.v1_3.TNamedExpression)2 Expression (org.kie.dmn.model.api.Expression)1 NamedExpression (org.kie.dmn.trisotech.model.api.NamedExpression)1