public Set<KProperty<?>> visit() { model.getEntries().stream().forEach(e -> addSharedReference(e.getPathHead().toURI(), PartType.PATH)); results.addAll(builder.build()); return results; } }
private void versionEntriesPaths(final GuidedDecisionTableEditorGraphModel model) { for (GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry entry : model.getEntries()) { entry.setPathVersion(getLatestVersionPath(entry.getPathHead())); } }
private void assertEmptyModel( final GuidedDecisionTableEditorGraphModel model ) { assertNotNull( model ); assertNotNull( model.getEntries() ); assertEquals( 0, model.getEntries().size() ); }
private void assertEmptyModel( final GuidedDecisionTableEditorGraphModel model ) { assertNotNull( model ); assertNotNull( model.getEntries() ); assertEquals( 0, model.getEntries().size() ); }
private void updateGraphElementPath(final Path source, final Path destination, final Path graphPath) { final GuidedDecisionTableEditorGraphModel dtGraphModel = dtableGraphService.load(graphPath); final Set<GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry> dtGraphEntries = dtGraphModel.getEntries(); dtGraphEntries.stream().filter((e) -> e.getPathHead().equals(source)).forEach((e) -> e.setPathVersion(destination)); ioService.write(Paths.convert(graphPath), GuidedDTGraphXMLPersistence.getInstance().marshal(dtGraphModel), commentedOptionFactory.makeCommentedOption("Updated Path version for [" + source.toURI() + "] to [" + destination.toURI() + "].")); }
void updateGraphReferences(final Path path, final Path graphPath) { final GuidedDecisionTableEditorGraphModel dtGraphModel = dtableGraphService.load(graphPath); final Set<GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry> dtGraphEntries = dtGraphModel.getEntries(); dtGraphEntries.removeIf((e) -> e.getPathHead().equals(path)); ioService.write(Paths.convert(graphPath), GuidedDTGraphXMLPersistence.getInstance().marshal(dtGraphModel), commentedOptionFactory.makeCommentedOption("File [" + path.toURI() + "] deleted.")); } }
private RemoteCallback<GuidedDecisionTableEditorGraphContent> getLoadGraphContentSuccessCallback() { return (content) -> { this.content = content; this.originalGraphHash = content.getModel().hashCode(); this.concurrentUpdateSessionInfo = null; final GuidedDecisionTableEditorGraphModel model = content.getModel(); final Set<GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry> modelEntries = model.getEntries(); initialiseEditorTabsWhenNoDocuments(); if (modelEntries == null || modelEntries.isEmpty()) { view.hideBusyIndicator(); return; } loadGraphLatch = new LoadGraphLatch(modelEntries.size(), getSelectDecisionTableCommand(modelEntries.iterator().next().getPathHead()), () -> { originalGraphHash = buildModelFromEditor().hashCode(); modeller.getView().getGridPanel().setFocus(true); }); modelEntries.stream().forEach(loadGraphLatch::loadDocumentGraphEntry); }; }
private RemoteCallback<GuidedDecisionTableEditorGraphContent> getLoadGraphContentSuccessCallback() { return (content) -> { this.content = content; this.originalGraphHash = content.getModel().hashCode(); this.concurrentUpdateSessionInfo = null; final GuidedDecisionTableEditorGraphModel model = content.getModel(); final Set<GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry> modelEntries = model.getEntries(); initialiseEditorTabsWhenNoDocuments(); if (modelEntries == null || modelEntries.isEmpty()) { view.hideBusyIndicator(); return; } loadGraphLatch = new LoadGraphLatch(modelEntries.size(), getSelectDecisionTableCommand(modelEntries.iterator().next().getPathHead()), () -> { originalGraphHash = buildModelFromEditor().hashCode(); modeller.getView().getGridPanel().setFocus(true); }); modelEntries.stream().forEach(loadGraphLatch::loadDocumentGraphEntry); }; }
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; }
void updateGraphElementPath(final Path source, final Path destination, final Path graphPath) { final GuidedDecisionTableEditorGraphModel dtGraphModel = dtableGraphService.load(graphPath); final Set<GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry> dtGraphEntries = dtGraphModel.getEntries(); dtGraphEntries.forEach((e) -> { if (e.getPathHead().equals(source)) { e.setPathHead(destination); e.setPathVersion(destination); } }); ioService.write(Paths.convert(graphPath), GuidedDTGraphXMLPersistence.getInstance().marshal(dtGraphModel), commentedOptionFactory.makeCommentedOption("File [" + source.toURI() + "] renamed to [" + destination.toURI() + "].")); } }
model.getEntries().add( new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry( path, path ) ); when( dtableGraphService.load( any( Path.class ) ) ).thenReturn( model ); final GuidedDecisionTableEditorGraphModel newModel = GuidedDTGraphXMLPersistence.getInstance().unmarshal( modelXml ); assertEquals( 0, newModel.getEntries().size() );
model.getEntries().add( new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry( path, path ) ); when( dtableGraphService.load( any( Path.class ) ) ).thenReturn( model ); final GuidedDecisionTableEditorGraphModel newModel = GuidedDTGraphXMLPersistence.getInstance().unmarshal( modelXml ); assertEquals( 0, newModel.getEntries().size() );
@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); } }
dtGraphContent.getModel().getEntries().add(dtGraphEntry);
@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 ); }
@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 ); }
@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 ); }
model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(vfsDtable1Path, vfsDtable1Path)); model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(vfsDtable2Path, vfsDtable2Path)); final String xml = GuidedDTGraphXMLPersistence.getInstance().marshal(model);