model.getEntries().add( new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry( path, path ) ); when( dtableGraphService.load( any( Path.class ) ) ).thenReturn( model );
model.getEntries().add( new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry( path, path ) ); when( dtableGraphService.load( any( Path.class ) ) ).thenReturn( model );
dtContent); final GuidedDecisionTableGraphEntry dtGraphEntry = new GuidedDecisionTableGraphEntry(dtPath, dtPath); dtGraphContent.getModel().getEntries().add(dtGraphEntry);
dtContent); final GuidedDecisionTableGraphEntry dtGraphEntry = new GuidedDecisionTableGraphEntry(dtPath, dtPath); dtGraphContent.getModel().getEntries().add(dtGraphEntry);
dtGraphModel.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(path, path)); when(dtableGraphService.load(any(Path.class))).thenReturn(dtGraphModel);
dtGraphModel.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(path, path)); when(dtableGraphService.load(any(Path.class))).thenReturn(dtGraphModel);
model.getEntries().add( new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry( source, source ) ); when( dtableGraphService.load( any( Path.class ) ) ).thenReturn( model );
dtContent); final GuidedDecisionTableGraphEntry dtGraphEntry = new GuidedDecisionTableGraphEntry(dtPath, dtPath); dtGraphContent.getModel().getEntries().add(dtGraphEntry);
model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(vfsDtable1Path, vfsDtable1Path)); model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(vfsDtable2Path, vfsDtable2Path)); final String xml = GuidedDTGraphXMLPersistence.getInstance().marshal(model);
dtContent); final GuidedDecisionTableGraphEntry dtGraphEntry = new GuidedDecisionTableGraphEntry(dtPath, dtPath); dtGraphContent.getModel().getEntries().add(dtGraphEntry);
model.getEntries().add( new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry( source, source ) ); when( dtableGraphService.load( any( Path.class ) ) ).thenReturn( model );
dtContent); final GuidedDecisionTableGraphEntry dtGraphEntry = new GuidedDecisionTableGraphEntry(dtPath, dtPath); dtGraphContent.getModel().getEntries().add(dtGraphEntry);
model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(vfsDtable1Path, vfsDtable1Path)); model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(vfsDtable2Path, vfsDtable2Path)); final String xml = GuidedDTGraphXMLPersistence.getInstance().marshal(model);
@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 ); }
@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 ); }
@Test public void checkMarshallingModelWithoutEntryPosition() { final Path path = PathFactory.newPath( "path", "default://path" ); final GuidedDecisionTableEditorGraphModel model = new GuidedDecisionTableEditorGraphModel(); model.getEntries().add( new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry( path, path ) ); 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" + " </entry>\n" + " </entries>\n" + "</graph>", xml ); }
@Override public Path create(final Path context, final String fileName, final GuidedDecisionTableEditorGraphModel model, final String comment) { try { final org.uberfire.java.nio.file.Path nioPath = Paths.convert(context).resolve(fileName); if (ioService.exists(nioPath)) { throw new FileAlreadyExistsException(nioPath.toString()); } final Set<Path> paths = getLinkedDecisionTablesInPackage(context); paths.forEach((path) -> model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(path, getLatestVersionPath(path)))); ioService.write(nioPath, GuidedDTGraphXMLPersistence.getInstance().marshal(model), commentedOptionFactory.makeCommentedOption(comment)); final Path newPath = Paths.convert(nioPath); return newPath; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }
@Test public void checkMarshallingModelWithoutEntryPosition() { final Path path = PathFactory.newPath( "path", "default://path" ); final GuidedDecisionTableEditorGraphModel model = new GuidedDecisionTableEditorGraphModel(); model.getEntries().add( new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry( path, path ) ); 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" + " </entry>\n" + " </entries>\n" + "</graph>", xml ); }
GuidedDecisionTableEditorGraphModel buildModelFromEditor() { final GuidedDecisionTableEditorGraphModel model = new GuidedDecisionTableEditorGraphModel(); for (GuidedDecisionTableView.Presenter dtPresenter : modeller.getAvailableDecisionTables()) { model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(dtPresenter.getLatestPath(), dtPresenter.getCurrentPath(), dtPresenter.getView().getX(), dtPresenter.getView().getY())); } return model; }
GuidedDecisionTableEditorGraphModel buildModelFromEditor() { final GuidedDecisionTableEditorGraphModel model = new GuidedDecisionTableEditorGraphModel(); for (GuidedDecisionTableView.Presenter dtPresenter : modeller.getAvailableDecisionTables()) { model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(dtPresenter.getLatestPath(), dtPresenter.getCurrentPath(), dtPresenter.getView().getX(), dtPresenter.getView().getY())); } return model; }