Search in sources :

Example 1 with JSITInformationItem

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

the class DMNMarshallerImportsClientHelper method setInformationItem.

private void setInformationItem(final JSITDRGElement drgElement, final JSITInformationItem informationItem) {
    if (JSITDecision.instanceOf(drgElement)) {
        final JSITDecision decision = Js.uncheckedCast(drgElement);
        decision.setVariable(informationItem);
    } else if (JSITInputData.instanceOf(drgElement)) {
        final JSITInputData inputData = Js.uncheckedCast(drgElement);
        inputData.setVariable(informationItem);
    } else if (JSITInvocable.instanceOf(drgElement)) {
        final JSITInvocable invocable = Js.uncheckedCast(drgElement);
        invocable.setVariable(informationItem);
    }
}
Also used : JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) JSITDecision(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecision) JSITInvocable(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInvocable)

Example 2 with JSITInformationItem

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

the class DMNMarshallerImportsClientHelper method updateInformationItem.

private void updateInformationItem(final String namespace, final JSITDRGElement drgElement) {
    getInformationItem(drgElement).ifPresent(informationItem -> {
        final JSITInformationItem tInformationItem = new JSITInformationItem();
        final String typeRef = informationItem.getTypeRef();
        if (!isEmpty(typeRef) && !isBuiltInType(typeRef)) {
            tInformationItem.setTypeRef(namespace + "." + typeRef);
            setInformationItem(drgElement, tInformationItem);
        }
    });
}
Also used : JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem)

Example 3 with JSITInformationItem

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

the class DMNMarshallerImportsClientHelper method getInformationItem.

private Optional<JSITInformationItem> getInformationItem(final JSITDRGElement drgElement) {
    final JSITInformationItem variable;
    if (JSITDecision.instanceOf(drgElement)) {
        final JSITDecision decision = Js.uncheckedCast(drgElement);
        variable = Js.uncheckedCast(decision.getVariable());
    } else if (JSITInputData.instanceOf(drgElement)) {
        final JSITInputData inputData = Js.uncheckedCast(drgElement);
        variable = Js.uncheckedCast(inputData.getVariable());
    } else if (JSITInvocable.instanceOf(drgElement)) {
        final JSITInvocable invocable = Js.uncheckedCast(drgElement);
        variable = Js.uncheckedCast(invocable.getVariable());
    } else {
        return Optional.empty();
    }
    return Optional.of(variable);
}
Also used : JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) JSITDecision(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecision) JSITInvocable(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInvocable)

Example 4 with JSITInformationItem

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

the class RelationPropertyConverter method dmnFromWB.

public static JSITRelation dmnFromWB(final Relation wb, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
    final JSITRelation result = new JSITRelation();
    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 (InformationItem iitem : wb.getColumn()) {
        final JSITInformationItem iitemConverted = InformationItemPropertyConverter.dmnFromWB(iitem);
        result.addColumn(iitemConverted);
    }
    for (org.kie.workbench.common.dmn.api.definition.model.List list : wb.getRow()) {
        final JSITList listConverted = ListPropertyConverter.dmnFromWB(list, componentWidthsConsumer);
        result.addRow(listConverted);
    }
    return result;
}
Also used : JSITRelation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRelation) JSITList(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITList) JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem)

Example 5 with JSITInformationItem

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

the class RelationPropertyConverter method wbFromDMN.

public static Relation wbFromDMN(final JSITRelation 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 List<InformationItem> convertedColumns = new ArrayList<>();
    final List<JSITInformationItem> jsiColumns = dmn.getColumn();
    for (int i = 0; i < jsiColumns.size(); i++) {
        final JSITInformationItem jsiColumn = Js.uncheckedCast(jsiColumns.get(i));
        convertedColumns.add(InformationItemPropertyConverter.wbFromDMN(jsiColumn));
    }
    final List<org.kie.workbench.common.dmn.api.definition.model.List> convertedRows = new ArrayList<>();
    final List<JSITList> jsiRows = dmn.getRow();
    for (int i = 0; i < jsiRows.size(); i++) {
        final JSITList jsiRow = Js.uncheckedCast(jsiRows.get(i));
        convertedRows.add(ListPropertyConverter.wbFromDMN(jsiRow, hasComponentWidthsConsumer));
    }
    final Relation result = new Relation(id, description, typeRef, convertedColumns, convertedRows);
    for (InformationItem column : convertedColumns) {
        if (Objects.nonNull(column)) {
            column.setParent(result);
        }
    }
    for (org.kie.workbench.common.dmn.api.definition.model.List row : convertedRows) {
        if (Objects.nonNull(row)) {
            row.setParent(result);
        }
    }
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) JSITList(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITList) JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) ArrayList(java.util.ArrayList) JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) JSITRelation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRelation) Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) ArrayList(java.util.ArrayList) List(java.util.List) JSITList(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITList) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Aggregations

JSITInformationItem (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem)15 InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)5 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)4 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)4 JSITExpression (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression)4 DRGElement (org.kie.workbench.common.dmn.api.definition.model.DRGElement)3 DecisionService (org.kie.workbench.common.dmn.api.definition.model.DecisionService)3 InputData (org.kie.workbench.common.dmn.api.definition.model.InputData)3 KnowledgeRequirement (org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement)3 JSITDMNElementReference (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference)3 JSITDecision (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecision)3 JSITFunctionDefinition (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITFunctionDefinition)3 JSITInputData (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData)3 Edge (org.kie.workbench.common.stunner.core.graph.Edge)3 View (org.kie.workbench.common.stunner.core.graph.content.view.View)3 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)2 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)2