1 package org.simantics.spreadsheet.graph;
3 import java.util.ArrayList;
4 import java.util.Collection;
7 import org.simantics.databoard.Bindings;
8 import org.simantics.db.ReadGraph;
9 import org.simantics.db.Resource;
10 import org.simantics.db.common.request.ObjectsWithType;
11 import org.simantics.db.exception.DatabaseException;
12 import org.simantics.db.layer0.request.VariableRead;
13 import org.simantics.db.layer0.variable.Variable;
14 import org.simantics.layer0.Layer0;
15 import org.simantics.spreadsheet.resource.SpreadsheetResource;
17 public class Sheets extends VariableRead<List<String>> {
19 public Sheets(Variable variable) {
24 public List<String> perform(ReadGraph graph) throws DatabaseException {
25 Resource book = variable.getParent(graph).getRepresents(graph);
26 Layer0 L0 = Layer0.getInstance(graph);
27 Collection<Resource> sheets = graph.syncRequest(new ObjectsWithType(book, L0.ConsistsOf, SpreadsheetResource.getInstance(graph).Spreadsheet));
28 List<String> result = new ArrayList<>(sheets.size());
29 sheets.forEach(sheet -> {
31 String name = graph.getPossibleRelatedValue(sheet, L0.HasName, Bindings.STRING);
33 } catch (Exception e) {