use of org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary in project kie-wb-common by kiegroup.
the class InputDataConverterTest method testDMNFromWB.
@Test
public void testDMNFromWB() {
final InputData wb = new InputData();
final InformationItemPrimary informationItem = new InformationItemPrimary();
wb.getId().setValue(INPUT_DATA_UUID);
wb.getName().setValue(INPUT_DATA_NAME);
wb.getDescription().setValue(INPUT_DATA_DESCRIPTION);
wb.setVariable(informationItem);
final Node<View<InputData>, ?> node = new NodeImpl<>(UUID.uuid());
final View<InputData> view = new ViewImpl<>(wb, Bounds.create());
node.setContent(view);
final org.kie.dmn.model.api.InputData dmn = converter.dmnFromNode(node, componentWidthsConsumer);
assertThat(dmn).isNotNull();
assertThat(dmn.getId()).isNotNull();
assertThat(dmn.getId()).isEqualTo(INPUT_DATA_UUID);
assertThat(dmn.getName()).isNotNull();
assertThat(dmn.getName()).isEqualTo(INPUT_DATA_NAME);
assertThat(dmn.getDescription()).isNotNull();
assertThat(dmn.getDescription()).isEqualTo(INPUT_DATA_DESCRIPTION);
assertThat(dmn.getVariable()).isNotNull();
assertThat(dmn.getVariable().getName()).isEqualTo(INPUT_DATA_NAME);
verifyNoMoreInteractions(componentWidthsConsumer);
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary in project kie-wb-common by kiegroup.
the class InformationItemPrimaryPropertyConverter method wbFromDMN.
public static InformationItemPrimary wbFromDMN(final JSITInformationItem dmn, final Object parent) {
if (Objects.isNull(dmn)) {
return null;
}
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Name name = new Name(getParentName(parent));
final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
return new InformationItemPrimary(id, name, typeRef);
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary 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.api.definition.model.InformationItemPrimary in project kie-wb-common by kiegroup.
the class DMNElementsSynchronizerTest method testSynchronizeDecisionServiceNode.
@Test
public void testSynchronizeDecisionServiceNode() {
final DecisionService from = mock(DecisionService.class);
final DecisionService to = mock(DecisionService.class);
final InformationItemPrimary variable = mock(InformationItemPrimary.class);
when(from.getVariable()).thenReturn(variable);
synchronizer.synchronizeDecisionServiceNode(from, to);
verify(to).setVariable(variable);
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary in project kie-wb-common by kiegroup.
the class DMNElementsSynchronizerTest method testSynchronizeInputDataNode.
@Test
public void testSynchronizeInputDataNode() {
final InputData from = mock(InputData.class);
final InputData to = mock(InputData.class);
final InformationItemPrimary variable = mock(InformationItemPrimary.class);
when(from.getVariable()).thenReturn(variable);
synchronizer.synchronizeInputDataNode(from, to);
verify(to).setVariable(variable);
}
Aggregations