Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Energy ADE
Energy ADE 3 3DCityDB
Commits
86bff7d5
Commit
86bff7d5
authored
Jan 14, 2026
by
PrabithaPrabhakaran
Browse files
Add importer exporter for resource module
parent
360a3a02
Changes
8
Show whitespace changes
Inline
Side-by-side
src/main/java/de/stuttgart/hft/ade/energy3/exporter/AbstractADEFeatureExporter.java
0 → 100644
View file @
86bff7d5
package
de.stuttgart.hft.ade.energy3.exporter
;
import
de.stuttgart.hft.ade.energy3.schema.ADETable
;
import
org.citydb.core.ade.exporter.ADEExporter
;
import
org.citydb.core.ade.exporter.CityGMLExportHelper
;
import
org.citydb.core.database.schema.mapping.ObjectType
;
import
org.citydb.core.operation.exporter.CityGMLExportException
;
import
org.citydb.core.query.filter.projection.ProjectionFilter
;
import
org.citygml4j.ade.energy3.model.core.AbstractResource
;
import
org.citygml4j.ade.energy3.model.supportingClasses.*
;
import
org.citygml4j.model.gml.basicTypes.Code
;
import
org.citygml4j.model.gml.basicTypes.Measure
;
import
org.sig3d.citygml.energyADE3beta8.ResourceStatusValueType
;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.GregorianCalendar
;
public
class
AbstractADEFeatureExporter
implements
ADEExporter
{
private
final
CityGMLExportHelper
helper
;
private
AbstractADEFeatureExporter
abstractADEFeatureExporter
;
private
PreparedStatement
ps
;
public
AbstractADEFeatureExporter
(
Connection
connection
,
CityGMLExportHelper
helper
,
ExportManager
manager
)
throws
CityGMLExportException
,
SQLException
{
this
.
helper
=
helper
;
String
tableName
=
helper
.
getTableNameWithSchema
(
manager
.
getSchemaMapper
().
getTableName
(
ADETable
.
CITYOBJECT
));
String
sql
=
"SELECT "
+
getColumnNames
()
+
" FROM "
+
tableName
+
" WHERE cityobject_id = ?"
;
ps
=
connection
.
prepareStatement
(
sql
);
abstractADEFeatureExporter
=
manager
.
getExporter
(
AbstractADEFeatureExporter
.
class
);
}
public
Collection
<
AbstractADEFeature
>
doExport
(
long
cityObjectId
)
throws
CityGMLExportException
,
SQLException
{
ps
.
setLong
(
1
,
cityObjectId
);
try
(
ResultSet
rs
=
ps
.
executeQuery
())
{
Collection
<
AbstractADEFeature
>
result
=
new
ArrayList
<>();
while
(
rs
.
next
())
{
long
objectId
=
rs
.
getLong
(
1
);
int
objectClassId
=
rs
.
getInt
(
2
);
if
(
rs
.
wasNull
())
{
continue
;
}
AbstractADEFeature
adeFeature
=
helper
.
createObject
(
objectId
,
objectClassId
,
AbstractADEFeature
.
class
);
if
(
adeFeature
==
null
)
{
helper
.
logOrThrowErrorMessage
(
"Failed to instantiate "
+
helper
.
getObjectSignature
(
objectClassId
,
cityObjectId
)
+
" as ade feature object."
);
continue
;
}
ObjectType
objectType
=
helper
.
getObjectType
(
objectClassId
);
ProjectionFilter
projectionFilter
=
helper
.
getProjectionFilter
(
objectType
);
// Set AbstractADEFeature properties
String
identifierValue
=
rs
.
getString
(
2
);
String
identifierCodespace
=
rs
.
getString
(
3
);
if
(
identifierValue
!=
null
||
identifierCodespace
!=
null
)
{
// adeFeature.getExternalReference(); check with uml
}
String
valid_from
=
rs
.
getString
(
4
);
String
valid_to
=
rs
.
getString
(
5
);
try
{
DatatypeFactory
df
=
DatatypeFactory
.
newInstance
();
XMLGregorianCalendar
fromCal
=
null
;
XMLGregorianCalendar
toCal
=
null
;
if
(
valid_from
!=
null
)
{
GregorianCalendar
gc
=
(
GregorianCalendar
)
javax
.
xml
.
bind
.
DatatypeConverter
.
parseDate
(
valid_from
);
fromCal
=
df
.
newXMLGregorianCalendar
(
gc
);
adeFeature
.
setCreationDate
(
fromCal
);
}
if
(
valid_to
!=
null
)
{
GregorianCalendar
gc
=
(
GregorianCalendar
)
javax
.
xml
.
bind
.
DatatypeConverter
.
parseDate
(
valid_to
);
toCal
=
df
.
newXMLGregorianCalendar
(
gc
);
adeFeature
.
setTerminationDate
(
toCal
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
result
.
add
(
adeFeature
);
}
return
result
;
}
}
@Override
public
void
close
()
throws
CityGMLExportException
,
SQLException
{
ps
.
close
();
}
private
String
getColumnNames
()
{
return
"id, objectclass_id, type, type_codespace, enduse, enduse_codespace, status, operation_type,"
+
" operation_type_codespace, year, amount_type, amount_type_codespace, amount, "
+
"amount_uom, time_series_id, is_amount_normalized, normalization_param, normalization_value, "
+
"normalization_value_uom, co2_equivalent, co2_equivalent_uom, costs_money, costs_money_uom, "
+
"yields_money, yields_money_uom, energy_carrier, energy_carrier_codespace, maximum_load, "
+
"maximum_load_uom, source, source_codespace, is_dangerous, is_recyclable, cityobject_id"
;
}
}
src/main/java/de/stuttgart/hft/ade/energy3/exporter/AbstractFeatureWithLifeSpanExporter.java
0 → 100644
View file @
86bff7d5
package
de.stuttgart.hft.ade.energy3.exporter
;
import
de.stuttgart.hft.ade.energy3.schema.ADETable
;
import
org.citydb.core.ade.exporter.ADEExporter
;
import
org.citydb.core.ade.exporter.CityGMLExportHelper
;
import
org.citydb.core.database.schema.mapping.ObjectType
;
import
org.citydb.core.operation.exporter.CityGMLExportException
;
import
org.citydb.core.query.filter.projection.ProjectionFilter
;
import
org.citygml4j.ade.energy3.model.supportingClasses.*
;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.GregorianCalendar
;
public
class
AbstractFeatureWithLifeSpanExporter
implements
ADEExporter
{
private
final
CityGMLExportHelper
helper
;
private
AbstractFeatureWithLifeSpanExporter
lifeSpanExporter
;
private
PreparedStatement
ps
;
public
AbstractFeatureWithLifeSpanExporter
(
Connection
connection
,
CityGMLExportHelper
helper
,
ExportManager
manager
)
throws
CityGMLExportException
,
SQLException
{
this
.
helper
=
helper
;
String
tableName
=
helper
.
getTableNameWithSchema
(
manager
.
getSchemaMapper
().
getTableName
(
ADETable
.
CITYOBJECT
));
String
sql
=
"SELECT "
+
getColumnNames
()
+
" FROM "
+
tableName
+
" WHERE cityobject_id = ?"
;
ps
=
connection
.
prepareStatement
(
sql
);
lifeSpanExporter
=
manager
.
getExporter
(
AbstractFeatureWithLifeSpanExporter
.
class
);
}
public
Collection
<
AbstractFeatureWithLifeSpan
>
doExport
(
long
cityObjectId
)
throws
CityGMLExportException
,
SQLException
{
ps
.
setLong
(
1
,
cityObjectId
);
try
(
ResultSet
rs
=
ps
.
executeQuery
())
{
Collection
<
AbstractFeatureWithLifeSpan
>
result
=
new
ArrayList
<>();
while
(
rs
.
next
())
{
long
objectId
=
rs
.
getLong
(
1
);
int
objectClassId
=
rs
.
getInt
(
2
);
if
(
rs
.
wasNull
())
{
continue
;
}
AbstractFeatureWithLifeSpan
lifeSpan
=
helper
.
createObject
(
objectId
,
objectClassId
,
AbstractFeatureWithLifeSpan
.
class
);
if
(
lifeSpan
==
null
)
{
helper
.
logOrThrowErrorMessage
(
"Failed to instantiate "
+
helper
.
getObjectSignature
(
objectClassId
,
cityObjectId
)
+
" as feature with life span object."
);
continue
;
}
ObjectType
objectType
=
helper
.
getObjectType
(
objectClassId
);
ProjectionFilter
projectionFilter
=
helper
.
getProjectionFilter
(
objectType
);
// Set AbstractFeatureWithLifeSpan properties
String
identifier_value
=
rs
.
getString
(
2
);
String
identifier_codespace
=
rs
.
getString
(
3
);
if
(
identifier_value
!=
null
||
identifier_codespace
!=
null
)
{
lifeSpan
.
getIdentifier
().
setValue
(
identifier_value
);
lifeSpan
.
getIdentifier
().
setCodeSpace
(
identifier_codespace
);
}
String
valid_from
=
rs
.
getString
(
4
);
String
valid_to
=
rs
.
getString
(
5
);
try
{
DatatypeFactory
df
=
DatatypeFactory
.
newInstance
();
XMLGregorianCalendar
fromCal
=
null
;
XMLGregorianCalendar
toCal
=
null
;
if
(
valid_from
!=
null
)
{
GregorianCalendar
gc
=
(
GregorianCalendar
)
javax
.
xml
.
bind
.
DatatypeConverter
.
parseDate
(
valid_from
);
fromCal
=
df
.
newXMLGregorianCalendar
(
gc
);
lifeSpan
.
setValidFrom
(
fromCal
);
}
if
(
valid_to
!=
null
)
{
GregorianCalendar
gc
=
(
GregorianCalendar
)
javax
.
xml
.
bind
.
DatatypeConverter
.
parseDate
(
valid_to
);
toCal
=
df
.
newXMLGregorianCalendar
(
gc
);
lifeSpan
.
setValidTo
(
toCal
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
result
.
add
(
lifeSpan
);
}
return
result
;
}
}
@Override
public
void
close
()
throws
CityGMLExportException
,
SQLException
{
ps
.
close
();
}
private
String
getColumnNames
()
{
return
"id, objectclass_id, type, type_codespace, enduse, enduse_codespace, status, operation_type,"
+
" operation_type_codespace, year, amount_type, amount_type_codespace, amount, "
+
"amount_uom, time_series_id, is_amount_normalized, normalization_param, normalization_value, "
+
"normalization_value_uom, co2_equivalent, co2_equivalent_uom, costs_money, costs_money_uom, "
+
"yields_money, yields_money_uom, energy_carrier, energy_carrier_codespace, maximum_load, "
+
"maximum_load_uom, source, source_codespace, is_dangerous, is_recyclable, cityobject_id"
;
}
}
src/main/java/de/stuttgart/hft/ade/energy3/exporter/CityObjectPropertiesExporter.java
View file @
86bff7d5
...
@@ -9,6 +9,10 @@ import org.citydb.core.operation.exporter.CityGMLExportException;
...
@@ -9,6 +9,10 @@ import org.citydb.core.operation.exporter.CityGMLExportException;
import
org.citydb.core.query.filter.projection.ProjectionFilter
;
import
org.citydb.core.query.filter.projection.ProjectionFilter
;
import
org.citygml4j.ade.energy3.model.core.*
;
import
org.citygml4j.ade.energy3.model.core.*
;
import
org.citygml4j.ade.energy3.model.module.EnergyADEModule
;
import
org.citygml4j.ade.energy3.model.module.EnergyADEModule
;
import
org.citygml4j.ade.energy3.model.supportingClasses.AbstractADEFeature
;
import
org.citygml4j.ade.energy3.model.supportingClasses.AbstractADEFeatureProperty
;
import
org.citygml4j.ade.energy3.model.supportingClasses.AbstractFeatureWithLifeSpan
;
import
org.citygml4j.ade.energy3.model.supportingClasses.AbstractFeatureWithLifeSpanProperty
;
import
org.citygml4j.model.citygml.core.AbstractCityObject
;
import
org.citygml4j.model.citygml.core.AbstractCityObject
;
import
org.citygml4j.model.gml.geometry.primitives.PointProperty
;
import
org.citygml4j.model.gml.geometry.primitives.PointProperty
;
...
@@ -27,6 +31,8 @@ public class CityObjectPropertiesExporter implements ADEExporter {
...
@@ -27,6 +31,8 @@ public class CityObjectPropertiesExporter implements ADEExporter {
private
final
Connection
connection
;
private
final
Connection
connection
;
//private WeatherDataExporter weatherDataExporter;
//private WeatherDataExporter weatherDataExporter;
private
ResourceExporter
resourceExporter
;
private
ResourceExporter
resourceExporter
;
private
AbstractADEFeatureExporter
adeFeatureExporter
;
private
AbstractFeatureWithLifeSpanExporter
featureWithLifeSpanExporter
;
private
String
module
;
private
String
module
;
public
CityObjectPropertiesExporter
(
Connection
connection
,
CityGMLExportHelper
helper
,
ExportManager
manager
)
throws
CityGMLExportException
,
SQLException
{
public
CityObjectPropertiesExporter
(
Connection
connection
,
CityGMLExportHelper
helper
,
ExportManager
manager
)
throws
CityGMLExportException
,
SQLException
{
...
@@ -65,6 +71,18 @@ public class CityObjectPropertiesExporter implements ADEExporter {
...
@@ -65,6 +71,18 @@ public class CityObjectPropertiesExporter implements ADEExporter {
cityObject
.
addGenericApplicationPropertyOfCityObject
(
property
);
cityObject
.
addGenericApplicationPropertyOfCityObject
(
property
);
}
}
}
}
if
(
projectionFilter
.
containsProperty
(
"abstractAdeFeature"
,
module
))
{
for
(
AbstractADEFeature
feature
:
adeFeatureExporter
.
doExport
(
objectId
))
{
AbstractADEFeatureProperty
property
=
new
AbstractADEFeatureProperty
(
feature
);
cityObject
.
addGenericApplicationPropertyOfCityObject
(
property
);
}
}
if
(
projectionFilter
.
containsProperty
(
"abstractAdeFeature"
,
module
))
{
for
(
AbstractFeatureWithLifeSpan
lifeSpan
:
featureWithLifeSpanExporter
.
doExport
(
objectId
))
{
AbstractFeatureWithLifeSpanProperty
property
=
new
AbstractFeatureWithLifeSpanProperty
(
lifeSpan
);
cityObject
.
addGenericApplicationPropertyOfCityObject
(
property
);
}
}
if
(
pointObj
!=
null
)
{
if
(
pointObj
!=
null
)
{
GeometryObject
pointObject
=
helper
.
getDatabaseAdapter
().
getGeometryConverter
().
getPoint
(
pointObj
);
GeometryObject
pointObject
=
helper
.
getDatabaseAdapter
().
getGeometryConverter
().
getPoint
(
pointObj
);
...
...
src/main/java/de/stuttgart/hft/ade/energy3/importer/AbstractADEFeatureImporter.java
0 → 100644
View file @
86bff7d5
package
de.stuttgart.hft.ade.energy3.importer
;
import
de.stuttgart.hft.ade.energy3.schema.ADETable
;
import
org.citydb.core.ade.importer.ADEImporter
;
import
org.citydb.core.ade.importer.CityGMLImportHelper
;
import
org.citydb.core.ade.importer.ForeignKeys
;
import
org.citydb.core.database.schema.mapping.AbstractObjectType
;
import
org.citydb.core.operation.importer.CityGMLImportException
;
import
org.citydb.core.operation.importer.util.GeometryConverter
;
import
org.citygml4j.ade.energy3.model.supportingClasses.AbstractADEFeature
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.sql.*
;
import
java.util.Collections
;
public
class
AbstractADEFeatureImporter
implements
ADEImporter
{
private
final
Connection
connection
;
private
final
CityGMLImportHelper
helper
;
private
GeometryConverter
geometryConverter
;
private
PreparedStatement
ps
;
private
int
batchCounter
;
public
AbstractADEFeatureImporter
(
Connection
connection
,
CityGMLImportHelper
helper
,
ImportManager
manager
)
throws
CityGMLImportException
,
SQLException
{
this
.
connection
=
connection
;
this
.
helper
=
helper
;
ps
=
connection
.
prepareStatement
(
"INSERT INTO "
+
helper
.
getTableNameWithSchema
(
manager
.
getSchemaMapper
().
getTableName
(
ADETable
.
FEATURE_WITH_LIFE_SPAN
))
+
"(id, objectclass_id, type, type_codespace, enduse, enduse_codespace, status, "
+
"operation_type, operation_type_codespace, year, amount_type, amount_type_codespace, amount, "
+
"amount_uom, time_series_id, is_amount_normalized, normalization_param, normalization_value, "
+
"normalization_value_uom, co2_equivalent, co2_equivalent_uom, costs_money, costs_money_uom, "
+
"yields_money, yields_money_uom, energy_carrier, energy_carrier_codespace, maximum_load, "
+
"maximum_load_uom, source, source_codespace, is_dangerous, is_recyclable, cityobject_id) "
+
"VALUES ("
+
String
.
join
(
", "
,
Collections
.
nCopies
(
34
,
"?"
))
+
")"
);
geometryConverter
=
helper
.
getGeometryConverter
();
}
public
void
doImport
(
AbstractADEFeature
abstractADEFeature
,
long
objectId
,
AbstractObjectType
<?>
objectType
,
ForeignKeys
foreignKeys
)
throws
CityGMLImportException
,
SQLException
{
setAbstractADEFeatureToNull
();
ps
.
setLong
(
1
,
objectId
);
ps
.
setLong
(
2
,
objectType
.
getObjectClassId
());
ps
.
setLong
(
34
,
foreignKeys
.
get
(
"cityObjectId"
));
setAbstractADEFeatureProperties
(
abstractADEFeature
);
ps
.
addBatch
();
if
(++
batchCounter
==
helper
.
getDatabaseAdapter
().
getMaxBatchSize
())
helper
.
executeBatch
(
objectType
);
}
private
void
setAbstractADEFeatureToNull
()
throws
SQLException
{
ps
.
setNull
(
1
,
Types
.
BIGINT
);
// id
ps
.
setNull
(
2
,
Types
.
INTEGER
);
// objectclass_id
ps
.
setNull
(
3
,
Types
.
VARCHAR
);
// Identifier value
ps
.
setNull
(
5
,
Types
.
TIMESTAMP
);
// creationDate
ps
.
setNull
(
6
,
Types
.
TIMESTAMP
);
// terminationDate
}
private
void
setAbstractADEFeatureProperties
(
AbstractADEFeature
abstractADEFeature
)
throws
SQLException
{
if
(
abstractADEFeature
.
getExternalReference
()
!=
null
)
{
// ps.setString(3, abstractADEFeature.getExternalReference());
}
if
(
abstractADEFeature
.
getCreationDate
()!=
null
){
XMLGregorianCalendar
xmlCal
=
abstractADEFeature
.
getCreationDate
();
Timestamp
timestamp
=
new
Timestamp
(
xmlCal
.
toGregorianCalendar
().
getTimeInMillis
());
ps
.
setTimestamp
(
5
,
timestamp
);
}
// if (abstractADEFeature.getTerminationDate()!= null){
// XMLGregorianCalendar xmlCal = abstractADEFeature.getTerminationDate()));
// Timestamp timestamp = new Timestamp(xmlCal.toGregorianCalendar().getTimeInMillis());
// ps.setTimestamp(6, timestamp);
// }
}
@Override
public
void
executeBatch
()
throws
CityGMLImportException
,
SQLException
{
if
(
batchCounter
>
0
)
{
ps
.
executeBatch
();
batchCounter
=
0
;
}
}
@Override
public
void
close
()
throws
CityGMLImportException
,
SQLException
{
ps
.
close
();
}
}
src/main/java/de/stuttgart/hft/ade/energy3/importer/AbstractFeatureWithLifeSpanImporter.java
0 → 100644
View file @
86bff7d5
package
de.stuttgart.hft.ade.energy3.importer
;
import
de.stuttgart.hft.ade.energy3.schema.ADETable
;
import
org.citydb.core.ade.importer.ADEImporter
;
import
org.citydb.core.ade.importer.CityGMLImportHelper
;
import
org.citydb.core.ade.importer.ForeignKeys
;
import
org.citydb.core.database.schema.mapping.AbstractObjectType
;
import
org.citydb.core.operation.importer.CityGMLImportException
;
import
org.citydb.core.operation.importer.util.GeometryConverter
;
import
org.citygml4j.ade.energy3.model.supportingClasses.*
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.sql.*
;
import
java.util.Collections
;
public
class
AbstractFeatureWithLifeSpanImporter
implements
ADEImporter
{
private
final
Connection
connection
;
private
final
CityGMLImportHelper
helper
;
private
GeometryConverter
geometryConverter
;
private
PreparedStatement
ps
;
private
int
batchCounter
;
public
AbstractFeatureWithLifeSpanImporter
(
Connection
connection
,
CityGMLImportHelper
helper
,
ImportManager
manager
)
throws
CityGMLImportException
,
SQLException
{
this
.
connection
=
connection
;
this
.
helper
=
helper
;
ps
=
connection
.
prepareStatement
(
"INSERT INTO "
+
helper
.
getTableNameWithSchema
(
manager
.
getSchemaMapper
().
getTableName
(
ADETable
.
FEATURE_WITH_LIFE_SPAN
))
+
"(id, objectclass_id, type, type_codespace, enduse, enduse_codespace, status, "
+
"operation_type, operation_type_codespace, year, amount_type, amount_type_codespace, amount, "
+
"amount_uom, time_series_id, is_amount_normalized, normalization_param, normalization_value, "
+
"normalization_value_uom, co2_equivalent, co2_equivalent_uom, costs_money, costs_money_uom, "
+
"yields_money, yields_money_uom, energy_carrier, energy_carrier_codespace, maximum_load, "
+
"maximum_load_uom, source, source_codespace, is_dangerous, is_recyclable, cityobject_id) "
+
"VALUES ("
+
String
.
join
(
", "
,
Collections
.
nCopies
(
34
,
"?"
))
+
")"
);
geometryConverter
=
helper
.
getGeometryConverter
();
}
public
void
doImport
(
AbstractFeatureWithLifeSpan
abstractFeatureWithLifeSpan
,
long
objectId
,
AbstractObjectType
<?>
objectType
,
ForeignKeys
foreignKeys
)
throws
CityGMLImportException
,
SQLException
{
setAbstractFeatureWithLifeSpanToNull
();
ps
.
setLong
(
1
,
objectId
);
ps
.
setLong
(
2
,
objectType
.
getObjectClassId
());
ps
.
setLong
(
34
,
foreignKeys
.
get
(
"cityObjectId"
));
setAbstractFeatureWithLifeSpanProperties
(
abstractFeatureWithLifeSpan
);
ps
.
addBatch
();
if
(++
batchCounter
==
helper
.
getDatabaseAdapter
().
getMaxBatchSize
())
helper
.
executeBatch
(
objectType
);
}
private
void
setAbstractFeatureWithLifeSpanToNull
()
throws
SQLException
{
ps
.
setNull
(
1
,
Types
.
BIGINT
);
// id
ps
.
setNull
(
2
,
Types
.
INTEGER
);
// objectclass_id
ps
.
setNull
(
3
,
Types
.
VARCHAR
);
// Identifier value
ps
.
setNull
(
4
,
Types
.
VARCHAR
);
// Identifier codespace
ps
.
setNull
(
5
,
Types
.
TIMESTAMP
);
// vaildFrom
ps
.
setNull
(
6
,
Types
.
TIMESTAMP
);
// vaildTo
}
private
void
setAbstractFeatureWithLifeSpanProperties
(
AbstractFeatureWithLifeSpan
abstractFeatureWithLifeSpan
)
throws
SQLException
{
if
(
abstractFeatureWithLifeSpan
.
getIdentifier
()
!=
null
)
{
ps
.
setString
(
3
,
abstractFeatureWithLifeSpan
.
getIdentifier
().
getValue
());
ps
.
setString
(
4
,
abstractFeatureWithLifeSpan
.
getIdentifier
().
getCodeSpace
());
}
if
(
abstractFeatureWithLifeSpan
.
getValidFrom
()!=
null
){
XMLGregorianCalendar
xmlCal
=
abstractFeatureWithLifeSpan
.
getValidFrom
();
Timestamp
timestamp
=
new
Timestamp
(
xmlCal
.
toGregorianCalendar
().
getTimeInMillis
());
ps
.
setTimestamp
(
5
,
timestamp
);
}
if
(
abstractFeatureWithLifeSpan
.
getValidTo
()!=
null
){
XMLGregorianCalendar
xmlCal
=
abstractFeatureWithLifeSpan
.
getValidTo
();
Timestamp
timestamp
=
new
Timestamp
(
xmlCal
.
toGregorianCalendar
().
getTimeInMillis
());
ps
.
setTimestamp
(
6
,
timestamp
);
}
}
@Override
public
void
executeBatch
()
throws
CityGMLImportException
,
SQLException
{
if
(
batchCounter
>
0
)
{
ps
.
executeBatch
();
batchCounter
=
0
;
}
}
@Override
public
void
close
()
throws
CityGMLImportException
,
SQLException
{
ps
.
close
();
}
}
src/main/java/de/stuttgart/hft/ade/energy3/importer/CityObjectPropertiesImporter.java
View file @
86bff7d5
...
@@ -96,6 +96,32 @@ public class CityObjectPropertiesImporter implements ADEImporter {
...
@@ -96,6 +96,32 @@ public class CityObjectPropertiesImporter implements ADEImporter {
}
}
}
}
}
}
if
(
properties
.
contains
(
AbstractFeatureWithLifeSpanProperty
.
class
)){
for
(
AbstractFeatureWithLifeSpanProperty
propertyElement
:
properties
.
getAll
(
AbstractFeatureWithLifeSpanProperty
.
class
))
{
AbstractFeatureWithLifeSpan
lifeSpan
=
propertyElement
.
getAbstractFeatureWithLifeSpan
();
if
(
lifeSpan
!=
null
)
{
helper
.
importObject
(
lifeSpan
,
ForeignKeys
.
create
().
with
(
"cityObjectId"
,
parentId
));
propertyElement
.
unsetAbstractFeatureWithLifeSpan
();
}
else
{
String
href
=
propertyElement
.
getHref
();
if
(
href
!=
null
&&
href
.
length
()
!=
0
)
helper
.
logOrThrowUnsupportedXLinkMessage
(
parent
,
AbstractFeatureWithLifeSpan
.
class
,
href
);
}
}
}
if
(
properties
.
contains
(
AbstractADEFeatureProperty
.
class
)){
for
(
AbstractADEFeatureProperty
propertyElement
:
properties
.
getAll
(
AbstractADEFeatureProperty
.
class
))
{
AbstractADEFeature
adeFeature
=
propertyElement
.
getAbstractADEFeature
();
if
(
adeFeature
!=
null
)
{
helper
.
importObject
(
adeFeature
,
ForeignKeys
.
create
().
with
(
"cityObjectId"
,
parentId
));
propertyElement
.
unsetAbstractADEFeature
();
}
else
{
String
href
=
propertyElement
.
getHref
();
if
(
href
!=
null
&&
href
.
length
()
!=
0
)
helper
.
logOrThrowUnsupportedXLinkMessage
(
parent
,
AbstractADEFeature
.
class
,
href
);
}
}
}
}
}
@Override
@Override
...
...
src/main/java/de/stuttgart/hft/ade/energy3/schema/ADETable.java
View file @
86bff7d5
...
@@ -27,6 +27,7 @@ public enum ADETable {
...
@@ -27,6 +27,7 @@ public enum ADETable {
QUALIFIED_ATTRIBUTE
(
AbstractQualifiedAttributeImporter
.
class
),
QUALIFIED_ATTRIBUTE
(
AbstractQualifiedAttributeImporter
.
class
),
REFURBISHMENT_MEASURE
(
RefurbishmentMeasureImporter
.
class
),
REFURBISHMENT_MEASURE
(
RefurbishmentMeasureImporter
.
class
),
RESOURCE
(
ResourceImporter
.
class
),
RESOURCE
(
ResourceImporter
.
class
),
FEATURE_WITH_LIFE_SPAN
(
AbstractFeatureWithLifeSpanImporter
.
class
),
SCHEDULE
(
null
),
SCHEDULE
(
null
),
SCHEDULE_COMPONENT
(
null
),
SCHEDULE_COMPONENT
(
null
),
SENSOR_DATA
(
null
),
SENSOR_DATA
(
null
),
...
...
src/main/java/de/stuttgart/hft/ade/energy3/schema/ObjectMapper.java
View file @
86bff7d5
...
@@ -85,6 +85,12 @@ public class ObjectMapper implements ADEObjectMapper {
...
@@ -85,6 +85,12 @@ public class ObjectMapper implements ADEObjectMapper {
case
"QualifiedArea"
:
case
"QualifiedArea"
:
objectClassIds
.
put
(
QualifiedArea
.
class
,
objectClassId
);
objectClassIds
.
put
(
QualifiedArea
.
class
,
objectClassId
);
break
;
break
;
case
"AbstractADEFeature"
:
objectClassIds
.
put
(
AbstractADEFeature
.
class
,
objectClassId
);
break
;
case
"AbstractFeatureWithLifeSpan"
:
objectClassIds
.
put
(
AbstractFeatureWithLifeSpan
.
class
,
objectClassId
);
break
;
}
}
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment