Search in sources :

Example 11 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 12 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 13 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 InformationItemPropertyConverter method wbFromDMN.

public static InformationItem wbFromDMN(final JSITInformationItem dmn) {
    if (Objects.isNull(dmn)) {
        return null;
    }
    final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final Name name = new Name(dmn.getName());
    final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    final InformationItem result = new InformationItem(id, description, name, typeRef);
    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.model.InformationItem) JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Example 14 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 InformationItemPropertyConverter method dmnFromWB.

public static JSITInformationItem dmnFromWB(final InformationItem wb) {
    if (Objects.isNull(wb)) {
        return null;
    }
    final JSITInformationItem result = new JSITInformationItem();
    result.setId(wb.getId().getValue());
    final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
    description.ifPresent(result::setDescription);
    result.setName(wb.getName().getValue());
    QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
    return result;
}
Also used : JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem)

Example 15 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 InputDataConverter method dmnFromNode.

@Override
public JSITInputData dmnFromNode(final Node<View<InputData>, ?> node, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
    final InputData source = (InputData) DefinitionUtils.getElementDefinition(node);
    final JSITInputData result = new JSITInputData();
    result.setId(source.getId().getValue());
    final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(source.getDescription()));
    description.ifPresent(result::setDescription);
    result.setName(source.getName().getValue());
    final JSITInformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source);
    result.setVariable(variable);
    DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, result);
    return result;
}
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) JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData)

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