Graphiti and EMFStore [message #1277687] |
Wed, 26 March 2014 10:17 |
Djordje Stanojevic Messages: 14 Registered: February 2014 |
Junior Member |
|
|
Hi All,
I am newbie in Graphiti and modeling world.
I'm trying to store my Graphiti Diagram, with all objects that it contains, in EMFStore, through emfstore API.
Can I do this at all? And if I can, how?
I tried to do this in resourcesSaved method of DiagramTypeProvider, but i got "Commit cancelled by checksum error handler due to invalid checksum" error.
Here is part of my code
System.out.println("Client starting...");
ESWorkspace workspace = ESWorkspaceProvider.INSTANCE.getWorkspace();
workspace.addServer(Application.localServer);
for (ESServer existingServer : workspace.getServers()) {
if (existingServer != Application.localServer) {
try {
workspace.removeServer(existingServer);
} catch (ESServerNotFoundException e) {
e.printStackTrace();
}
}
}
final ESLocalProject demoProject = workspace.createLocalProject("DemoProject");
for (ESLocalProject existingLocalProject : workspace.getLocalProjects()) {
if (existingLocalProject != demoProject) {
try {
existingLocalProject.delete(new ESSystemOutProgressMonitor());
} catch (IOException e) {
e.printStackTrace();
}
}
}
String username = "super";
String password = "super";
ESUsersession usersession = Application.localServer.login(username, password);
ESRemoteProject remoteDemoProject = demoProject.shareProject(usersession, new ESSystemOutProgressMonitor());
for (ESRemoteProject existingRemoteProject : Application.localServer.getRemoteProjects(usersession)) {
if (!existingRemoteProject.getGlobalProjectId().equals(remoteDemoProject.getGlobalProjectId())) {
existingRemoteProject.delete(usersession, new NullProgressMonitor());
}
}
TransactionalEditingDomain editingDomain =
TransactionUtil.getEditingDomain(diagram);
editingDomain.getCommandStack().execute(new
RecordingCommand(editingDomain) {
@Override
protected void doExecute() {
demoProject.getModelElements().add(diagram);
}
});
// Goal goal = GoalsFactory.eINSTANCE.createGoal();
demoProject.commit("Diagram commited", ESCommitCallback.NOCALLBACK, new ESSystemOutProgressMonitor());
Any help is appreciated
Djordje
Djordje Stanojevic
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04851 seconds