Search in sources :

Example 6 with GuidedDecisionTableEditorGraphModel

use of org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphFileIndexer method fillIndexBuilder.

@Override
public DefaultIndexBuilder fillIndexBuilder(final Path path) throws Exception {
    final String content = ioService.readAllString(path);
    final GuidedDecisionTableEditorGraphModel model = GuidedDTGraphXMLPersistence.getInstance().unmarshal(content);
    final DefaultIndexBuilder builder = getIndexBuilder(path);
    if (builder == null) {
        return null;
    }
    final GuidedDecisionTableGraphModelIndexVisitor visitor = new GuidedDecisionTableGraphModelIndexVisitor(builder, model);
    visitor.visit();
    addReferencedResourcesToIndexBuilder(builder, visitor);
    return builder;
}
Also used : GuidedDecisionTableEditorGraphModel(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel) DefaultIndexBuilder(org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder)

Example 7 with GuidedDecisionTableEditorGraphModel

use of org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel in project drools-wb by kiegroup.

the class GuidedDTGraphXMLPersistenceTest method checkUnmarshallingEmptyString.

@Test
public void checkUnmarshallingEmptyString() {
    final GuidedDecisionTableEditorGraphModel model = GuidedDTGraphXMLPersistence.getInstance().unmarshal("");
    assertEmptyModel(model);
}
Also used : GuidedDecisionTableEditorGraphModel(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel) Test(org.junit.Test)

Example 8 with GuidedDecisionTableEditorGraphModel

use of org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel in project drools-wb by kiegroup.

the class GuidedDTGraphXMLPersistenceTest method checkUnmarshallingModel.

@Test
public void checkUnmarshallingModel() {
    final GuidedDecisionTableEditorGraphModel model = GuidedDTGraphXMLPersistence.getInstance().unmarshal(emptyModelXml);
    assertEmptyModel(model);
}
Also used : GuidedDecisionTableEditorGraphModel(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel) Test(org.junit.Test)

Example 9 with GuidedDecisionTableEditorGraphModel

use of org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel in project drools-wb by kiegroup.

the class GuidedDTGraphXMLPersistenceTest method checkUnmarshallingNull.

@Test
public void checkUnmarshallingNull() {
    final GuidedDecisionTableEditorGraphModel model = GuidedDTGraphXMLPersistence.getInstance().unmarshal(null);
    assertEmptyModel(model);
}
Also used : GuidedDecisionTableEditorGraphModel(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel) Test(org.junit.Test)

Example 10 with GuidedDecisionTableEditorGraphModel

use of org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel in project drools-wb by kiegroup.

the class GuidedDTGraphXMLPersistenceTest method checkMarshallingModelWithEntryPosition.

@Test
public void checkMarshallingModelWithEntryPosition() {
    final Path path = PathFactory.newPath("path", "default://path");
    final GuidedDecisionTableEditorGraphModel model = new GuidedDecisionTableEditorGraphModel();
    model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(path, path, 100.0, 200.0));
    final String xml = GuidedDTGraphXMLPersistence.getInstance().marshal(model);
    assertNotNull(xml);
    assertEqualsIgnoreWhitespace("<graph>\n" + "  <entries>\n" + "    <entry>\n" + "      <pathHead class=\"org.uberfire.backend.vfs.PathFactory$PathImpl\">\n" + "        <uri>default://path</uri>\n" + "        <fileName>path</fileName>\n" + "        <attributes/>\n" + "        <hasVersionSupport>false</hasVersionSupport>\n" + "      </pathHead>\n" + "      <pathVersion class=\"org.uberfire.backend.vfs.PathFactory$PathImpl\" reference=\"../pathHead\"/>\n" + "      <x>100.0</x>\n" + "      <y>200.0</y>\n" + "    </entry>\n" + "  </entries>\n" + "</graph>", xml);
}
Also used : Path(org.uberfire.backend.vfs.Path) GuidedDecisionTableEditorGraphModel(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel) Test(org.junit.Test)

Aggregations

GuidedDecisionTableEditorGraphModel (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel)22 Test (org.junit.Test)16 Path (org.uberfire.backend.vfs.Path)9 URI (java.net.URI)3 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)3 Map (java.util.Map)2 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)2 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)2 GuidedDecisionTableEditorGraphContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent)2 FileExtensionFilter (org.guvnor.common.services.backend.file.FileExtensionFilter)2 Overview (org.guvnor.common.services.shared.metadata.model.Overview)2 ObservablePath (org.uberfire.backend.vfs.ObservablePath)2 ResourceOpenedEvent (org.uberfire.workbench.events.ResourceOpenedEvent)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 PostConstruct (javax.annotation.PostConstruct)1