From: Alpi Rimppi Date: Wed, 28 Aug 2019 08:18:30 +0000 (+0300) Subject: Set resources immutable X-Git-Tag: v1.43.0~136^2~68 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F64%2F3164%2F2;p=simantics%2Fplatform.git Set resources immutable gitlab #369 Change-Id: Id1ddcc8253339ac7ab60f2772ab53d5c06547b19 --- diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/CommonDBUtils.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/CommonDBUtils.java index dcd3939a4..747e43cf1 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/CommonDBUtils.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/CommonDBUtils.java @@ -318,6 +318,11 @@ public class CommonDBUtils { return xs.isClusterLoaded(clusterUID); } + public static void setImmutable(ReadGraph graph, Resource resource, boolean value) throws DatabaseException { + XSupport xs = graph.getService(XSupport.class); + xs.setImmutable(resource, value); + } + public static Type getSCLType(ReadGraph graph, RuntimeEnvironment runtimeEnvironment, String typeText) throws DatabaseException { try { return Environments.getType(runtimeEnvironment.getEnvironment(), typeText); diff --git a/bundles/org.simantics.scl.db/scl/Simantics/DBSupport.scl b/bundles/org.simantics.scl.db/scl/Simantics/DBSupport.scl index f6d1453f0..eddcba75b 100644 --- a/bundles/org.simantics.scl.db/scl/Simantics/DBSupport.scl +++ b/bundles/org.simantics.scl.db/scl/Simantics/DBSupport.scl @@ -9,6 +9,7 @@ importJava "org.simantics.db.common.utils.CommonDBUtils" where garbageResources :: [Resource] clusterUIDOfResource :: Resource -> ClusterUID isClusterLoaded :: ClusterUID -> Boolean + setImmutable :: Resource -> Boolean -> () importJava "org.simantics.scl.db.SCLFunctions" where collectClusters :: ()