Search in sources :

Example 6 with Context

use of org.kie.dmn.model.v1_1.Context in project drools by kiegroup.

the class DMNBaseConverter method unmarshal.

public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    DMNModelInstrumentedBase obj = createModelObject();
    assignAttributes(reader, obj);
    parseElements(reader, context, obj);
    return obj;
}
Also used : DMNModelInstrumentedBase(org.kie.dmn.model.v1_1.DMNModelInstrumentedBase)

Example 7 with Context

use of org.kie.dmn.model.v1_1.Context in project drools by kiegroup.

the class DMNElementConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DMNElement e = (DMNElement) parent;
    if (e.getDescription() != null) {
        writeChildrenNodeAsValue(writer, context, e.getDescription(), DESCRIPTION);
    }
    if (e.getExtensionElements() != null) {
        writeChildrenNode(writer, context, e.getExtensionElements(), EXTENSION_ELEMENTS);
    }
}
Also used : DMNElement(org.kie.dmn.model.v1_1.DMNElement)

Example 8 with Context

use of org.kie.dmn.model.v1_1.Context in project drools by kiegroup.

the class DMNListConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    List list = (List) parent;
    for (Expression e : list.getExpression()) {
        writeChildrenNode(writer, context, e, MarshallingUtils.defineExpressionNodeName(e));
    }
}
Also used : Expression(org.kie.dmn.model.v1_1.Expression) List(org.kie.dmn.model.v1_1.List)

Example 9 with Context

use of org.kie.dmn.model.v1_1.Context in project drools by kiegroup.

the class ExtensionElementsConverter method unmarshal.

@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    DMNModelInstrumentedBase obj = createModelObject();
    assignAttributes(reader, obj);
    if (extensionRegisters.size() == 0) {
        while (reader.hasMoreChildren()) {
            reader.moveDown();
            String nodeName = reader.getNodeName();
            // skipping nodeName
            reader.moveUp();
        }
    } else {
        // do as default behavior, but in case cannot unmarshall an extension element child, just skip it.
        while (reader.hasMoreChildren()) {
            reader.moveDown();
            String nodeName = reader.getNodeName();
            try {
                Object object = readItem(reader, context, null);
                if (object instanceof DMNModelInstrumentedBase) {
                    ((DMNModelInstrumentedBase) object).setParent(obj);
                    ((DMNModelInstrumentedBase) obj).addChildren((DMNModelInstrumentedBase) object);
                }
                assignChildElement(obj, nodeName, object);
            } catch (CannotResolveClassException e) {
            // do nothing; I tried to convert the extension element child with the converters, but no converter is registered for this child.
            }
            reader.moveUp();
        }
    }
    return obj;
}
Also used : DMNModelInstrumentedBase(org.kie.dmn.model.v1_1.DMNModelInstrumentedBase) CannotResolveClassException(com.thoughtworks.xstream.mapper.CannotResolveClassException)

Example 10 with Context

use of org.kie.dmn.model.v1_1.Context in project drools by kiegroup.

the class FunctionDefinitionConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    FunctionDefinition fd = (FunctionDefinition) parent;
    for (InformationItem fparam : fd.getFormalParameter()) {
        writeChildrenNode(writer, context, fparam, FORMAL_PARAMETER);
    }
    if (fd.getExpression() != null)
        writeChildrenNode(writer, context, fd.getExpression(), MarshallingUtils.defineExpressionNodeName(fd.getExpression()));
}
Also used : FunctionDefinition(org.kie.dmn.model.v1_1.FunctionDefinition) InformationItem(org.kie.dmn.model.v1_1.InformationItem)

Aggregations

Context (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context)58 Context (com.microsoft.z3.Context)36 CoreException (org.eclipse.core.runtime.CoreException)34 Test (org.junit.Test)29 List (java.util.List)24 BoolExpr (com.microsoft.z3.BoolExpr)23 HashMap (java.util.HashMap)20 IOException (java.io.IOException)18 Map (java.util.Map)18 ArrayList (java.util.ArrayList)17 ServerInstance (org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)17 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)17 DMNMessage (org.kie.dmn.api.core.DMNMessage)14 File (java.io.File)13 Solver (com.microsoft.z3.Solver)12 Status (com.microsoft.z3.Status)12 IPath (org.eclipse.core.runtime.IPath)11 IStatus (org.eclipse.core.runtime.IStatus)11 Status (org.eclipse.core.runtime.Status)11 Factory (org.eclipse.jst.server.tomcat.core.internal.xml.Factory)11