1 package org.simantics.charts.query;
5 import org.simantics.Simantics;
6 import org.simantics.charts.ontology.ChartResource;
7 import org.simantics.databoard.Bindings;
8 import org.simantics.db.Resource;
9 import org.simantics.db.Session;
10 import org.simantics.db.WriteGraph;
11 import org.simantics.db.common.request.WriteRequest;
12 import org.simantics.db.exception.DatabaseException;
15 * @author Tuukka Lehtonen
18 public class HideChartItems extends WriteRequest {
20 private final Boolean hide;
21 private final List<Resource> items;
23 public HideChartItems(boolean hide, List<Resource> items) {
29 public void perform(WriteGraph graph) throws DatabaseException {
30 hideChartItems(graph, hide, items);
33 public static void hideChartItems(WriteGraph graph, boolean hide, List<Resource> items) throws DatabaseException {
34 ChartResource CHART = ChartResource.getInstance(graph);
35 for (Resource item : items) {
36 if (graph.isInstanceOf(item, CHART.Chart_Item)) {
37 graph.claimLiteral(item, CHART.Chart_Item_hidden, hide, Bindings.BOOLEAN);
42 public static void hideChartItems(boolean hide, List<Resource> items) throws DatabaseException {
43 Session s = Simantics.getSession();
45 s.syncRequest(new HideChartItems(hide, items));