Search in sources :

Example 1 with Context

use of org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context in project drools by kiegroup.

the class ContextConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    Context c = (Context) parent;
    for (ContextEntry ce : c.getContextEntry()) {
        writeChildrenNode(writer, context, ce, CONTEXT_ENTRY);
    }
}
Also used : MarshallingContext(com.thoughtworks.xstream.converters.MarshallingContext) Context(org.kie.dmn.model.v1_1.Context) ContextEntry(org.kie.dmn.model.v1_1.ContextEntry)

Example 2 with Context

use of org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context in project drools by kiegroup.

the class ValidatorContextTest method testCONTEXT_ENTRY_MISSING_VARIABLE_DefinitionsInput.

@Test
public void testCONTEXT_ENTRY_MISSING_VARIABLE_DefinitionsInput() {
    final List<DMNMessage> validate = validator.validate(getDefinitions("context/CONTEXT_ENTRY_MISSING_VARIABLE.dmn", "https://github.com/kiegroup/kie-dmn", "CONTEXT_MISSING_EXPR"), VALIDATE_MODEL, VALIDATE_COMPILATION);
    assertThat(ValidatorUtil.formatMessages(validate), validate.size(), is(1));
    assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.MISSING_VARIABLE)));
    // check that it reports and error for the second context entry, but not for the last one
    final ContextEntry ce = (ContextEntry) validate.get(0).getSourceReference();
    assertThat(((Context) ce.getParent()).getContextEntry().indexOf(ce), is(1));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) DMNMessage(org.kie.dmn.api.core.DMNMessage) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) ContextEntry(org.kie.dmn.model.v1_1.ContextEntry) IOException(java.io.IOException) Test(org.junit.Test) Reader(java.io.Reader) Context(org.kie.dmn.model.v1_1.Context) List(java.util.List) VALIDATE_SCHEMA(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA) Assert(org.junit.Assert) VALIDATE_MODEL(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL) Context(org.kie.dmn.model.v1_1.Context) DMNMessage(org.kie.dmn.api.core.DMNMessage) ContextEntry(org.kie.dmn.model.v1_1.ContextEntry) Test(org.junit.Test)

Example 3 with Context

use of org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context in project kie-wb-common by kiegroup.

the class ContextPropertyConverter method wbFromDMN.

public static Context wbFromDMN(final org.kie.dmn.model.v1_1.Context dmn) {
    Id id = new Id(dmn.getId());
    Description description = new Description(dmn.getDescription());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    Context result = new Context(id, description, typeRef);
    for (org.kie.dmn.model.v1_1.ContextEntry ce : dmn.getContextEntry()) {
        ContextEntry ceConverted = ContextEntryPropertyConverter.wbFromDMN(ce);
        result.getContextEntry().add(ceConverted);
    }
    return result;
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)

Example 4 with Context

use of org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context in project kie-wb-common by kiegroup.

the class ContextPropertyConverter method dmnFromWB.

public static org.kie.dmn.model.v1_1.Context dmnFromWB(final Context wb) {
    org.kie.dmn.model.v1_1.Context result = new org.kie.dmn.model.v1_1.Context();
    result.setId(wb.getId().getValue());
    result.setDescription(wb.getDescription().getValue());
    QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
    for (ContextEntry ce : wb.getContextEntry()) {
        org.kie.dmn.model.v1_1.ContextEntry ceConverted = ContextEntryPropertyConverter.dmnFromWB(ce);
        result.getContextEntry().add(ceConverted);
    }
    return result;
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)

Example 5 with Context

use of org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context in project kie-wb-common by kiegroup.

the class PMMLFunctionEditorDefinition method getModelClass.

@Override
public Optional<Context> getModelClass() {
    final Context context = new Context();
    final ContextEntry documentEntry = new ContextEntry();
    final InformationItem documentEntryVariable = new InformationItem();
    documentEntryVariable.setName(new Name(VARIABLE_DOCUMENT));
    documentEntry.setVariable(documentEntryVariable);
    documentEntry.setExpression(new LiteralExpression());
    context.getContextEntry().add(documentEntry);
    final ContextEntry modelEntry = new ContextEntry();
    final InformationItem modelEntryVariable = new InformationItem();
    modelEntryVariable.setName(new Name(VARIABLE_MODEL));
    modelEntry.setVariable(modelEntryVariable);
    modelEntry.setExpression(new LiteralExpression());
    context.getContextEntry().add(modelEntry);
    return Optional.of(context);
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) HasName(org.kie.workbench.common.dmn.api.definition.HasName)

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)35 Test (org.junit.Test)24 BoolExpr (com.microsoft.z3.BoolExpr)23 List (java.util.List)20 IOException (java.io.IOException)18 ServerInstance (org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)18 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)17 HashMap (java.util.HashMap)16 File (java.io.File)14 Map (java.util.Map)14 ArrayList (java.util.ArrayList)13 Solver (com.microsoft.z3.Solver)12 Status (com.microsoft.z3.Status)12 IPath (org.eclipse.core.runtime.IPath)12 IStatus (org.eclipse.core.runtime.IStatus)12 Status (org.eclipse.core.runtime.Status)11 Factory (org.eclipse.jst.server.tomcat.core.internal.xml.Factory)11 Z3Exception (com.microsoft.z3.Z3Exception)9