]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/VariableRequests.java
Merge commit 'ad8333027322fda6b9a8a524c7a7e15a54c52f38'
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / VariableRequests.java
1 package org.simantics.db.layer0.variable;\r
2 \r
3 import org.simantics.databoard.binding.Binding;\r
4 import org.simantics.db.ReadGraph;\r
5 import org.simantics.db.common.request.BinaryRead;\r
6 import org.simantics.db.common.request.TernaryRead;\r
7 import org.simantics.db.exception.DatabaseException;\r
8 import org.simantics.db.request.Read;\r
9 \r
10 \r
11 public class VariableRequests {\r
12 \r
13 //      /*\r
14 //       * Convenience method for getting the value of a named property.\r
15 //       */\r
16 //      <T> T getPropertyValue(ReadGraph graph, String name) throws DatabaseException;\r
17 //      <T> T getPossiblePropertyValue(ReadGraph graph, String name) throws DatabaseException;\r
18 //      /*\r
19 //       * Convenience method for getting the value of a named property.\r
20 //       */\r
21 //      <T> T getPropertyValue(ReadGraph graph, String name, Binding binding) throws DatabaseException;\r
22 //      <T> T getPossiblePropertyValue(ReadGraph graph, String name, Binding binding) throws DatabaseException;\r
23 \r
24         public static <T> Read<T> getPossiblePropertyValue(Variable variable, String name) {\r
25                 return new BinaryRead<Variable, String, T>(variable, name) {\r
26 \r
27                         @Override\r
28                         public T perform(ReadGraph graph) throws DatabaseException {\r
29                                 return parameter.getPossiblePropertyValue(graph, parameter2);\r
30                         }\r
31                         \r
32                 };\r
33         }\r
34         \r
35         public static <T> Read<T> getPossiblePropertyValue(Variable variable, String name, Binding binding) {\r
36                 return new TernaryRead<Variable, String, Binding, T>(variable, name, binding) {\r
37 \r
38                         @Override\r
39                         public T perform(ReadGraph graph) throws DatabaseException {\r
40                                 return parameter.getPossiblePropertyValue(graph, parameter2, parameter3);\r
41                         }\r
42                         \r
43                 };\r
44         }\r
45         \r
46 //      /*\r
47 //       * Gets the value of the property. Binding is default.\r
48 //       */\r
49 //      <T> T getValue(ReadGraph graph) throws DatabaseException;\r
50 //      <T> T getPossibleValue(ReadGraph graph) throws DatabaseException;\r
51 //      /*\r
52 //       * Gets the value of the property. Binding is explicitly given.\r
53 //       */\r
54 //      <T> T getValue(ReadGraph graph, Binding binding) throws DatabaseException;\r
55 //      <T> T getPossibleValue(ReadGraph graph, Binding binding) throws DatabaseException;\r
56 //      \r
57 //      /*\r
58 //       * Writes a value using the given binding\r
59 //       */\r
60 //      void setValue(WriteGraph graph, Object value, Binding binding) throws DatabaseException;\r
61 //      /*\r
62 //       * Writes a value with default binding\r
63 //       */\r
64 //      void setValue(WriteGraph graph, Object value) throws DatabaseException;\r
65 //\r
66 //      /*\r
67 //       * Writes a value to the given property using the given binding\r
68 //       */\r
69 //      void setPropertyValue(WriteGraph graph, String name, Object value, Binding binding) throws DatabaseException;\r
70 //      /*\r
71 //       * Writes a value to the given property using the default binding\r
72 //       */\r
73 //      void setPropertyValue(WriteGraph graph, String name, Object value) throws DatabaseException;\r
74 //      \r
75 //      // TODO methods?\r
76 //      \r
77 //      /*\r
78 //       * Gets a named child of this variable. A child corresponds to a '/' in URI notation\r
79 //       */\r
80 //      Variable getChild(ReadGraph graph, String name) throws DatabaseException;\r
81 //      Variable getPossibleChild(ReadGraph graph, String name) throws DatabaseException;\r
82 //      /*\r
83 //       * Gets a named property of this variable. A property corresponds to a '#' in URI notation\r
84 //       */\r
85 //      Variable getProperty(ReadGraph graph, String name) throws DatabaseException;    \r
86 //      Variable getPossibleProperty(ReadGraph graph, String name) throws DatabaseException;    \r
87 //      \r
88 //      /*\r
89 //       * Browses all children of this variable.\r
90 //       */\r
91 //      Collection<Variable> browseChildren(ReadGraph graph) throws DatabaseException;\r
92 //      /*\r
93 //       * Browses all properties of this variable.\r
94 //       */\r
95 //      Collection<Variable> browseProperties(ReadGraph graph) throws DatabaseException;\r
96 //\r
97 //      /*\r
98 //       * Browses a single variable using the given suffix path. The suffix can contain various '/' and '#'. \r
99 //       */\r
100 //      Variable browse(ReadGraph graph, String suffix) throws DatabaseException;\r
101 //      Variable browsePossible(ReadGraph graph, String suffix) throws DatabaseException;\r
102 //\r
103 //      /*\r
104 //       * Browses a single variable using the given configuration resource. \r
105 //       */\r
106 //      Variable browse(ReadGraph graph, Resource config) throws DatabaseException;\r
107 //      Variable browsePossible(ReadGraph graph, Resource config) throws DatabaseException;\r
108 //      \r
109 //      /*\r
110 //       * Gets the requested interface associated to this variable if available.\r
111 //       * Examples: \r
112 //       * -Resource\r
113 //       * -Accessor\r
114 //       * -Binding\r
115 //       * \r
116 //       */\r
117 //      @Deprecated\r
118 //      <T> T getInterface(ReadGraph graph, Class<T> clazz) throws DatabaseException;\r
119 //      \r
120 //      <T> T adapt(ReadGraph graph, Class<T> clazz) throws DatabaseException;\r
121 //      \r
122 //      /*\r
123 //       * Gets the unique URI reference for this variable.\r
124 //       */\r
125 //      String getURI(ReadGraph graph) throws DatabaseException;\r
126         \r
127         \r
128 }\r