Search in sources :

Example 26 with Binding

use of org.kie.workbench.common.dmn.api.definition.model.Binding in project kie-wb-common by kiegroup.

the class BindingPropertyConverter method wbFromDMN.

public static Binding wbFromDMN(final JSITBinding dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) {
    if (Objects.isNull(dmn)) {
        return null;
    }
    final InformationItem parameter = InformationItemPropertyConverter.wbFromDMN(dmn.getParameter());
    Expression expression = null;
    final JSITExpression jsiWrapped = dmn.getExpression();
    if (Objects.nonNull(jsiWrapped)) {
        final JSITExpression jsiExpression = Js.uncheckedCast(JsUtils.getUnwrappedElement(jsiWrapped));
        expression = ExpressionPropertyConverter.wbFromDMN(jsiExpression, Js.uncheckedCast(dmn), hasComponentWidthsConsumer);
    }
    final Binding result = new Binding();
    if (Objects.nonNull(parameter)) {
        parameter.setParent(result);
    }
    result.setParameter(parameter);
    if (Objects.nonNull(expression)) {
        expression.setParent(result);
    }
    result.setExpression(expression);
    return result;
}
Also used : Binding(org.kie.workbench.common.dmn.api.definition.model.Binding) JSITBinding(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBinding) JSITExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression) Expression(org.kie.workbench.common.dmn.api.definition.model.Expression) JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) JSITExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression)

Aggregations

Binding (org.kie.workbench.common.dmn.api.definition.model.Binding)26 Test (org.junit.Test)13 InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)13 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)7 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)7 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)5 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)5 Invocation (org.kie.workbench.common.dmn.api.definition.model.Invocation)4 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)4 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)3 JSITBinding (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBinding)3 JSITExpression (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression)3 Optional (java.util.Optional)2 TBinding (org.kie.dmn.model.v1_2.TBinding)2 TInformationItem (org.kie.dmn.model.v1_2.TInformationItem)2 TLiteralExpression (org.kie.dmn.model.v1_2.TLiteralExpression)2 HasComponentWidths (org.kie.workbench.common.dmn.api.definition.HasComponentWidths)2 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)2 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)2 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)2