X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fvariable%2FStandardResourceVariableSpaceManipulator.java;h=f1898d568af461834e2c474bccf1c4867d6494e0;hp=15c97883b32dbeb6655674fc3f46c54a553c31f0;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardResourceVariableSpaceManipulator.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardResourceVariableSpaceManipulator.java index 15c97883b..f1898d568 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardResourceVariableSpaceManipulator.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardResourceVariableSpaceManipulator.java @@ -1,54 +1,54 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.db.layer0.variable; - -import org.simantics.databoard.Bindings; -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.layer0.Layer0; - -public class StandardResourceVariableSpaceManipulator implements VariableSpaceManipulator { - - final Variable target; - - public StandardResourceVariableSpaceManipulator(Variable target) { - this.target = target; - } - - public Variable createVariable(WriteGraph graph, String rvi) throws DatabaseException { - return null; - } - - public Variable createProperty(WriteGraph graph, String name) throws DatabaseException { - if("HasDescription".equals(name)) { - Layer0 l0 = Layer0.getInstance(graph); - Resource targetResource = target.getInterface(graph, Resource.class); - graph.claimLiteral(targetResource, l0.HasDescription, "", Bindings.STRING); - return target.getProperty(graph, "HasDescription"); - } - return null; - } - - public Variable createChild(WriteGraph graph, String name, Object content) throws DatabaseException { - return null; - } - - @Override - public void apply(WriteGraph graph, Modification modification) - throws DatabaseException { - for(PropertyCreationData data : modification.newProperties) { - createProperty(graph, data.name); - } - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.db.layer0.variable; + +import org.simantics.databoard.Bindings; +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; + +public class StandardResourceVariableSpaceManipulator implements VariableSpaceManipulator { + + final Variable target; + + public StandardResourceVariableSpaceManipulator(Variable target) { + this.target = target; + } + + public Variable createVariable(WriteGraph graph, String rvi) throws DatabaseException { + return null; + } + + public Variable createProperty(WriteGraph graph, String name) throws DatabaseException { + if("HasDescription".equals(name)) { + Layer0 l0 = Layer0.getInstance(graph); + Resource targetResource = target.getInterface(graph, Resource.class); + graph.claimLiteral(targetResource, l0.HasDescription, "", Bindings.STRING); + return target.getProperty(graph, "HasDescription"); + } + return null; + } + + public Variable createChild(WriteGraph graph, String name, Object content) throws DatabaseException { + return null; + } + + @Override + public void apply(WriteGraph graph, Modification modification) + throws DatabaseException { + for(PropertyCreationData data : modification.newProperties) { + createProperty(graph, data.name); + } + } + +}