X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fvariable%2FVariableRequests.java;fp=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fvariable%2FVariableRequests.java;h=1985d23318530a4ef1542d8904c9b07800eec050;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/VariableRequests.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/VariableRequests.java new file mode 100644 index 000000000..1985d2331 --- /dev/null +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/VariableRequests.java @@ -0,0 +1,128 @@ +package org.simantics.db.layer0.variable; + +import org.simantics.databoard.binding.Binding; +import org.simantics.db.ReadGraph; +import org.simantics.db.common.request.BinaryRead; +import org.simantics.db.common.request.TernaryRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.request.Read; + + +public class VariableRequests { + +// /* +// * Convenience method for getting the value of a named property. +// */ +// T getPropertyValue(ReadGraph graph, String name) throws DatabaseException; +// T getPossiblePropertyValue(ReadGraph graph, String name) throws DatabaseException; +// /* +// * Convenience method for getting the value of a named property. +// */ +// T getPropertyValue(ReadGraph graph, String name, Binding binding) throws DatabaseException; +// T getPossiblePropertyValue(ReadGraph graph, String name, Binding binding) throws DatabaseException; + + public static Read getPossiblePropertyValue(Variable variable, String name) { + return new BinaryRead(variable, name) { + + @Override + public T perform(ReadGraph graph) throws DatabaseException { + return parameter.getPossiblePropertyValue(graph, parameter2); + } + + }; + } + + public static Read getPossiblePropertyValue(Variable variable, String name, Binding binding) { + return new TernaryRead(variable, name, binding) { + + @Override + public T perform(ReadGraph graph) throws DatabaseException { + return parameter.getPossiblePropertyValue(graph, parameter2, parameter3); + } + + }; + } + +// /* +// * Gets the value of the property. Binding is default. +// */ +// T getValue(ReadGraph graph) throws DatabaseException; +// T getPossibleValue(ReadGraph graph) throws DatabaseException; +// /* +// * Gets the value of the property. Binding is explicitly given. +// */ +// T getValue(ReadGraph graph, Binding binding) throws DatabaseException; +// T getPossibleValue(ReadGraph graph, Binding binding) throws DatabaseException; +// +// /* +// * Writes a value using the given binding +// */ +// void setValue(WriteGraph graph, Object value, Binding binding) throws DatabaseException; +// /* +// * Writes a value with default binding +// */ +// void setValue(WriteGraph graph, Object value) throws DatabaseException; +// +// /* +// * Writes a value to the given property using the given binding +// */ +// void setPropertyValue(WriteGraph graph, String name, Object value, Binding binding) throws DatabaseException; +// /* +// * Writes a value to the given property using the default binding +// */ +// void setPropertyValue(WriteGraph graph, String name, Object value) throws DatabaseException; +// +// // TODO methods? +// +// /* +// * Gets a named child of this variable. A child corresponds to a '/' in URI notation +// */ +// Variable getChild(ReadGraph graph, String name) throws DatabaseException; +// Variable getPossibleChild(ReadGraph graph, String name) throws DatabaseException; +// /* +// * Gets a named property of this variable. A property corresponds to a '#' in URI notation +// */ +// Variable getProperty(ReadGraph graph, String name) throws DatabaseException; +// Variable getPossibleProperty(ReadGraph graph, String name) throws DatabaseException; +// +// /* +// * Browses all children of this variable. +// */ +// Collection browseChildren(ReadGraph graph) throws DatabaseException; +// /* +// * Browses all properties of this variable. +// */ +// Collection browseProperties(ReadGraph graph) throws DatabaseException; +// +// /* +// * Browses a single variable using the given suffix path. The suffix can contain various '/' and '#'. +// */ +// Variable browse(ReadGraph graph, String suffix) throws DatabaseException; +// Variable browsePossible(ReadGraph graph, String suffix) throws DatabaseException; +// +// /* +// * Browses a single variable using the given configuration resource. +// */ +// Variable browse(ReadGraph graph, Resource config) throws DatabaseException; +// Variable browsePossible(ReadGraph graph, Resource config) throws DatabaseException; +// +// /* +// * Gets the requested interface associated to this variable if available. +// * Examples: +// * -Resource +// * -Accessor +// * -Binding +// * +// */ +// @Deprecated +// T getInterface(ReadGraph graph, Class clazz) throws DatabaseException; +// +// T adapt(ReadGraph graph, Class clazz) throws DatabaseException; +// +// /* +// * Gets the unique URI reference for this variable. +// */ +// String getURI(ReadGraph graph) throws DatabaseException; + + +}