]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/Entry.java
Added new field TypeId to dependency index for exact type searching
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / genericrelation / Entry.java
index 8da8209499665c4f4ff9c60d0889d9a39d9a46ef..50d723ec9b1ae7d77a8c54ce4358cdafd89e8bb6 100644 (file)
@@ -1,5 +1,7 @@
 package org.simantics.db.layer0.genericrelation;
 
+import java.util.Set;
+
 import org.simantics.databoard.Bindings;
 import org.simantics.datatypes.literal.GUID;
 import org.simantics.db.ReadGraph;
@@ -22,13 +24,10 @@ class Entry implements Comparable<Entry> {
                this.parent = graph.getPossibleObject(resource, L0.PartOf);
                this.resource = resource;
                this.name = graph.getPossibleRelatedValue(resource, L0.HasName, Bindings.STRING);
-               this.types = graph.syncRequest(new TypeString(L0, graph.getTypes(resource)));
-               this.id = idFromGUID(graph.getPossibleRelatedValue(resource, L0.identifier, GUID.BINDING));
-       }
-       
-       private static String idFromGUID(GUID guid) {
-               if(guid == null) return "";
-               return guid.indexString();
+               Set<Resource> typeSet = graph.getTypes(resource);
+               this.types = graph.syncRequest(new TypeString(L0, typeSet));
+               this.id = IndexQueries.idFromGUID(graph.getPossibleRelatedValue(resource, L0.identifier, GUID.BINDING));
+               this.typeId = IndexQueries.toResourceIdString(typeSet);
        }
 
        Entry(ReadGraph graph, Resource resource) throws DatabaseException {
@@ -41,6 +40,7 @@ class Entry implements Comparable<Entry> {
        String types;
        String name;
        String id;
+       String typeId;
        Resource principalType;
 
        @Override