use of org.kie.workbench.common.stunner.project.diagram.ProjectDiagram in project kie-wb-common by kiegroup.
the class ProjectDiagramServiceImplTest method testGetDiagramByPath.
@Test
public void testGetDiagramByPath() {
when(diagramServiceController.getDiagramByPath(path)).thenReturn(diagram);
ProjectDiagram result = diagramService.getDiagramByPath(path);
verify(diagramServiceController, times(1)).getDiagramByPath(path);
assertEquals(result, diagram);
}
use of org.kie.workbench.common.stunner.project.diagram.ProjectDiagram in project kie-wb-common by kiegroup.
the class AbstractProjectDiagramEditor method save.
/**
* Considering the diagram valid at this point ,
* it delegates the save operation to the diagram services bean.
* @param commitMessage The commit's message.
*/
@Override
@SuppressWarnings("unchecked")
protected void save(final String commitMessage) {
super.save(commitMessage);
showLoadingViews();
// Update diagram's image data as thumbnail.
final CanvasHandler canvasHandler = getSession().getCanvasHandler();
final Diagram diagram = canvasHandler.getDiagram();
// Perform update operation remote call.
projectDiagramServices.saveOrUpdate(versionRecordManager.getCurrentPath(), getDiagram(), metadata, commitMessage, new ServiceCallback<ProjectDiagram>() {
@Override
public void onSuccess(final ProjectDiagram item) {
getSaveSuccessCallback(item.hashCode());
onSaveSuccess();
hideLoadingViews();
}
@Override
public void onError(final ClientRuntimeError error) {
onSaveError(error);
}
});
}
Aggregations