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%2Fadapter%2Fimpl%2FFixedRootImportAdvisor.java;h=cb63f0258af7bc6a24167a8267d2b239d6c695c5;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=1c851bf6fc3743ca09772b49751b791c1cb0ed6f;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/FixedRootImportAdvisor.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/FixedRootImportAdvisor.java index 1c851bf6f..cb63f0258 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/FixedRootImportAdvisor.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/FixedRootImportAdvisor.java @@ -1,48 +1,48 @@ -/******************************************************************************* - * 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.adapter.impl; - -import org.simantics.databoard.Bindings; -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.WriteOnlyGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.graph.db.IImportAdvisor; -import org.simantics.graph.representation.Root; -import org.simantics.layer0.Layer0; - -public class FixedRootImportAdvisor implements IImportAdvisor { - - protected Resource root; - - public void analyzeType(ReadGraph graph, Root root) throws DatabaseException { - } - - @Override - public Resource analyzeRoot(ReadGraph graph, Root root) throws DatabaseException { - return null; - } - - @Override - public Resource createRoot(WriteOnlyGraph graph, Root root) throws DatabaseException { - Layer0 b = graph.getService(Layer0.class); - this.root = graph.newResource(); - String name = root.name; - graph.addLiteral(this.root, b.HasName, b.NameOf, b.String, name, Bindings.STRING); - return this.root; - } - - public Resource getRoot() { - return root; - } - -} +/******************************************************************************* + * 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.adapter.impl; + +import org.simantics.databoard.Bindings; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.WriteOnlyGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.graph.db.IImportAdvisor; +import org.simantics.graph.representation.Root; +import org.simantics.layer0.Layer0; + +public class FixedRootImportAdvisor implements IImportAdvisor { + + protected Resource root; + + public void analyzeType(ReadGraph graph, Root root) throws DatabaseException { + } + + @Override + public Resource analyzeRoot(ReadGraph graph, Root root) throws DatabaseException { + return null; + } + + @Override + public Resource createRoot(WriteOnlyGraph graph, Root root) throws DatabaseException { + Layer0 b = graph.getService(Layer0.class); + this.root = graph.newResource(); + String name = root.name; + graph.addLiteral(this.root, b.HasName, b.NameOf, b.String, name, Bindings.STRING); + return this.root; + } + + public Resource getRoot() { + return root; + } + +}