-package org.simantics.spreadsheet.graph;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.ObjectsWithType;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.request.VariableRead;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
-\r
-public class Sheets extends VariableRead<List<String>> {\r
-\r
- public Sheets(Variable variable) {\r
- super(variable);\r
- }\r
-\r
- @Override\r
- public List<String> perform(ReadGraph graph) throws DatabaseException {\r
- Resource book = variable.getParent(graph).getRepresents(graph);\r
- Layer0 L0 = Layer0.getInstance(graph);\r
- Collection<Resource> sheets = graph.syncRequest(new ObjectsWithType(book, L0.ConsistsOf, SpreadsheetResource.getInstance(graph).Spreadsheet));\r
- List<String> result = new ArrayList<>(sheets.size());\r
- sheets.forEach(sheet -> {\r
- try {\r
- String name = graph.getPossibleRelatedValue(sheet, L0.HasName, Bindings.STRING);\r
- result.add(name);\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
- });\r
- return result;\r
- \r
- }\r
- \r
-}\r
+package org.simantics.spreadsheet.graph;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.ObjectsWithType;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.request.VariableRead;
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.layer0.Layer0;
+import org.simantics.spreadsheet.resource.SpreadsheetResource;
+
+public class Sheets extends VariableRead<List<String>> {
+
+ public Sheets(Variable variable) {
+ super(variable);
+ }
+
+ @Override
+ public List<String> perform(ReadGraph graph) throws DatabaseException {
+ Resource book = variable.getParent(graph).getRepresents(graph);
+ Layer0 L0 = Layer0.getInstance(graph);
+ Collection<Resource> sheets = graph.syncRequest(new ObjectsWithType(book, L0.ConsistsOf, SpreadsheetResource.getInstance(graph).Spreadsheet));
+ List<String> result = new ArrayList<>(sheets.size());
+ sheets.forEach(sheet -> {
+ try {
+ String name = graph.getPossibleRelatedValue(sheet, L0.HasName, Bindings.STRING);
+ result.add(name);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ });
+ return result;
+
+ }
+
+}