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