]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.common/src/org/simantics/db/common/request/TypeURIs.java
Rid TypicalPropertyTester of database read transactions
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / request / TypeURIs.java
diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/TypeURIs.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/TypeURIs.java
new file mode 100644 (file)
index 0000000..bc8222b
--- /dev/null
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2019 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.db.common.request;
+
+import java.util.Set;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+
+/**
+ * @author Tuukka Lehtonen
+ * @since 1.41.0, 1.35.2
+ */
+public class TypeURIs extends ResourceRead<Set<String>> {
+
+    public TypeURIs(Resource r) {
+        super(r);
+    }
+
+    @Override
+    public Set<String> perform(ReadGraph graph) throws DatabaseException {
+        Set<Resource> types = graph.getTypes(resource);
+        return graph.syncRequest(new ResourceSetURIs(types));
+    }
+
+}
\ No newline at end of file