Search in sources :

Example 11 with Expression

use of org.eclipse.bpmn2.Expression in project kie-wb-common by kiegroup.

the class ContextEntryPropertyConverter method wbFromDMN.

public static ContextEntry wbFromDMN(final org.kie.dmn.model.v1_1.ContextEntry dmn) {
    InformationItem variable = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
    Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
    ContextEntry result = new ContextEntry();
    result.setVariable(variable);
    result.setExpression(expression);
    return result;
}
Also used : Expression(org.kie.workbench.common.dmn.api.definition.v1_1.Expression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)

Example 12 with Expression

use of org.eclipse.bpmn2.Expression in project kie-wb-common by kiegroup.

the class DecisionConverter method nodeFromDMN.

@Override
public Node<View<Decision>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.Decision dmn) {
    @SuppressWarnings("unchecked") Node<View<Decision>, ?> node = (Node<View<Decision>, ?>) factoryManager.newElement(dmn.getId(), Decision.class).asNode();
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    Name name = new Name(dmn.getName());
    InformationItem informationItem = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
    Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
    Decision decision = new Decision(id, description, name, new Question(), new AllowedAnswers(), informationItem, expression, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
    node.getContent().setDefinition(decision);
    return node;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Node(org.kie.workbench.common.stunner.core.graph.Node) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) AllowedAnswers(org.kie.workbench.common.dmn.api.property.dmn.AllowedAnswers) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Decision(org.kie.workbench.common.dmn.api.definition.v1_1.Decision) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) FontSet(org.kie.workbench.common.dmn.api.property.font.FontSet) BackgroundSet(org.kie.workbench.common.dmn.api.property.background.BackgroundSet) Expression(org.kie.workbench.common.dmn.api.definition.v1_1.Expression) Question(org.kie.workbench.common.dmn.api.property.dmn.Question) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 13 with Expression

use of org.eclipse.bpmn2.Expression in project kie-wb-common by kiegroup.

the class FunctionDefinitionPropertyConverter method wbFromDMN.

public static FunctionDefinition wbFromDMN(final org.kie.dmn.model.v1_1.FunctionDefinition dmn) {
    if (dmn == null) {
        return null;
    }
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
    FunctionDefinition result = new FunctionDefinition(id, description, typeRef, expression);
    result.getNsContext().putAll(dmn.getNsContext());
    for (Entry<javax.xml.namespace.QName, String> kv : dmn.getAdditionalAttributes().entrySet()) {
        QName convertedQName = QNamePropertyConverter.wbFromDMN(kv.getKey());
        result.getAdditionalAttributes().put(convertedQName, kv.getValue());
    }
    for (org.kie.dmn.model.v1_1.InformationItem ii : dmn.getFormalParameter()) {
        InformationItem iiConverted = InformationItemPropertyConverter.wbFromDMN(ii);
        result.getFormalParameter().add(iiConverted);
    }
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Expression(org.kie.workbench.common.dmn.api.definition.v1_1.Expression) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 14 with Expression

use of org.eclipse.bpmn2.Expression in project kie-wb-common by kiegroup.

the class Bpmn2JsonMarshaller method setAdHocSubProcessProperties.

private void setAdHocSubProcessProperties(final AdHocSubProcess subProcess, final Map<String, Object> properties) {
    if (subProcess.getOrdering().equals(AdHocOrdering.PARALLEL)) {
        properties.put(ADHOCORDERING, "Parallel");
    } else if (subProcess.getOrdering().equals(AdHocOrdering.SEQUENTIAL)) {
        properties.put(ADHOCORDERING, "Sequential");
    } else {
        // default to parallel
        properties.put(ADHOCORDERING, "Parallel");
    }
    if (subProcess.getCompletionCondition() != null) {
        final FormalExpression expression = (FormalExpression) subProcess.getCompletionCondition();
        final String language = Utils.getScriptLanguage(expression.getLanguage());
        final String script = expression.getBody().replaceAll("\n", "\\\\n");
        final ScriptTypeValue value = new ScriptTypeValue(language, script);
        properties.put(ADHOCCOMPLETIONCONDITION, new ScriptTypeTypeSerializer().serialize(value));
    }
}
Also used : ScriptTypeTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeTypeSerializer) FormalExpression(org.eclipse.bpmn2.FormalExpression) ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue)

Example 15 with Expression

use of org.eclipse.bpmn2.Expression in project kie-wb-common by kiegroup.

the class FunctionGrid method doSetKind.

void doSetKind(final FunctionDefinition.Kind kind, final FunctionDefinition function, final Optional<ExpressionEditorDefinition<Expression>> oDefinition) {
    oDefinition.ifPresent(definition -> {
        final GridCellTuple expressionParent = new GridCellTuple(0, 0, this);
        final Optional<Expression> expression = definition.getModelClass();
        final Optional<BaseExpressionGrid> gridWidget = definition.getEditor(expressionParent, Optional.empty(), hasExpression, expression, hasName, nesting);
        doSetKind(kind, function, expression, gridWidget);
    });
}
Also used : GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) Expression(org.kie.workbench.common.dmn.api.definition.v1_1.Expression) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid)

Aggregations

Expression (org.kie.workbench.common.dmn.api.definition.v1_1.Expression)19 Expression (org.apache.commons.jexl2.Expression)14 JexlContext (org.apache.commons.jexl2.JexlContext)12 JexlEngine (org.apache.commons.jexl2.JexlEngine)9 MapContext (org.apache.commons.jexl2.MapContext)8 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)7 Expression (org.eclipse.xtext.resource.bug385636.Expression)7 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)7 BaseExpressionGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid)6 ArrayList (java.util.ArrayList)5 Expression (org.kie.dmn.model.v1_1.Expression)5 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)5 BaseGridCellValue (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue)5 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)4 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)4 ExpressionEditorDefinition (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinition)4 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)4 CompiledExpression (org.kie.dmn.feel.lang.CompiledExpression)3 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)3 HashMap (java.util.HashMap)2