Search in sources :

Example 1 with JSITInputData

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

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

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

the class InputDataConverter method nodeFromDMN.

@Override
public Node<View<InputData>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
    final JSITInputData dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
    @SuppressWarnings("unchecked") final Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(InputData.class)).asNode();
    final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final Name name = new Name(dmn.getName());
    final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn);
    final InputData inputData = new InputData(id, description, name, informationItem, new StylingSet(), new GeneralRectangleDimensionsSet());
    inputData.setDiagramId(nodeEntry.getDiagramId());
    node.getContent().setDefinition(inputData);
    if (Objects.nonNull(informationItem)) {
        informationItem.setParent(inputData);
    }
    DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, inputData);
    return node;
}
Also used : InformationItemPrimary(org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary) JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Node(org.kie.workbench.common.stunner.core.graph.Node) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) GeneralRectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) BindableAdapterUtils.getDefinitionId(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId) JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Example 4 with JSITInputData

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

JSITInputData (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData)4 InputData (org.kie.workbench.common.dmn.api.definition.model.InputData)2 JSITDecision (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecision)2 JSITInformationItem (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem)2 JSITInvocable (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInvocable)2 InformationItemPrimary (org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary)1 GeneralRectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet)1 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)1 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)1 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)1 StylingSet (org.kie.workbench.common.dmn.api.property.styling.StylingSet)1 BindableAdapterUtils.getDefinitionId (org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId)1 Node (org.kie.workbench.common.stunner.core.graph.Node)1 View (org.kie.workbench.common.stunner.core.graph.content.view.View)1