X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.document.server%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Fserver%2FDocumentProperties.java;fp=bundles%2Forg.simantics.document.server%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Fserver%2FDocumentProperties.java;h=72d475a4fdd0a1eb8968c715e74a51afe664a56c;hp=0000000000000000000000000000000000000000;hb=6ff5e65793559d92443fcd1eb7e8d12a3bed9e9e;hpb=3c6cb5a7e3d0151073cbfae59b1694d077873b9b diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/DocumentProperties.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/DocumentProperties.java new file mode 100644 index 000000000..72d475a4f --- /dev/null +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/DocumentProperties.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2018 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: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.document.server; + +import java.util.Collection; + +import org.simantics.db.ReadGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.Variable; + +/** + * This interface abstracts the computation of document component properties. + * The key,value -pairs returned by this interface are used to build the + * org.simantics.document.server.JSONObject values used in the document + * scene graph. + * + * @author Antti Villberg + * @since 1.36.0 + */ +public interface DocumentProperties { + + /* + * Returns the set of attribute keys for the given document component. + * Does not return null. + */ + Collection getKeys(ReadGraph graph, Variable component) throws DatabaseException; + /* + * Returns a value for a key in the key set. + * Null values are allowed and normal DatabaseException + * are thrown when evaluating the value. + */ + Object getValue(ReadGraph graph, Variable component, String key) throws DatabaseException; + +}