Search in sources :

Example 1 with KnowledgeSourceType

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;
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) KnowledgeSourceType(org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType) Node(org.kie.workbench.common.stunner.core.graph.Node) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) FontSet(org.kie.workbench.common.dmn.api.property.font.FontSet) BackgroundSet(org.kie.workbench.common.dmn.api.property.background.BackgroundSet) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.v1_1.KnowledgeSource) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 2 with KnowledgeSourceType

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);
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) FontSize(org.kie.workbench.common.dmn.api.property.styling.FontSize) KnowledgeSourceType(org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType) 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) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Example 3 with KnowledgeSourceType

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;
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) JSITKnowledgeSource(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeSource) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) KnowledgeSourceType(org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType) Node(org.kie.workbench.common.stunner.core.graph.Node) GeneralRectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) JSITKnowledgeSource(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeSource) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) IdUtils.getRawId(org.kie.workbench.common.dmn.client.marshaller.common.IdUtils.getRawId) BindableAdapterUtils.getDefinitionId(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId)

Example 4 with KnowledgeSourceType

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);
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) KnowledgeSourceType(org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType) Test(org.junit.Test)

Example 5 with KnowledgeSourceType

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;
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) KnowledgeSourceType(org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType) 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) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Aggregations

KnowledgeSourceType (org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType)5 LocationURI (org.kie.workbench.common.dmn.api.property.dmn.LocationURI)5 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)4 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)4 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)4 KnowledgeSource (org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource)3 GeneralRectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet)3 StylingSet (org.kie.workbench.common.dmn.api.property.styling.StylingSet)3 Node (org.kie.workbench.common.stunner.core.graph.Node)3 View (org.kie.workbench.common.stunner.core.graph.content.view.View)3 Test (org.junit.Test)2 BindableAdapterUtils.getDefinitionId (org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId)2 KnowledgeSource (org.kie.workbench.common.dmn.api.definition.v1_1.KnowledgeSource)1 BackgroundSet (org.kie.workbench.common.dmn.api.property.background.BackgroundSet)1 RectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet)1 FontSet (org.kie.workbench.common.dmn.api.property.font.FontSet)1 FontSize (org.kie.workbench.common.dmn.api.property.styling.FontSize)1 IdUtils.getRawId (org.kie.workbench.common.dmn.client.marshaller.common.IdUtils.getRawId)1 JSITKnowledgeSource (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeSource)1