Search in sources :

Example 1 with JSITBinding

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBinding in project kie-wb-common by kiegroup.

the class BindingPropertyConverter method dmnFromWB.

public static JSITBinding dmnFromWB(final Binding wb, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
    if (Objects.isNull(wb)) {
        return null;
    }
    final JSITBinding result = new JSITBinding();
    final JSITInformationItem convertedParameter = InformationItemPropertyConverter.dmnFromWB(wb.getParameter());
    final JSITExpression convertedExpression = ExpressionPropertyConverter.dmnFromWB(wb.getExpression(), componentWidthsConsumer);
    result.setParameter(convertedParameter);
    result.setExpression(convertedExpression);
    return result;
}
Also used : JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) 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)

Example 2 with JSITBinding

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBinding in project kie-wb-common by kiegroup.

the class InvocationPropertyConverter method dmnFromWB.

public static JSITInvocation dmnFromWB(final Invocation wb, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
    if (Objects.isNull(wb)) {
        return null;
    }
    final JSITInvocation result = new JSITInvocation();
    result.setId(wb.getId().getValue());
    final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
    description.ifPresent(result::setDescription);
    QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
    final JSITExpression convertedExpression = ExpressionPropertyConverter.dmnFromWB(wb.getExpression(), componentWidthsConsumer);
    result.setExpression(convertedExpression);
    for (Binding b : wb.getBinding()) {
        final JSITBinding bConverted = BindingPropertyConverter.dmnFromWB(b, componentWidthsConsumer);
        result.addBinding(bConverted);
    }
    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) JSITBinding(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBinding) JSITInvocation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInvocation) JSITExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression)

Example 3 with JSITBinding

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBinding in project kie-wb-common by kiegroup.

the class InvocationPropertyConverter method wbFromDMN.

public static Invocation wbFromDMN(final JSITInvocation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) {
    if (Objects.isNull(dmn)) {
        return null;
    }
    final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    final Invocation result = new Invocation();
    result.setId(id);
    result.setDescription(description);
    result.setTypeRef(typeRef);
    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);
    }
    result.setExpression(expression);
    if (Objects.nonNull(expression)) {
        expression.setParent(result);
    }
    final List<JSITBinding> jsiBindings = dmn.getBinding();
    for (int i = 0; i < jsiBindings.size(); i++) {
        final JSITBinding jsiBinding = Js.uncheckedCast(jsiBindings.get(i));
        final Binding bConverted = BindingPropertyConverter.wbFromDMN(jsiBinding, hasComponentWidthsConsumer);
        if (Objects.nonNull(bConverted)) {
            bConverted.setParent(result);
        }
        result.getBinding().add(bConverted);
    }
    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) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) JSITInvocation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInvocation) Invocation(org.kie.workbench.common.dmn.api.definition.model.Invocation) JSITExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression) Expression(org.kie.workbench.common.dmn.api.definition.model.Expression) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) JSITBinding(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBinding) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) JSITExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression)

Example 4 with JSITBinding

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBinding 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

JSITBinding (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBinding)4 JSITExpression (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression)4 Binding (org.kie.workbench.common.dmn.api.definition.model.Binding)3 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)2 JSITInformationItem (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem)2 JSITInvocation (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInvocation)2 InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)1 Invocation (org.kie.workbench.common.dmn.api.definition.model.Invocation)1 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)1 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)1 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)1