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<RootSpec> roots = new ArrayList<RootSpec>();
- final Map<Resource, ExtentStatus> preStatus = new HashMap<Resource, ExtentStatus>();
+ final Collection<SeedSpec> roots = new ArrayList<>();
+ final Map<Resource, ExtentStatus> preStatus = new HashMap<>();
final boolean ignoreVirtualResources;
final boolean validate;
return this;
}
- public TGConfigurer roots(Collection<RootSpec> rs) throws DatabaseException {
+ public TGConfigurer roots(Collection<SeedSpec> 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;
if(name == null) name = "<no 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;
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);
}
// -Exclude owners if not explicitly defined
Layer0 L0 = Layer0.getInstance(graph);
- ArrayList<Resource> rootList = new ArrayList<Resource>();
- for (RootSpec root : roots) {
- if(root.internal) {
+ ArrayList<Resource> 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);