X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.common%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fcommon%2Futils%2FListUtils.java;h=656dfeb27550b8acfe8e1f1c8801cbebefe6e879;hp=a197de88013dec935b1a46c3fb680c5fdf1831e9;hb=b28a9d30e47693246404bac50c7e031c1146c273;hpb=bdafd889bd2c5c11d6f9036ac791d143b23098e0 diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/ListUtils.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/ListUtils.java index a197de880..656dfeb27 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/ListUtils.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/ListUtils.java @@ -55,9 +55,14 @@ public class ListUtils { */ public static Resource create(WriteGraph g, Iterable elements) throws DatabaseException { Layer0 L0 = Layer0.getInstance(g); - return ListUtils.create(g,L0.List, L0.List_ElementWithInverse, L0.List_ElementWithInverse_Inverse, elements); + return ListUtils.create(g,L0.List, L0.List_Element, null, elements); } - + + public static Resource createWithInverses(WriteGraph g, Iterable elements) throws DatabaseException { + Layer0 L0 = Layer0.getInstance(g); + return ListUtils.create(g,L0.ListWithInverses, L0.List_ElementWithInverse, L0.List_ElementWithInverse_Inverse, elements); + } + /** * Creates a list of the given list type containing the given {@code elements}. */ @@ -85,6 +90,8 @@ public class ListUtils { Layer0 L0 = g.getService(Layer0.class); Resource list = g.newResource(); g.claim(list, L0.InstanceOf, null, type); + if (!elementPredicate.equals(L0.List_Element)) + g.claim(list, L0.List_ElementPredicate, L0.List_ElementPredicate_Inverse, elementPredicate); createExisting(g, list, elementPredicate, elementPredicateInverse, elements); return list; }