1 package org.simantics.spreadsheet.graph.adapter;
\r
3 import java.util.Map;
\r
5 import org.simantics.db.ReadGraph;
\r
6 import org.simantics.db.Resource;
\r
7 import org.simantics.db.WriteGraph;
\r
8 import org.simantics.db.exception.DatabaseException;
\r
9 import org.simantics.db.layer0.adapter.impl.EntityRemover;
\r
10 import org.simantics.spreadsheet.graph.SpreadsheetSessionManager;
\r
12 public class SpreadsheetBookRemover extends EntityRemover {
\r
14 public SpreadsheetBookRemover(Resource resource) {
\r
19 public String canRemove(ReadGraph graph, Map<Object, Object> aux) throws DatabaseException {
\r
20 return super.canRemove(graph, aux);
\r
24 public void remove(WriteGraph graph) throws DatabaseException {
\r
26 String bookURI = graph.getURI(resource);
\r
27 for (String realmId : SpreadsheetSessionManager.getInstance().getRealms()) {
\r
28 if (realmId.startsWith(bookURI)) {
\r
29 SpreadsheetSessionManager.getInstance().removeRealm(realmId);
\r
32 super.remove(graph);
\r