]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/adapter/SpreadsheetBookRemover.java
Move platform to only work with JDK's >= 11
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / src / org / simantics / spreadsheet / graph / adapter / SpreadsheetBookRemover.java
1 package org.simantics.spreadsheet.graph.adapter;
2
3 import java.util.Map;
4
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.Resource;
7 import org.simantics.db.WriteGraph;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.db.layer0.adapter.impl.EntityRemover;
10 import org.simantics.spreadsheet.graph.SpreadsheetSessionManager;
11
12 public class SpreadsheetBookRemover extends EntityRemover {
13
14     public SpreadsheetBookRemover(Resource resource) {
15         super(resource);
16     }
17     
18     @Override
19     public String canRemove(ReadGraph graph, Map<Object, Object> aux) throws DatabaseException {
20         return super.canRemove(graph, aux);
21     }
22     
23     @Override
24     public void remove(WriteGraph graph) throws DatabaseException {
25         
26         String bookURI = graph.getPossibleURI(resource);
27         if (bookURI != null) {
28             for (String realmId : SpreadsheetSessionManager.getInstance().getRealms()) {
29                 if (realmId.startsWith(bookURI)) {
30                     SpreadsheetSessionManager.getInstance().removeRealm(graph, realmId);
31                 }
32             }
33         }
34         super.remove(graph);
35         
36     }
37
38 }