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);
}
}
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);
}
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;
}
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;
}
Aggregations