X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Futil%2FTGConfigurer.java;h=4e23fa5750968ab64624843146da008ddc9ce9c9;hp=350f4ca31d966b5bda61e7e570286e4488a8a0e6;hb=refs%2Fchanges%2F02%2F1402%2F2;hpb=dbe0a77f0869111219b69d412d0bb90d17c391c1 diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/TGConfigurer.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/TGConfigurer.java index 350f4ca31..4e23fa575 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/TGConfigurer.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/TGConfigurer.java @@ -13,14 +13,15 @@ import org.simantics.db.common.request.PossibleIndexRoot; import org.simantics.db.common.utils.CommonDBUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.SubgraphExtent.ExtentStatus; -import org.simantics.db.layer0.util.TransferableGraphConfiguration2.RootSpec; +import org.simantics.db.layer0.util.TransferableGraphConfiguration2.SeedSpec; +import org.simantics.db.layer0.util.TransferableGraphConfiguration2.SeedSpec.SeedSpecType; import org.simantics.layer0.Layer0; public class TGConfigurer { final private ReadGraph graph; - final Collection roots = new ArrayList(); - final Map preStatus = new HashMap(); + final Collection roots = new ArrayList<>(); + final Map preStatus = new HashMap<>(); final boolean ignoreVirtualResources; final boolean validate; @@ -41,13 +42,12 @@ public class TGConfigurer { return this; } - public TGConfigurer roots(Collection rs) throws DatabaseException { + public TGConfigurer roots(Collection rs) throws DatabaseException { Layer0 L0 = Layer0.getInstance(graph); - for(RootSpec root : rs) { + for(SeedSpec root : rs) { Resource nameResource = graph.getPossibleObject(root.resource, L0.HasName); if(nameResource != null) preStatus.put(nameResource, ExtentStatus.EXCLUDED); -// String name = graph.getValue(nameResource, Bindings.STRING); - roots.add(new RootSpec(root.resource, root.name, root.internal, root.type)); + roots.add(new SeedSpec(root.resource, root.name, root.specType, root.type)); preStatus.put(root.resource, ExtentStatus.INTERNAL); } return this; @@ -63,7 +63,7 @@ public class TGConfigurer { if(name == null) name = ""; preStatus.put(nameResource, ExtentStatus.EXCLUDED); } - roots.add(new RootSpec(root, name, true)); + roots.add(new SeedSpec(root, name, SeedSpecType.ROOT)); preStatus.put(root, ExtentStatus.INTERNAL); } return this; @@ -73,8 +73,7 @@ public class TGConfigurer { Layer0 L0 = Layer0.getInstance(graph); for(NamedResource root : rs) { Resource nameResource = graph.getPossibleObject(root.getResource(), L0.HasName); -// String name = graph.getValue(nameResource, Bindings.STRING); - roots.add(new RootSpec(root.getResource(), root.getName(), true)); + roots.add(new SeedSpec(root.getResource(), root.getName(), SeedSpecType.ROOT)); preStatus.put(root.getResource(), ExtentStatus.INTERNAL); preStatus.put(nameResource, ExtentStatus.EXCLUDED); } @@ -91,9 +90,9 @@ public class TGConfigurer { // -Exclude owners if not explicitly defined Layer0 L0 = Layer0.getInstance(graph); - ArrayList rootList = new ArrayList(); - for (RootSpec root : roots) { - if(root.internal) { + ArrayList rootList = new ArrayList<>(); + for (SeedSpec root : roots) { + if(!SeedSpecType.SPECIAL_ROOT.equals(root.specType)) { rootList.add(root.resource); for (Resource owner : graph.getObjects(root.resource, L0.IsOwnedBy)) { ExtentStatus ownerStatus = preStatus.get(owner);