Skip to content

Commit 1dadb91

Browse files
committed
removed support for root_id column of property table
1 parent 70f2e91 commit 1dadb91

File tree

10 files changed

+90
-107
lines changed

10 files changed

+90
-107
lines changed

citydb-database-postgres/src/main/resources/org/citydb/database/postgres/query_feature_hierarchy.sql

-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ WITH RECURSIVE FEATURE_HIERARCHY AS
22
(SELECT NULL::bigint AS ID,
33
ID AS FEATURE_ID,
44
NULL::bigint AS PARENT_ID,
5-
NULL::bigint AS ROOT_ID,
65
NULL::int AS DATATYPE_ID,
76
NULL::int AS NAMESPACE_ID,
87
NULL AS NAME,
@@ -32,7 +31,6 @@ WITH RECURSIVE FEATURE_HIERARCHY AS
3231
P.ID,
3332
P.FEATURE_ID,
3433
P.PARENT_ID,
35-
P.ROOT_ID,
3634
P.DATATYPE_ID,
3735
P.NAMESPACE_ID,
3836
P.NAME,
@@ -62,7 +60,6 @@ SELECT
6260
H.ID,
6361
H.FEATURE_ID,
6462
H.PARENT_ID,
65-
H.ROOT_ID,
6663
H.DATATYPE_ID,
6764
H.NAMESPACE_ID,
6865
H.NAME,

citydb-model/src/main/java/org/citydb/model/property/PropertyDescriptor.java

-10
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
public class PropertyDescriptor extends DatabaseDescriptor {
2727
private final long featureId;
2828
private long parentId;
29-
private long rootId;
3029

3130
private PropertyDescriptor(long id, long featureId) {
3231
super(id);
@@ -49,13 +48,4 @@ public PropertyDescriptor setParentId(long parentId) {
4948
public long getParentId() {
5049
return parentId;
5150
}
52-
53-
public PropertyDescriptor setRootId(long rootId) {
54-
this.rootId = rootId;
55-
return this;
56-
}
57-
58-
public long getRootId() {
59-
return rootId;
60-
}
6151
}

citydb-operation/src/main/java/org/citydb/operation/exporter/property/PropertyExporter.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ public PropertyStub doExport(long featureId, ResultSet rs) throws ExportExceptio
6363
.setGenericContent(rs.getString("val_content"))
6464
.setGenericContentMimeType(rs.getString("val_content_mime_type"))
6565
.setDescriptor(PropertyDescriptor.of(rs.getLong("id"), featureId)
66-
.setParentId(rs.getLong("parent_id"))
67-
.setRootId(rs.getLong("root_id")));
66+
.setParentId(rs.getLong("parent_id")));
6867
} else {
6968
return null;
7069
}

citydb-operation/src/main/java/org/citydb/operation/importer/property/AddressPropertyImporter.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,34 @@ public AddressPropertyImporter(ImportHelper helper) throws SQLException {
4444
@Override
4545
protected String getInsertStatement() {
4646
return "insert into " + tableHelper.getPrefixedTableName(table) +
47-
"(id, feature_id, parent_id, root_id, datatype_id, namespace_id, name, " +
47+
"(id, feature_id, parent_id, datatype_id, namespace_id, name, " +
4848
"val_address_id, val_reference_type) " +
49-
"values (" + String.join(",", Collections.nCopies(9, "?")) + ")";
49+
"values (" + String.join(",", Collections.nCopies(8, "?")) + ")";
5050
}
5151

5252
public PropertyDescriptor doImport(AddressProperty property, long featureId) throws ImportException, SQLException {
5353
long propertyId = nextSequenceValue(Sequence.PROPERTY);
54-
return doImport(property, propertyId, propertyId, propertyId, featureId);
54+
return doImport(property, propertyId, propertyId, featureId);
5555
}
5656

57-
PropertyDescriptor doImport(AddressProperty property, long parentId, long rootId, long featureId) throws ImportException, SQLException {
58-
return doImport(property, nextSequenceValue(Sequence.PROPERTY), parentId, rootId, featureId);
57+
PropertyDescriptor doImport(AddressProperty property, long parentId, long featureId) throws ImportException, SQLException {
58+
return doImport(property, nextSequenceValue(Sequence.PROPERTY), parentId, featureId);
5959
}
6060

61-
PropertyDescriptor doImport(AddressProperty property, long propertyId, long parentId, long rootId, long featureId) throws ImportException, SQLException {
61+
PropertyDescriptor doImport(AddressProperty property, long propertyId, long parentId, long featureId) throws ImportException, SQLException {
6262
Address address = property.getObject().orElse(null);
6363
if (address != null) {
64-
stmt.setLong(8, tableHelper.getOrCreateImporter(AddressImporter.class)
64+
stmt.setLong(7, tableHelper.getOrCreateImporter(AddressImporter.class)
6565
.doImport(address)
6666
.getId());
67-
stmt.setNull(9, Types.INTEGER);
67+
stmt.setNull(8, Types.INTEGER);
6868
} else if (property.getReference().isPresent()) {
6969
Reference reference = property.getReference().get();
7070
cacheReference(CacheType.ADDRESS, reference, propertyId);
71-
stmt.setNull(8, Types.BIGINT);
72-
stmt.setInt(9, reference.getType().getDatabaseValue());
71+
stmt.setNull(7, Types.BIGINT);
72+
stmt.setInt(8, reference.getType().getDatabaseValue());
7373
}
7474

75-
return super.doImport(property, propertyId, parentId, rootId, featureId);
75+
return super.doImport(property, propertyId, parentId, featureId);
7676
}
7777
}

citydb-operation/src/main/java/org/citydb/operation/importer/property/AppearancePropertyImporter.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,25 @@ public AppearancePropertyImporter(ImportHelper helper) throws SQLException {
4040
@Override
4141
protected String getInsertStatement() {
4242
return "insert into " + tableHelper.getPrefixedTableName(table) +
43-
"(id, feature_id, parent_id, root_id, datatype_id, namespace_id, name, " +
43+
"(id, feature_id, parent_id, datatype_id, namespace_id, name, " +
4444
"val_appearance_id) " +
45-
"values (" + String.join(",", Collections.nCopies(8, "?")) + ")";
45+
"values (" + String.join(",", Collections.nCopies(7, "?")) + ")";
4646
}
4747

4848
public PropertyDescriptor doImport(AppearanceProperty property, long featureId) throws ImportException, SQLException {
4949
long propertyId = nextSequenceValue(Sequence.PROPERTY);
50-
return doImport(property, propertyId, propertyId, propertyId, featureId);
50+
return doImport(property, propertyId, propertyId, featureId);
5151
}
5252

53-
PropertyDescriptor doImport(AppearanceProperty property, long parentId, long rootId, long featureId) throws ImportException, SQLException {
54-
return doImport(property, nextSequenceValue(Sequence.PROPERTY), parentId, rootId, featureId);
53+
PropertyDescriptor doImport(AppearanceProperty property, long parentId, long featureId) throws ImportException, SQLException {
54+
return doImport(property, nextSequenceValue(Sequence.PROPERTY), parentId, featureId);
5555
}
5656

57-
PropertyDescriptor doImport(AppearanceProperty property, long propertyId, long parentId, long rootId, long featureId) throws ImportException, SQLException {
58-
stmt.setLong(8, tableHelper.getOrCreateImporter(AppearanceImporter.class)
57+
PropertyDescriptor doImport(AppearanceProperty property, long propertyId, long parentId, long featureId) throws ImportException, SQLException {
58+
stmt.setLong(7, tableHelper.getOrCreateImporter(AppearanceImporter.class)
5959
.doImport(property.getObject(), featureId, AppearanceImporter.Type.FEATURE)
6060
.getId());
6161

62-
return super.doImport(property, propertyId, parentId, rootId, featureId);
62+
return super.doImport(property, propertyId, parentId, featureId);
6363
}
6464
}

citydb-operation/src/main/java/org/citydb/operation/importer/property/AttributeImporter.java

+27-27
Original file line numberDiff line numberDiff line change
@@ -42,84 +42,84 @@ public AttributeImporter(ImportHelper helper) throws SQLException {
4242
@Override
4343
protected String getInsertStatement() {
4444
return "insert into " + tableHelper.getPrefixedTableName(table) +
45-
"(id, feature_id, parent_id, root_id, datatype_id, namespace_id, name, " +
45+
"(id, feature_id, parent_id, datatype_id, namespace_id, name, " +
4646
"val_int, val_double, val_string, val_timestamp, val_uri, val_codespace, val_uom, val_array, " +
4747
"val_content, val_content_mime_type) " +
48-
"values (" + String.join(",", Collections.nCopies(17, "?")) + ")";
48+
"values (" + String.join(",", Collections.nCopies(16, "?")) + ")";
4949
}
5050

5151
public PropertyDescriptor doImport(Attribute attribute, long featureId) throws ImportException, SQLException {
5252
long propertyId = nextSequenceValue(Sequence.PROPERTY);
53-
return doImport(attribute, propertyId, propertyId, propertyId, featureId);
53+
return doImport(attribute, propertyId, propertyId, featureId);
5454
}
5555

56-
PropertyDescriptor doImport(Attribute attribute, long parentId, long rootId, long featureId) throws ImportException, SQLException {
57-
return doImport(attribute, nextSequenceValue(Sequence.PROPERTY), parentId, rootId, featureId);
56+
PropertyDescriptor doImport(Attribute attribute, long parentId, long featureId) throws ImportException, SQLException {
57+
return doImport(attribute, nextSequenceValue(Sequence.PROPERTY), parentId, featureId);
5858
}
5959

60-
private PropertyDescriptor doImport(Attribute attribute, long propertyId, long parentId, long rootId, long featureId) throws ImportException, SQLException {
60+
private PropertyDescriptor doImport(Attribute attribute, long propertyId, long parentId, long featureId) throws ImportException, SQLException {
6161
Long intValue = attribute.getIntValue().orElse(null);
6262
if (intValue != null) {
63-
stmt.setLong(8, intValue);
63+
stmt.setLong(7, intValue);
6464
} else {
65-
stmt.setNull(8, Types.BIGINT);
65+
stmt.setNull(7, Types.BIGINT);
6666
}
6767

6868
Double doubleValue = attribute.getDoubleValue().orElse(null);
6969
if (doubleValue != null) {
70-
stmt.setDouble(9, doubleValue);
70+
stmt.setDouble(8, doubleValue);
7171
} else {
72-
stmt.setNull(9, Types.DOUBLE);
72+
stmt.setNull(8, Types.DOUBLE);
7373
}
7474

75-
stmt.setString(10, attribute.getStringValue().orElse(null));
75+
stmt.setString(9, attribute.getStringValue().orElse(null));
7676

7777
OffsetDateTime timestamp = attribute.getTimeStamp().orElse(null);
7878
if (timestamp != null) {
79-
stmt.setObject(11, timestamp);
79+
stmt.setObject(10, timestamp);
8080
} else {
81-
stmt.setNull(11, Types.TIMESTAMP);
81+
stmt.setNull(10, Types.TIMESTAMP);
8282
}
8383

84-
stmt.setString(12, attribute.getURI().orElse(null));
85-
stmt.setString(13, attribute.getCodeSpace().orElse(null));
86-
stmt.setString(14, attribute.getUom().orElse(null));
84+
stmt.setString(11, attribute.getURI().orElse(null));
85+
stmt.setString(12, attribute.getCodeSpace().orElse(null));
86+
stmt.setString(13, attribute.getUom().orElse(null));
8787

8888
String arrayValue = attribute.getArrayValue()
8989
.map(array -> JSONArray.copyOf(array.getValues().stream()
9090
.map(Value::rawValue)
9191
.collect(Collectors.toList())).toString())
9292
.orElse(null);
9393
if (arrayValue != null) {
94-
stmt.setObject(15, arrayValue, Types.OTHER);
94+
stmt.setObject(14, arrayValue, Types.OTHER);
9595
} else {
96-
stmt.setNull(15, Types.OTHER);
96+
stmt.setNull(14, Types.OTHER);
9797
}
9898

99-
stmt.setString(16, attribute.getGenericContent().orElse(null));
100-
stmt.setString(17, attribute.getGenericContentMimeType().orElse(null));
99+
stmt.setString(15, attribute.getGenericContent().orElse(null));
100+
stmt.setString(16, attribute.getGenericContentMimeType().orElse(null));
101101

102-
PropertyDescriptor descriptor = super.doImport(attribute, propertyId, parentId, rootId, featureId);
102+
PropertyDescriptor descriptor = super.doImport(attribute, propertyId, parentId, featureId);
103103

104104
if (attribute.hasProperties()) {
105105
for (Property<?> property : attribute.getProperties().getAll()) {
106106
if (property instanceof Attribute) {
107-
doImport((Attribute) property, parentId, rootId, featureId);
107+
doImport((Attribute) property, parentId, featureId);
108108
} else if (property instanceof FeatureProperty) {
109109
tableHelper.getOrCreateImporter(FeaturePropertyImporter.class)
110-
.doImport((FeatureProperty) property, parentId, rootId, featureId);
110+
.doImport((FeatureProperty) property, parentId, featureId);
111111
} else if (property instanceof GeometryProperty) {
112112
tableHelper.getOrCreateImporter(GeometryPropertyImporter.class)
113-
.doImport((GeometryProperty) property, parentId, rootId, featureId);
113+
.doImport((GeometryProperty) property, parentId, featureId);
114114
} else if (property instanceof ImplicitGeometryProperty) {
115115
tableHelper.getOrCreateImporter(ImplicitGeometryPropertyImporter.class)
116-
.doImport((ImplicitGeometryProperty) property, parentId, rootId, featureId);
116+
.doImport((ImplicitGeometryProperty) property, parentId, featureId);
117117
} else if (property instanceof AppearanceProperty) {
118118
tableHelper.getOrCreateImporter(AppearancePropertyImporter.class)
119-
.doImport((AppearanceProperty) property, parentId, rootId, featureId);
119+
.doImport((AppearanceProperty) property, parentId, featureId);
120120
} else if (property instanceof AddressProperty) {
121121
tableHelper.getOrCreateImporter(AddressPropertyImporter.class)
122-
.doImport((AddressProperty) property, parentId, rootId, featureId);
122+
.doImport((AddressProperty) property, parentId, featureId);
123123
}
124124
}
125125
}

citydb-operation/src/main/java/org/citydb/operation/importer/property/FeaturePropertyImporter.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,34 @@ public FeaturePropertyImporter(ImportHelper helper) throws SQLException {
4444
@Override
4545
protected String getInsertStatement() {
4646
return "insert into " + tableHelper.getPrefixedTableName(table) +
47-
"(id, feature_id, parent_id, root_id, datatype_id, namespace_id, name, " +
47+
"(id, feature_id, parent_id, datatype_id, namespace_id, name, " +
4848
"val_feature_id, val_reference_type) " +
49-
"values (" + String.join(",", Collections.nCopies(9, "?")) + ")";
49+
"values (" + String.join(",", Collections.nCopies(8, "?")) + ")";
5050
}
5151

5252
public PropertyDescriptor doImport(FeatureProperty property, long featureId) throws ImportException, SQLException {
5353
long propertyId = nextSequenceValue(Sequence.PROPERTY);
54-
return doImport(property, propertyId, propertyId, propertyId, featureId);
54+
return doImport(property, propertyId, propertyId, featureId);
5555
}
5656

57-
PropertyDescriptor doImport(FeatureProperty property, long parentId, long rootId, long featureId) throws ImportException, SQLException {
58-
return doImport(property, nextSequenceValue(Sequence.PROPERTY), parentId, rootId, featureId);
57+
PropertyDescriptor doImport(FeatureProperty property, long parentId, long featureId) throws ImportException, SQLException {
58+
return doImport(property, nextSequenceValue(Sequence.PROPERTY), parentId, featureId);
5959
}
6060

61-
private PropertyDescriptor doImport(FeatureProperty property, long propertyId, long parentId, long rootId, long featureId) throws ImportException, SQLException {
61+
private PropertyDescriptor doImport(FeatureProperty property, long propertyId, long parentId, long featureId) throws ImportException, SQLException {
6262
Feature feature = property.getObject().orElse(null);
6363
if (feature != null) {
64-
stmt.setLong(8, tableHelper.getOrCreateImporter(FeatureImporter.class)
64+
stmt.setLong(7, tableHelper.getOrCreateImporter(FeatureImporter.class)
6565
.doImport(feature)
6666
.getId());
67-
stmt.setNull(9, Types.INTEGER);
67+
stmt.setNull(8, Types.INTEGER);
6868
} else if (property.getReference().isPresent()) {
6969
Reference reference = property.getReference().get();
7070
cacheReference(CacheType.FEATURE, reference, propertyId);
71-
stmt.setNull(8, Types.BIGINT);
72-
stmt.setInt(9, reference.getType().getDatabaseValue());
71+
stmt.setNull(7, Types.BIGINT);
72+
stmt.setInt(8, reference.getType().getDatabaseValue());
7373
}
7474

75-
return super.doImport(property, propertyId, parentId, rootId, featureId);
75+
return super.doImport(property, propertyId, parentId, featureId);
7676
}
7777
}

citydb-operation/src/main/java/org/citydb/operation/importer/property/GeometryPropertyImporter.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,26 @@ public GeometryPropertyImporter(ImportHelper helper) throws SQLException {
4040
@Override
4141
protected String getInsertStatement() {
4242
return "insert into " + tableHelper.getPrefixedTableName(table) +
43-
"(id, feature_id, parent_id, root_id, datatype_id, namespace_id, name, " +
43+
"(id, feature_id, parent_id, datatype_id, namespace_id, name, " +
4444
"val_lod, val_geometry_id) " +
45-
"values (" + String.join(",", Collections.nCopies(9, "?")) + ")";
45+
"values (" + String.join(",", Collections.nCopies(8, "?")) + ")";
4646
}
4747

4848
public PropertyDescriptor doImport(GeometryProperty property, long featureId) throws ImportException, SQLException {
4949
long propertyId = nextSequenceValue(Sequence.PROPERTY);
50-
return doImport(property, propertyId, propertyId, propertyId, featureId);
50+
return doImport(property, propertyId, propertyId, featureId);
5151
}
5252

53-
PropertyDescriptor doImport(GeometryProperty property, long parentId, long rootId, long featureId) throws ImportException, SQLException {
54-
return doImport(property, nextSequenceValue(Sequence.PROPERTY), parentId, rootId, featureId);
53+
PropertyDescriptor doImport(GeometryProperty property, long parentId, long featureId) throws ImportException, SQLException {
54+
return doImport(property, nextSequenceValue(Sequence.PROPERTY), parentId, featureId);
5555
}
5656

57-
PropertyDescriptor doImport(GeometryProperty property, long propertyId, long parentId, long rootId, long featureId) throws ImportException, SQLException {
58-
stmt.setString(8, property.getLod().orElse(null));
59-
stmt.setLong(9, tableHelper.getOrCreateImporter(GeometryImporter.class)
57+
PropertyDescriptor doImport(GeometryProperty property, long propertyId, long parentId, long featureId) throws ImportException, SQLException {
58+
stmt.setString(7, property.getLod().orElse(null));
59+
stmt.setLong(8, tableHelper.getOrCreateImporter(GeometryImporter.class)
6060
.doImport(property.getObject(), false, featureId)
6161
.getId());
6262

63-
return super.doImport(property, propertyId, parentId, rootId, featureId);
63+
return super.doImport(property, propertyId, parentId, featureId);
6464
}
6565
}

0 commit comments

Comments
 (0)