private void versionEntriesPaths(final GuidedDecisionTableEditorGraphModel model) { for (GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry entry : model.getEntries()) { entry.setPathVersion(getLatestVersionPath(entry.getPathHead())); } }
public static synchronized DateConverter getInstance() { if (INSTANCE == null) { INSTANCE = new JVMDateConverter(); } return INSTANCE; }
@Override public boolean equals(Object o) { return super.equals(o); } };
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; }
@Override public Path save(final Path path, final List<GuidedDecisionTableEditorContent> content, final Metadata metadata, final String comment) { content.forEach(c -> { editorService.save(c.getCurrentPath(), c.getModel(), c.getOverview().getMetadata(), comment); }); return path; } }
public Set<KProperty<?>> visit() { model.getEntries().stream().forEach(e -> addSharedReference(e.getPathHead().toURI(), PartType.PATH)); results.addAll(builder.build()); return results; } }
private void assertEmptyModel( final GuidedDecisionTableEditorGraphModel model ) { assertNotNull( model ); assertNotNull( model.getEntries() ); assertEquals( 0, model.getEntries().size() ); }
public String marshal( final GuidedDecisionTableEditorGraphModel content ) { if ( content == null ) { return xt.toXML( new GuidedDecisionTableEditorGraphModel() ); } try { return xt.toXML( content ); } catch ( Exception e ) { logger.error( "Unable to marshal model. Returning a XML for empty GuidedDecisionTableEditorGraphModel.", e ); } return xt.toXML( new GuidedDecisionTableEditorGraphModel() ); }
private GuidedDecisionTableEditorContent makeDecisionTableContent() { final GuidedDecisionTable52 model = mock(GuidedDecisionTable52.class); final PackageDataModelOracleBaselinePayload dmoBaseline = mock(PackageDataModelOracleBaselinePayload.class); final Set<PortableWorkDefinition> workItemDefinitions = Collections.emptySet(); final Overview overview = mock(Overview.class); final GuidedDecisionTableEditorContent dtContent = new GuidedDecisionTableEditorContent(model, workItemDefinitions, overview, dmoBaseline); return dtContent; }
protected GuidedDecisionTableEditorGraphContent makeDecisionTableGraphContent(final int hashCode) { final GuidedDecisionTableEditorGraphModel model = new GuidedDecisionTableEditorGraphModel() { @Override public int hashCode() { return hashCode; } @Override public boolean equals(Object o) { return super.equals(o); } }; return new GuidedDecisionTableEditorGraphContent(model, mock(Overview.class)); }
int getCurrentHashCode() { return buildModelFromEditor().hashCode(); }
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; }
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 void assertEmptyModel( final GuidedDecisionTableEditorGraphModel model ) { assertNotNull( model ); assertNotNull( model.getEntries() ); assertEquals( 0, model.getEntries().size() ); }
public GuidedDecisionTableEditorGraphModel unmarshal( final String xml ) { if ( xml == null || xml.trim().equals( "" ) ) { return new GuidedDecisionTableEditorGraphModel(); } try { final Object o = xt.fromXML( xml ); return (GuidedDecisionTableEditorGraphModel) o; } catch ( Exception e ) { logger.error( "Unable to unmarshal content. Returning an empty GuidedDecisionTableEditorGraphModel.", e ); } return new GuidedDecisionTableEditorGraphModel(); }
@Override protected GuidedDecisionTableEditorGraphContent constructContent(final Path path, final Overview overview) { final GuidedDecisionTableEditorGraphModel model = load(path); //Signal opening to interested parties resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo)); return new GuidedDecisionTableEditorGraphContent(model, overview); }
int getCurrentHashCode() { return buildModelFromEditor().hashCode(); }
@Override @OnMayClose public boolean mayClose() { setMayCloseHandler(this::doMayCloseGraph); boolean mayClose = mayClose(originalGraphHash, buildModelFromEditor().hashCode()); setMayCloseHandler(this::doMayCloseDocument); mayClose = mayClose && super.mayClose(); return mayClose; }
@Override @OnMayClose public boolean mayClose() { setMayCloseHandler(this::doMayCloseGraph); boolean mayClose = mayClose(originalGraphHash, buildModelFromEditor().hashCode()); setMayCloseHandler(this::doMayCloseDocument); mayClose = mayClose && super.mayClose(); return mayClose; }