]> gerrit.simantics Code Review - simantics/platform.git/blob
cf7c9ce7a6f13120a75d40424b3c5f89642e0a3c
[simantics/platform.git] /
1 package org.simantics.spreadsheet.graph.adapter;\r
2 \r
3 import java.util.Map;\r
4 \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
11 \r
12 public class SpreadsheetBookRemover extends EntityRemover {\r
13 \r
14     public SpreadsheetBookRemover(Resource resource) {\r
15         super(resource);\r
16     }\r
17     \r
18     @Override\r
19     public String canRemove(ReadGraph graph, Map<Object, Object> aux) throws DatabaseException {\r
20         return super.canRemove(graph, aux);\r
21     }\r
22     \r
23     @Override\r
24     public void remove(WriteGraph graph) throws DatabaseException {\r
25         \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
30             }\r
31         }\r
32         super.remove(graph);\r
33         \r
34     }\r
35 \r
36 }\r