X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Frequest%2FPossibleVariableIndexRoot.java;h=329bf5e210acc3b537bc839c9b6d0292655a0c00;hb=228cc786f0c4c31e81e437d7e636051d09a73d2b;hp=e5d81873856c87191e0c5dc81f6a1b92922fda9d;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PossibleVariableIndexRoot.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PossibleVariableIndexRoot.java index e5d818738..329bf5e21 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PossibleVariableIndexRoot.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PossibleVariableIndexRoot.java @@ -1,41 +1,41 @@ -/******************************************************************************* - * 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.request; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.variable.Variable; -import org.simantics.layer0.Layer0; - -public class PossibleVariableIndexRoot extends VariableRead { - - public PossibleVariableIndexRoot(Variable variable) { - super(variable); - } - - @Override - public Resource perform(ReadGraph graph) throws DatabaseException { - - Layer0 L0 = Layer0.getInstance(graph); - - Resource represents = variable.getPossibleRepresents(graph); - if(represents != null) { - if(graph.isInstanceOf(represents, L0.IndexRoot)) return represents; - if(graph.getRootLibrary().equals(represents)) return null; - } - - return graph.syncRequest(new PossibleVariableIndexRoot(variable.getParent(graph))); - - } - -} +/******************************************************************************* + * 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.request; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.layer0.Layer0; + +public class PossibleVariableIndexRoot extends VariableRead { + + public PossibleVariableIndexRoot(Variable variable) { + super(variable); + } + + @Override + public Resource perform(ReadGraph graph) throws DatabaseException { + + Layer0 L0 = Layer0.getInstance(graph); + + Resource represents = variable.getPossibleRepresents(graph); + if(represents != null) { + if(graph.isInstanceOf(represents, L0.IndexRoot)) return represents; + if(graph.getRootLibrary().equals(represents)) return null; + } + + return graph.syncRequest(new PossibleVariableIndexRoot(variable.getParent(graph))); + + } + +}