Search in sources :

Example 6 with JSITList

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

the class ListPropertyConverter method wbFromDMN.

public static List wbFromDMN(final JSITList dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) {
    final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    final java.util.List<HasExpression> expression = new ArrayList<>();
    final List result = new List(id, description, typeRef, expression);
    final java.util.List<JSITExpression> jsiExpressions = dmn.getExpression();
    for (int i = 0; i < jsiExpressions.size(); i++) {
        final JSITExpression jsitExpression = Js.uncheckedCast(jsiExpressions.get(i));
        final Expression eConverted = ExpressionPropertyConverter.wbFromDMN(jsitExpression, Js.uncheckedCast(dmn), hasComponentWidthsConsumer);
        final HasExpression hasExpression = HasExpression.wrap(result, eConverted);
        expression.add(hasExpression);
    }
    for (HasExpression hasExpression : expression) {
        final Expression e = hasExpression.getExpression();
        if (Objects.nonNull(e)) {
            e.setParent(result);
        }
    }
    return result;
}
Also used : HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) JSITExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression) HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) Expression(org.kie.workbench.common.dmn.api.definition.model.Expression) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) ArrayList(java.util.ArrayList) List(org.kie.workbench.common.dmn.api.definition.model.List) ArrayList(java.util.ArrayList) JSITList(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITList) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) JSITExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression)

Example 7 with JSITList

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

the class ListPropertyConverter method dmnFromWB.

public static JSITList dmnFromWB(final List wb, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
    final JSITList result = new JSITList();
    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);
    for (HasExpression hasExpression : wb.getExpression()) {
        final Expression e = hasExpression.getExpression();
        final JSITExpression eConverted = ExpressionPropertyConverter.dmnFromWB(e, componentWidthsConsumer);
        result.addExpression(eConverted);
    }
    return result;
}
Also used : HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) JSITList(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITList) JSITExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression) HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) Expression(org.kie.workbench.common.dmn.api.definition.model.Expression) JSITExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression)

Aggregations

JSITList (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITList)7 JSITRelation (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRelation)4 List (org.kie.workbench.common.dmn.api.definition.model.List)3 Relation (org.kie.workbench.common.dmn.api.definition.model.Relation)3 ArrayList (java.util.ArrayList)2 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)2 Context (org.kie.workbench.common.dmn.api.definition.model.Context)2 DecisionTable (org.kie.workbench.common.dmn.api.definition.model.DecisionTable)2 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)2 FunctionDefinition (org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition)2 InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)2 Invocation (org.kie.workbench.common.dmn.api.definition.model.Invocation)2 IsLiteralExpression (org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression)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 WrapperUtils.getWrappedJSITContext (org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITContext)2 WrapperUtils.getWrappedJSITDecisionTable (org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITDecisionTable)2 WrapperUtils.getWrappedJSITFunctionDefinition (org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITFunctionDefinition)2 WrapperUtils.getWrappedJSITInvocation (org.kie.workbench.common.dmn.client.marshaller.common.WrapperUtils.getWrappedJSITInvocation)2