Verified Commit 8dcc4f44 authored by Johannes Visintini's avatar Johannes Visintini
Browse files

general tidy-up

parent b04fcde7
Pipeline #2614 passed with stage
in 0 seconds
......@@ -112,7 +112,7 @@ public class CreateH2Extract {
keytableSettings.get(2),
keytableSettings.get(3));
var source = new OSHDBIgnite(cmdArgs.igniteConfig).prefix(cmdArgs.inPrefix);
var destination = DriverManager.getConnection("jdbc:h2:" + cmdArgs.outputH2, "sa", "");
var destination = DriverManager.getConnection("jdbc:h2:" + cmdArgs.outputH2, "sa", "")
) {
checkBboxRegion(keytables);
......@@ -200,10 +200,10 @@ public class CreateH2Extract {
.filter(filter::applyOSH)
.filter(oshRel -> !cmdArgs.skipLargeRelations
|| StreamSupport.stream(oshRel.getVersions().spliterator(), false)
.flatMap(osmrel -> Arrays.stream(osmrel.getMembers()))
.map(OSMMember::getEntity)
.filter(Objects::nonNull)
.anyMatch(member -> member.intersects(bbox))
.flatMap(osmrel -> Arrays.stream(osmrel.getMembers()))
.map(OSMMember::getEntity)
.filter(Objects::nonNull)
.anyMatch(member -> member.intersects(bbox))
)
.collect(Collectors.toList())
);
......@@ -302,8 +302,7 @@ public class CreateH2Extract {
private void insertKeytables(Connection destination, TagTranslator tt, Set<OSHDBTagKey> tagKeys,
Set<OSHDBTag> tags, Set<OSHDBRole> roles) throws SQLException {
try (var insertKey = destination
.prepareStatement("insert into key (id,txt) values (?,?)");) {
try (var insertKey = destination.prepareStatement("insert into key (id,txt) values (?,?)")) {
for (var tagKey : tagKeys) {
insertKey.setInt(1, tagKey.toInt());
insertKey.setString(2, tt.getOSMTagKeyOf(tagKey).toString());
......@@ -315,7 +314,7 @@ public class CreateH2Extract {
}
}
try (var insertTag = destination
.prepareStatement("insert into keyvalue (keyid,valueid,txt) values (?,?,?)");) {
.prepareStatement("insert into keyvalue (keyid,valueid,txt) values (?,?,?)")) {
for (var tag : tags) {
insertTag.setInt(1, tag.getKey());
insertTag.setInt(2, tag.getValue());
......@@ -327,8 +326,7 @@ public class CreateH2Extract {
}
}
}
try (var insertRole = destination
.prepareStatement("insert into role (id,txt) values (?,?)");) {
try (var insertRole = destination.prepareStatement("insert into role (id,txt) values (?,?)")) {
for (var role : roles) {
insertRole.setInt(1, role.toInt());
insertRole.setString(2, tt.getOSMRoleOf(role).toString());
......@@ -371,6 +369,7 @@ public class CreateH2Extract {
}
private static class CmdArgsConfig {
@Parameter(names = {"-i", "--ignite", "--ignite-config"},
description = "Path ot ignite-config.xml", required = true, order = 1)
public File igniteConfig;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment