1 package org.simantics.db.layer0.variable;
\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
11 public class VariableRequests {
\r
14 // * Convenience method for getting the value of a named property.
\r
16 // <T> T getPropertyValue(ReadGraph graph, String name) throws DatabaseException;
\r
17 // <T> T getPossiblePropertyValue(ReadGraph graph, String name) throws DatabaseException;
\r
19 // * Convenience method for getting the value of a named property.
\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
24 public static <T> Read<T> getPossiblePropertyValue(Variable variable, String name) {
\r
25 return new BinaryRead<Variable, String, T>(variable, name) {
\r
28 public T perform(ReadGraph graph) throws DatabaseException {
\r
29 return parameter.getPossiblePropertyValue(graph, parameter2);
\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
39 public T perform(ReadGraph graph) throws DatabaseException {
\r
40 return parameter.getPossiblePropertyValue(graph, parameter2, parameter3);
\r
47 // * Gets the value of the property. Binding is default.
\r
49 // <T> T getValue(ReadGraph graph) throws DatabaseException;
\r
50 // <T> T getPossibleValue(ReadGraph graph) throws DatabaseException;
\r
52 // * Gets the value of the property. Binding is explicitly given.
\r
54 // <T> T getValue(ReadGraph graph, Binding binding) throws DatabaseException;
\r
55 // <T> T getPossibleValue(ReadGraph graph, Binding binding) throws DatabaseException;
\r
58 // * Writes a value using the given binding
\r
60 // void setValue(WriteGraph graph, Object value, Binding binding) throws DatabaseException;
\r
62 // * Writes a value with default binding
\r
64 // void setValue(WriteGraph graph, Object value) throws DatabaseException;
\r
67 // * Writes a value to the given property using the given binding
\r
69 // void setPropertyValue(WriteGraph graph, String name, Object value, Binding binding) throws DatabaseException;
\r
71 // * Writes a value to the given property using the default binding
\r
73 // void setPropertyValue(WriteGraph graph, String name, Object value) throws DatabaseException;
\r
78 // * Gets a named child of this variable. A child corresponds to a '/' in URI notation
\r
80 // Variable getChild(ReadGraph graph, String name) throws DatabaseException;
\r
81 // Variable getPossibleChild(ReadGraph graph, String name) throws DatabaseException;
\r
83 // * Gets a named property of this variable. A property corresponds to a '#' in URI notation
\r
85 // Variable getProperty(ReadGraph graph, String name) throws DatabaseException;
\r
86 // Variable getPossibleProperty(ReadGraph graph, String name) throws DatabaseException;
\r
89 // * Browses all children of this variable.
\r
91 // Collection<Variable> browseChildren(ReadGraph graph) throws DatabaseException;
\r
93 // * Browses all properties of this variable.
\r
95 // Collection<Variable> browseProperties(ReadGraph graph) throws DatabaseException;
\r
98 // * Browses a single variable using the given suffix path. The suffix can contain various '/' and '#'.
\r
100 // Variable browse(ReadGraph graph, String suffix) throws DatabaseException;
\r
101 // Variable browsePossible(ReadGraph graph, String suffix) throws DatabaseException;
\r
104 // * Browses a single variable using the given configuration resource.
\r
106 // Variable browse(ReadGraph graph, Resource config) throws DatabaseException;
\r
107 // Variable browsePossible(ReadGraph graph, Resource config) throws DatabaseException;
\r
110 // * Gets the requested interface associated to this variable if available.
\r
118 // <T> T getInterface(ReadGraph graph, Class<T> clazz) throws DatabaseException;
\r
120 // <T> T adapt(ReadGraph graph, Class<T> clazz) throws DatabaseException;
\r
123 // * Gets the unique URI reference for this variable.
\r
125 // String getURI(ReadGraph graph) throws DatabaseException;
\r