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