use of org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType in project kie-wb-common by kiegroup.
the class KnowledgeSourceConverter method nodeFromDMN.
@Override
public Node<View<KnowledgeSource>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.KnowledgeSource dmn) {
@SuppressWarnings("unchecked") Node<View<KnowledgeSource>, ?> node = (Node<View<KnowledgeSource>, ?>) factoryManager.newElement(dmn.getId(), KnowledgeSource.class).asNode();
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
Name name = new Name(dmn.getName());
KnowledgeSourceType ksType = new KnowledgeSourceType(dmn.getType());
LocationURI locationURI = new LocationURI(dmn.getLocationURI());
KnowledgeSource ks = new KnowledgeSource(id, description, name, ksType, locationURI, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
node.getContent().setDefinition(ks);
return node;
}
use of org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType in project kie-wb-common by kiegroup.
the class KnowledgeSourceTest method testDifferentStylingSet.
@Test
public void testDifferentStylingSet() {
final KnowledgeSource modelOne = new KnowledgeSource(new Id("123"), new Description(), new Name(), new KnowledgeSourceType(), new LocationURI(), new StylingSet(), new GeneralRectangleDimensionsSet());
final KnowledgeSource modelTwo = new KnowledgeSource(new Id("123"), new Description(), new Name(), new KnowledgeSourceType(), new LocationURI(), new StylingSet(), new GeneralRectangleDimensionsSet());
assertEquals(modelOne, modelTwo);
modelOne.getStylingSet().setFontSize(new FontSize(10.0));
modelTwo.getStylingSet().setFontSize(new FontSize(11.0));
assertNotEquals(modelOne, modelTwo);
}
use of org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType in project kie-wb-common by kiegroup.
the class KnowledgeSourceConverter method nodeFromDMN.
@Override
public Node<View<KnowledgeSource>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
final JSITKnowledgeSource dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
@SuppressWarnings("unchecked") final Node<View<KnowledgeSource>, ?> node = (Node<View<KnowledgeSource>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(KnowledgeSource.class)).asNode();
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final Name name = new Name(dmn.getName());
final KnowledgeSourceType ksType = new KnowledgeSourceType(dmn.getType());
final LocationURI locationURI = new LocationURI(dmn.getLocationURI());
final KnowledgeSource ks = new KnowledgeSource(id, description, name, ksType, locationURI, new StylingSet(), new GeneralRectangleDimensionsSet());
ks.setDiagramId(nodeEntry.getDiagramId());
node.getContent().setDefinition(ks);
DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, ks);
return node;
}
use of org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType in project kie-wb-common by kiegroup.
the class DMNElementsSynchronizerTest method testSynchronizeKnowledgeSourceNode.
@Test
public void testSynchronizeKnowledgeSourceNode() {
final KnowledgeSource from = mock(KnowledgeSource.class);
final KnowledgeSource to = mock(KnowledgeSource.class);
final KnowledgeSourceType type = mock(KnowledgeSourceType.class);
final LocationURI locationURI = mock(LocationURI.class);
when(from.getType()).thenReturn(type);
when(from.getLocationURI()).thenReturn(locationURI);
synchronizer.synchronizeKnowledgeSourceNode(from, to);
verify(to).setType(type);
verify(to).setLocationURI(locationURI);
}
use of org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType in project kie-wb-common by kiegroup.
the class KnowledgeSourceConverter method nodeFromDMN.
@Override
public Node<View<KnowledgeSource>, ?> nodeFromDMN(final org.kie.dmn.model.api.KnowledgeSource dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) {
@SuppressWarnings("unchecked") final Node<View<KnowledgeSource>, ?> node = (Node<View<KnowledgeSource>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(KnowledgeSource.class)).asNode();
final Id id = new Id(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final Name name = new Name(dmn.getName());
final KnowledgeSourceType ksType = new KnowledgeSourceType(dmn.getType());
final LocationURI locationURI = new LocationURI(dmn.getLocationURI());
final KnowledgeSource ks = new KnowledgeSource(id, description, name, ksType, locationURI, new StylingSet(), new GeneralRectangleDimensionsSet());
node.getContent().setDefinition(ks);
DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, ks);
return node;
}
Aggregations