]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/ProfileUtils.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scenegraph.profile / src / org / simantics / scenegraph / profile / ProfileUtils.java
diff --git a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/ProfileUtils.java b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/ProfileUtils.java
new file mode 100644 (file)
index 0000000..b35ccd9
--- /dev/null
@@ -0,0 +1,25 @@
+package org.simantics.scenegraph.profile;\r
+\r
+import java.util.Collections;\r
+import java.util.List;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.diagram.stubs.DiagramResource;\r
+\r
+public class ProfileUtils {\r
+\r
+       public static List<Resource> getProfileChildren(ReadGraph graph, Resource profile) throws DatabaseException {\r
+               DiagramResource DIA = DiagramResource.getInstance(graph);\r
+               Resource entries = graph.getPossibleObject(profile, DIA.HasEntries);\r
+               if(entries == null) return Collections.emptyList();\r
+               return getProfileChildrenFromEntries(graph, entries);\r
+       }\r
+\r
+       public static List<Resource> getProfileChildrenFromEntries(ReadGraph graph, Resource entries) throws DatabaseException {\r
+               DiagramResource DIA = DiagramResource.getInstance(graph);\r
+               return graph.getRelatedValue2(entries, DIA.Profile_children, entries);\r
+       }\r
+\r
+}\r