]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/ProfileUtils.java
989b7bb05d5aaff05d429a6e6d070842e73834c7
[simantics/platform.git] / bundles / org.simantics.scenegraph.profile / src / org / simantics / scenegraph / profile / ProfileUtils.java
1 package org.simantics.scenegraph.profile;
2
3 import java.util.Collections;
4 import java.util.List;
5
6 import org.simantics.db.ReadGraph;
7 import org.simantics.db.Resource;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.diagram.stubs.DiagramResource;
10
11 public class ProfileUtils {
12
13         public static List<Resource> getProfileChildren(ReadGraph graph, Resource profile) throws DatabaseException {
14                 DiagramResource DIA = DiagramResource.getInstance(graph);
15                 Resource entries = graph.getPossibleObject(profile, DIA.HasEntries);
16                 if(entries == null) return Collections.emptyList();
17                 return getProfileChildrenFromEntries(graph, entries);
18         }
19
20         public static List<Resource> getProfileChildrenFromEntries(ReadGraph graph, Resource entries) throws DatabaseException {
21                 DiagramResource DIA = DiagramResource.getInstance(graph);
22                 return graph.getRelatedValue2(entries, DIA.Profile_children, entries);
23         }
24
25 }