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
83e7fafd
Commit
83e7fafd
authored
Jan 28, 2026
by
PrabithaPrabhakaran
Browse files
Marshaller, Unmarshaller, Importer, Exporter for time series
parent
d618bc60
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/stuttgart/hft/ade/energy3/exporter/AbstractADEFeatureExporter.java
View file @
83e7fafd
package
de.stuttgart.hft.ade.energy3.exporter
;
package
de.stuttgart.hft.ade.energy3.exporter
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
de.stuttgart.hft.ade.energy3.schema.ADETable
;
import
de.stuttgart.hft.ade.energy3.schema.ADETable
;
import
net.opengis.citygml._2.ExternalReferenceType
;
import
org.citydb.core.ade.exporter.ADEExporter
;
import
org.citydb.core.ade.exporter.ADEExporter
;
import
org.citydb.core.ade.exporter.CityGMLExportHelper
;
import
org.citydb.core.ade.exporter.CityGMLExportHelper
;
import
org.citydb.core.database.schema.mapping.ObjectType
;
import
org.citydb.core.database.schema.mapping.ObjectType
;
...
@@ -10,10 +13,12 @@ import org.citygml4j.ade.energy3.model.supportingClasses.*;
...
@@ -10,10 +13,12 @@ import org.citygml4j.ade.energy3.model.supportingClasses.*;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.lang.reflect.Type
;
import
java.sql.*
;
import
java.sql.*
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.GregorianCalendar
;
import
java.util.GregorianCalendar
;
import
java.util.List
;
public
class
AbstractADEFeatureExporter
implements
ADEExporter
{
public
class
AbstractADEFeatureExporter
implements
ADEExporter
{
...
@@ -53,10 +58,13 @@ public class AbstractADEFeatureExporter implements ADEExporter {
...
@@ -53,10 +58,13 @@ public class AbstractADEFeatureExporter implements ADEExporter {
// Set AbstractADEFeature properties
// Set AbstractADEFeature properties
//externalReference ----------> fix
//externalReference ----------> fix
// String external_reference = rs.getString(3);
String
external_reference
=
rs
.
getString
(
3
);
// if (external_reference != null) {
if
(
external_reference
!=
null
)
{
// adeFeature.setExternalReference(external_reference);
Gson
gson
=
new
Gson
();
// }
Type
listType
=
new
TypeToken
<
List
<
ExternalReferenceType
>>(){}.
getType
();
List
<
ExternalReferenceType
>
refs
=
gson
.
fromJson
(
external_reference
,
listType
);
adeFeature
.
setExternalReference
(
refs
);
}
Timestamp
creation_date
=
rs
.
getTimestamp
(
9
);
Timestamp
creation_date
=
rs
.
getTimestamp
(
9
);
Timestamp
termination_date
=
rs
.
getTimestamp
(
10
);
Timestamp
termination_date
=
rs
.
getTimestamp
(
10
);
...
...
src/main/java/de/stuttgart/hft/ade/energy3/exporter/TimeSeriesExporter.java
View file @
83e7fafd
...
@@ -128,7 +128,7 @@ public class TimeSeriesExporter implements ADEExporter {
...
@@ -128,7 +128,7 @@ public class TimeSeriesExporter implements ADEExporter {
MeasureList
measureList
=
new
MeasureList
();
MeasureList
measureList
=
new
MeasureList
();
measureList
.
setValue
(
valuesList
);
measureList
.
setValue
(
valuesList
);
measureList
.
setUom
(
uom
!=
null
?
uom
:
""
);
measureList
.
setUom
(
uom
!=
null
?
uom
:
""
);
regularTimeSeries
.
setValues
(
measureList
);
regularTimeSeries
.
setValues
List
(
measureList
);
}
}
}
else
if
(
abstractTimeSeries
instanceof
RegularTimeSeriesFile
)
{
}
else
if
(
abstractTimeSeries
instanceof
RegularTimeSeriesFile
)
{
...
@@ -211,23 +211,23 @@ public class TimeSeriesExporter implements ADEExporter {
...
@@ -211,23 +211,23 @@ public class TimeSeriesExporter implements ADEExporter {
if
(
value_column_number
!=
null
)
{
if
(
value_column_number
!=
null
)
{
regularTimeSeriesFile
.
setValueColumnNumber
(
value_column_number
);
regularTimeSeriesFile
.
setValueColumnNumber
(
value_column_number
);
}
}
}
else
if
(
abstractTimeSeries
instanceof
TypicalValuesTimeSeries
)
{
}
else
if
(
abstractTimeSeries
instanceof
TypicalValues
Regular
TimeSeries
)
{
TypicalValuesTimeSeries
typicalValuesTimeSeries
=
(
TypicalValuesTimeSeries
)
abstractTimeSeries
;
TypicalValues
Regular
TimeSeries
typicalValues
Regular
TimeSeries
=
(
TypicalValues
Regular
TimeSeries
)
abstractTimeSeries
;
Time
start_time
=
rs
.
getTime
(
9
);
Time
start_time
=
rs
.
getTime
(
9
);
if
(
start_time
!=
null
)
{
if
(
start_time
!=
null
)
{
LocalTime
startTimestamp
=
start_time
.
toLocalTime
();
LocalTime
startTimestamp
=
start_time
.
toLocalTime
();
typicalValuesTimeSeries
.
setStartTime
(
startTimestamp
);
typicalValues
Regular
TimeSeries
.
setStartTime
(
startTimestamp
);
}
}
Integer
start_day
=
rs
.
getObject
(
10
)
!=
null
?
rs
.
getInt
(
10
)
:
null
;
Integer
start_day
=
rs
.
getObject
(
10
)
!=
null
?
rs
.
getInt
(
10
)
:
null
;
if
(
start_day
!=
null
)
{
if
(
start_day
!=
null
)
{
typicalValuesTimeSeries
.
setStartDay
(
start_day
);
typicalValues
Regular
TimeSeries
.
setStartDay
(
start_day
);
}
}
Integer
start_month
=
rs
.
getObject
(
11
)
!=
null
?
rs
.
getInt
(
11
)
:
null
;
Integer
start_month
=
rs
.
getObject
(
11
)
!=
null
?
rs
.
getInt
(
11
)
:
null
;
if
(
start_month
!=
null
)
{
if
(
start_month
!=
null
)
{
typicalValuesTimeSeries
.
setStartMonth
(
start_month
);
typicalValues
Regular
TimeSeries
.
setStartMonth
(
start_month
);
}
}
Double
time_interval
=
rs
.
getObject
(
14
)
!=
null
?
rs
.
getDouble
(
14
)
:
null
;
Double
time_interval
=
rs
.
getObject
(
14
)
!=
null
?
rs
.
getDouble
(
14
)
:
null
;
...
@@ -236,7 +236,7 @@ public class TimeSeriesExporter implements ADEExporter {
...
@@ -236,7 +236,7 @@ public class TimeSeriesExporter implements ADEExporter {
TimeIntervalLength
timeIntervalLength
=
new
TimeIntervalLength
();
TimeIntervalLength
timeIntervalLength
=
new
TimeIntervalLength
();
timeIntervalLength
.
setValue
(
time_interval
);
timeIntervalLength
.
setValue
(
time_interval
);
timeIntervalLength
.
setUnit
(
time_interval_unit
);
timeIntervalLength
.
setUnit
(
time_interval_unit
);
typicalValuesTimeSeries
.
setTimeInterval
(
timeIntervalLength
);
typicalValues
Regular
TimeSeries
.
setTimeInterval
(
timeIntervalLength
);
}
}
Double
temporal_extent
=
rs
.
getDouble
(
12
);
Double
temporal_extent
=
rs
.
getDouble
(
12
);
...
@@ -245,7 +245,7 @@ public class TimeSeriesExporter implements ADEExporter {
...
@@ -245,7 +245,7 @@ public class TimeSeriesExporter implements ADEExporter {
TimeIntervalLength
timeIntervalLength
=
new
TimeIntervalLength
();
TimeIntervalLength
timeIntervalLength
=
new
TimeIntervalLength
();
timeIntervalLength
.
setValue
(
temporal_extent
);
timeIntervalLength
.
setValue
(
temporal_extent
);
timeIntervalLength
.
setUnit
(
temporal_extent_unit
);
timeIntervalLength
.
setUnit
(
temporal_extent_unit
);
typicalValuesTimeSeries
.
setTemporalExtent
(
timeIntervalLength
);
typicalValues
Regular
TimeSeries
.
setTemporalExtent
(
timeIntervalLength
);
}
}
String
valuesString
=
rs
.
getString
(
16
);
String
valuesString
=
rs
.
getString
(
16
);
...
@@ -258,10 +258,10 @@ public class TimeSeriesExporter implements ADEExporter {
...
@@ -258,10 +258,10 @@ public class TimeSeriesExporter implements ADEExporter {
MeasureList
measureList
=
new
MeasureList
();
MeasureList
measureList
=
new
MeasureList
();
measureList
.
setValue
(
valuesList
);
measureList
.
setValue
(
valuesList
);
measureList
.
setUom
(
uom
!=
null
?
uom
:
""
);
measureList
.
setUom
(
uom
!=
null
?
uom
:
""
);
typicalValuesTimeSeries
.
setValues
(
measureList
);
typicalValues
Regular
TimeSeries
.
setValues
(
measureList
);
}
}
}
else
if
(
abstractTimeSeries
instanceof
TypicalValuesTimeSeriesFile
)
{
}
else
if
(
abstractTimeSeries
instanceof
TypicalValues
Regular
TimeSeriesFile
)
{
TypicalValuesTimeSeriesFile
timeSeriesFile
=
(
TypicalValuesTimeSeriesFile
)
abstractTimeSeries
;
TypicalValues
Regular
TimeSeriesFile
timeSeriesFile
=
(
TypicalValues
Regular
TimeSeriesFile
)
abstractTimeSeries
;
// Read the TIME column (no date)
// Read the TIME column (no date)
Time
sqlTime
=
rs
.
getTime
(
9
);
Time
sqlTime
=
rs
.
getTime
(
9
);
...
@@ -306,7 +306,9 @@ public class TimeSeriesExporter implements ADEExporter {
...
@@ -306,7 +306,9 @@ public class TimeSeriesExporter implements ADEExporter {
String
uom
=
rs
.
getString
(
18
);
String
uom
=
rs
.
getString
(
18
);
if
(
uom
!=
null
)
{
if
(
uom
!=
null
)
{
timeSeriesFile
.
setUom
(
uom
);
UnitOfMeasure
unitOfMeasure
=
new
UnitOfMeasure
();
unitOfMeasure
.
setUom
(
uom
);
timeSeriesFile
.
setUom
(
unitOfMeasure
);
}
}
String
file_uri
=
rs
.
getString
(
19
);
String
file_uri
=
rs
.
getString
(
19
);
...
@@ -370,9 +372,9 @@ public class TimeSeriesExporter implements ADEExporter {
...
@@ -370,9 +372,9 @@ public class TimeSeriesExporter implements ADEExporter {
String
uom
=
rs
.
getString
(
18
);
String
uom
=
rs
.
getString
(
18
);
if
(
uom
!=
null
&&
!
uom
.
trim
().
isEmpty
())
{
if
(
uom
!=
null
&&
!
uom
.
trim
().
isEmpty
())
{
UnitOfMeasure
Type
uomType
=
new
UnitOfMeasure
Type
();
UnitOfMeasure
uomType
=
new
UnitOfMeasure
();
uomType
.
setUom
(
uom
.
trim
()
);
uomType
.
setUom
(
uom
);
sensorConnection
.
setUom
(
uom
);
sensorConnection
.
setUom
(
uom
Type
);
}
}
String
sensor_id
=
rs
.
getString
(
37
);
String
sensor_id
=
rs
.
getString
(
37
);
...
@@ -432,8 +434,168 @@ public class TimeSeriesExporter implements ADEExporter {
...
@@ -432,8 +434,168 @@ public class TimeSeriesExporter implements ADEExporter {
if
(
mqtt_topic
!=
null
)
{
if
(
mqtt_topic
!=
null
)
{
sensorConnection
.
setMqtTopic
(
mqtt_topic
);
sensorConnection
.
setMqtTopic
(
mqtt_topic
);
}
}
}
else
if
(
abstractTimeSeries
instanceof
MonthlyTimeSeries
){
MonthlyTimeSeries
monthlyTimeSeries
=
(
MonthlyTimeSeries
)
abstractTimeSeries
;
OffsetDateTime
beginOffset
=
rs
.
getObject
(
7
,
OffsetDateTime
.
class
);
OffsetDateTime
endOffset
=
rs
.
getObject
(
8
,
OffsetDateTime
.
class
);
if
(
beginOffset
!=
null
&&
endOffset
!=
null
)
{
// Convert to ZonedDateTime if your model requires it
ZonedDateTime
beginZdt
=
beginOffset
.
atZoneSameInstant
(
ZoneOffset
.
UTC
);
ZonedDateTime
endZdt
=
endOffset
.
atZoneSameInstant
(
ZoneOffset
.
UTC
);
TimePeriod
timePeriod
=
new
TimePeriod
();
timePeriod
.
setBeginPosition
(
beginZdt
);
timePeriod
.
setEndPosition
(
endZdt
);
TimePeriodProperty
timePeriodProperty
=
new
TimePeriodProperty
();
timePeriodProperty
.
setTimePeriod
(
timePeriod
);
monthlyTimeSeries
.
setTemporalExtent
(
timePeriodProperty
);
}
String
valuesString
=
rs
.
getString
(
16
);
String
uom
=
rs
.
getString
(
17
);
if
(
valuesString
!=
null
&&
!
valuesString
.
isBlank
())
{
List
<
Double
>
valuesList
=
Arrays
.
stream
(
valuesString
.
trim
().
split
(
"\\s+"
))
.
map
(
Double:
:
parseDouble
)
.
collect
(
Collectors
.
toList
());
MeasureList
measureList
=
new
MeasureList
();
measureList
.
setValue
(
valuesList
);
measureList
.
setUom
(
uom
!=
null
?
uom
:
""
);
monthlyTimeSeries
.
setValuesList
(
measureList
);
}
}
else
if
(
abstractTimeSeries
instanceof
MonthlyTimeSeriesFile
){
MonthlyTimeSeriesFile
timeSeriesFile
=
(
MonthlyTimeSeriesFile
)
abstractTimeSeries
;
OffsetDateTime
beginOffset
=
rs
.
getObject
(
7
,
OffsetDateTime
.
class
);
OffsetDateTime
endOffset
=
rs
.
getObject
(
8
,
OffsetDateTime
.
class
);
if
(
beginOffset
!=
null
&&
endOffset
!=
null
)
{
// Convert to ZonedDateTime if your model requires it
ZonedDateTime
beginZdt
=
beginOffset
.
atZoneSameInstant
(
ZoneOffset
.
UTC
);
ZonedDateTime
endZdt
=
endOffset
.
atZoneSameInstant
(
ZoneOffset
.
UTC
);
TimePeriod
timePeriod
=
new
TimePeriod
();
timePeriod
.
setBeginPosition
(
beginZdt
);
timePeriod
.
setEndPosition
(
endZdt
);
TimePeriodProperty
timePeriodProperty
=
new
TimePeriodProperty
();
timePeriodProperty
.
setTimePeriod
(
timePeriod
);
timeSeriesFile
.
setTemporalExtent
(
timePeriodProperty
);
}
String
uom
=
rs
.
getString
(
18
);
if
(
uom
!=
null
)
{
UnitOfMeasure
uomType
=
new
UnitOfMeasure
();
uomType
.
setUom
(
uom
);
timeSeriesFile
.
setUom
(
uomType
);
}
String
file_uri
=
rs
.
getString
(
19
);
if
(
file_uri
!=
null
&&
!
file_uri
.
isEmpty
())
{
try
{
timeSeriesFile
.
setFileURI
(
URI
.
create
(
file_uri
));
}
catch
(
IllegalArgumentException
e
)
{
System
.
out
.
println
(
"Invalid URI for TimeSeries id="
+
timeSeriesId
+
": "
+
file_uri
);
}
}
int
num_of_header_lines
=
rs
.
getInt
(
20
);
if
(!
rs
.
wasNull
())
{
timeSeriesFile
.
setNumberOfHeaderLines
(
num_of_header_lines
);
}
String
field_separator
=
rs
.
getString
(
21
);
if
(
field_separator
!=
null
)
{
timeSeriesFile
.
setFieldSeparator
(
field_separator
);
}
String
record_separator
=
rs
.
getString
(
22
);
if
(
record_separator
!=
null
)
{
timeSeriesFile
.
setRecordSeparator
(
record_separator
);
}
String
decimal_symbol
=
rs
.
getString
(
24
);
if
(
decimal_symbol
!=
null
)
{
timeSeriesFile
.
setDecimalSymbol
(
decimal_symbol
);
}
Integer
value_column_number
=
rs
.
getObject
(
23
)
!=
null
?
rs
.
getInt
(
23
)
:
null
;
if
(
value_column_number
!=
null
)
{
timeSeriesFile
.
setValueColumnNumber
(
value_column_number
);
}
}
else
if
(
abstractTimeSeries
instanceof
TypicalValuesMonthlyTimeSeries
){
TypicalValuesMonthlyTimeSeries
timeSeries
=
(
TypicalValuesMonthlyTimeSeries
)
abstractTimeSeries
;
Double
temporal_extent
=
rs
.
getDouble
(
12
);
String
temporal_extent_unit
=
rs
.
getString
(
13
);
if
(!
rs
.
wasNull
())
{
TimeIntervalLength
timeIntervalLength
=
new
TimeIntervalLength
();
timeIntervalLength
.
setValue
(
temporal_extent
);
timeIntervalLength
.
setUnit
(
temporal_extent_unit
);
timeSeries
.
setTemporalExtent
(
timeIntervalLength
);
}
Integer
start_month
=
rs
.
getObject
(
11
)
!=
null
?
rs
.
getInt
(
11
)
:
null
;
if
(
start_month
!=
null
)
{
timeSeries
.
setStartMonth
(
start_month
);
}
String
valuesString
=
rs
.
getString
(
16
);
String
uom
=
rs
.
getString
(
17
);
if
(
valuesString
!=
null
&&
!
valuesString
.
isBlank
())
{
List
<
Double
>
valuesList
=
Arrays
.
stream
(
valuesString
.
trim
().
split
(
"\\s+"
))
.
map
(
Double:
:
parseDouble
)
.
collect
(
Collectors
.
toList
());
MeasureList
measureList
=
new
MeasureList
();
measureList
.
setValue
(
valuesList
);
measureList
.
setUom
(
uom
!=
null
?
uom
:
""
);
timeSeries
.
setValuesList
(
measureList
);
}
}
else
if
(
abstractTimeSeries
instanceof
TypicalValuesMonthlyTimeSeriesFile
){
TypicalValuesMonthlyTimeSeriesFile
timeSeriesFile
=
(
TypicalValuesMonthlyTimeSeriesFile
)
abstractTimeSeries
;
Integer
start_month
=
rs
.
getObject
(
11
)
!=
null
?
rs
.
getInt
(
11
)
:
null
;
if
(
start_month
!=
null
)
{
timeSeriesFile
.
setStartMonth
(
start_month
);
}
String
uom
=
rs
.
getString
(
18
);
if
(
uom
!=
null
)
{
UnitOfMeasure
uomType
=
new
UnitOfMeasure
();
uomType
.
setUom
(
uom
);
timeSeriesFile
.
setUom
(
uomType
);
}
String
file_uri
=
rs
.
getString
(
19
);
if
(
file_uri
!=
null
&&
!
file_uri
.
isEmpty
())
{
try
{
timeSeriesFile
.
setFileURI
(
URI
.
create
(
file_uri
));
}
catch
(
IllegalArgumentException
e
)
{
System
.
out
.
println
(
"Invalid URI for TimeSeries id="
+
timeSeriesId
+
": "
+
file_uri
);
}
}
int
num_of_header_lines
=
rs
.
getInt
(
20
);
if
(!
rs
.
wasNull
())
{
timeSeriesFile
.
setNumberOfHeaderLines
(
num_of_header_lines
);
}
String
field_separator
=
rs
.
getString
(
21
);
if
(
field_separator
!=
null
)
{
timeSeriesFile
.
setFieldSeparator
(
field_separator
);
}
String
record_separator
=
rs
.
getString
(
22
);
if
(
record_separator
!=
null
)
{
timeSeriesFile
.
setRecordSeparator
(
record_separator
);
}
String
decimal_symbol
=
rs
.
getString
(
24
);
if
(
decimal_symbol
!=
null
)
{
timeSeriesFile
.
setDecimalSymbol
(
decimal_symbol
);
}
Integer
value_column_number
=
rs
.
getObject
(
23
)
!=
null
?
rs
.
getInt
(
23
)
:
null
;
if
(
value_column_number
!=
null
)
{
timeSeriesFile
.
setValueColumnNumber
(
value_column_number
);
}
}
}
result
.
add
(
abstractTimeSeries
);
result
.
add
(
abstractTimeSeries
);
}
}
return
result
;
return
result
;
}
}
...
@@ -453,4 +615,4 @@ public class TimeSeriesExporter implements ADEExporter {
...
@@ -453,4 +615,4 @@ public class TimeSeriesExporter implements ADEExporter {
"link_to_sensor_description, mqtt_server, mqtt_topic, observation_id, observation_property, "
+
"link_to_sensor_description, mqtt_server, mqtt_topic, observation_id, observation_property, "
+
"sensor_id, sensor_name"
;
"sensor_id, sensor_name"
;
}
}
}
}
\ No newline at end of file
src/main/java/de/stuttgart/hft/ade/energy3/importer/AbstractADEFeatureImporter.java
View file @
83e7fafd
package
de.stuttgart.hft.ade.energy3.importer
;
package
de.stuttgart.hft.ade.energy3.importer
;
import
de.stuttgart.hft.ade.energy3.schema.ADETable
;
import
de.stuttgart.hft.ade.energy3.schema.ADETable
;
import
net.opengis.citygml._2.ExternalReferenceType
;
import
org.citydb.core.ade.importer.ADEImporter
;
import
org.citydb.core.ade.importer.ADEImporter
;
import
org.citydb.core.ade.importer.CityGMLImportHelper
;
import
org.citydb.core.ade.importer.CityGMLImportHelper
;
import
org.citydb.core.ade.importer.ForeignKeys
;
import
org.citydb.core.ade.importer.ForeignKeys
;
...
@@ -12,6 +13,8 @@ import org.citygml4j.ade.energy3.model.supportingClasses.AbstractADEFeature;
...
@@ -12,6 +13,8 @@ import org.citygml4j.ade.energy3.model.supportingClasses.AbstractADEFeature;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.sql.*
;
import
java.sql.*
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
public
class
AbstractADEFeatureImporter
implements
ADEImporter
{
public
class
AbstractADEFeatureImporter
implements
ADEImporter
{
...
@@ -56,9 +59,12 @@ public class AbstractADEFeatureImporter implements ADEImporter {
...
@@ -56,9 +59,12 @@ public class AbstractADEFeatureImporter implements ADEImporter {
private
void
setAbstractADEFeatureProperties
(
AbstractADEFeature
abstractADEFeature
)
throws
SQLException
{
private
void
setAbstractADEFeatureProperties
(
AbstractADEFeature
abstractADEFeature
)
throws
SQLException
{
if
(
abstractADEFeature
.
getExternalReference
()
!=
null
)
{
List
<
ExternalReferenceType
>
refs
=
abstractADEFeature
.
getExternalReference
();
// ps.setString(9, abstractADEFeature.getExternalReference());
if
(
refs
!=
null
)
{
String
joined
=
refs
.
stream
()
.
map
(
r
->
r
.
getInformationSystem
())
.
collect
(
Collectors
.
joining
(
","
));
ps
.
setString
(
9
,
joined
);
}
}
if
(
abstractADEFeature
.
getCreationDate
()!=
null
){
if
(
abstractADEFeature
.
getCreationDate
()!=
null
){
XMLGregorianCalendar
xmlCal
=
abstractADEFeature
.
getCreationDate
();
XMLGregorianCalendar
xmlCal
=
abstractADEFeature
.
getCreationDate
();
...
...
src/main/java/de/stuttgart/hft/ade/energy3/importer/TimeSeriesImporter.java
View file @
83e7fafd
...
@@ -47,10 +47,10 @@ public class TimeSeriesImporter implements ADEImporter {
...
@@ -47,10 +47,10 @@ public class TimeSeriesImporter implements ADEImporter {
if
(
abstractTimeSeries
instanceof
RegularTimeSeries
)
{
if
(
abstractTimeSeries
instanceof
RegularTimeSeries
)
{
RegularTimeSeries
regularTimeSeries
=
(
RegularTimeSeries
)
abstractTimeSeries
;
RegularTimeSeries
regularTimeSeries
=
(
RegularTimeSeries
)
abstractTimeSeries
;
if
(
regularTimeSeries
.
isSetValues
()
&&
regularTimeSeries
.
getValues
().
isSetValue
())
{
if
(
regularTimeSeries
.
isSetValues
()
&&
regularTimeSeries
.
getValues
List
().
isSetValue
())
{
String
values
=
valueJoiner
.
join
(
" "
,
regularTimeSeries
.
getValues
().
getValue
());
String
values
=
valueJoiner
.
join
(
" "
,
regularTimeSeries
.
getValues
List
().
getValue
());
psTimeSeries
.
setString
(
16
,
values
);
psTimeSeries
.
setString
(
16
,
values
);
psTimeSeries
.
setString
(
17
,
regularTimeSeries
.
getValues
().
getUom
());
psTimeSeries
.
setString
(
17
,
regularTimeSeries
.
getValues
List
().
getUom
());
}
}
if
(
regularTimeSeries
.
isSetTemporalExtent
()){
if
(
regularTimeSeries
.
isSetTemporalExtent
()){
ZonedDateTime
begin
=
regularTimeSeries
.
getTemporalExtent
().
getTimePeriod
().
getBeginPosition
();
ZonedDateTime
begin
=
regularTimeSeries
.
getTemporalExtent
().
getTimePeriod
().
getBeginPosition
();
...
@@ -99,9 +99,9 @@ public class TimeSeriesImporter implements ADEImporter {
...
@@ -99,9 +99,9 @@ public class TimeSeriesImporter implements ADEImporter {
psTimeSeries
.
setDouble
(
14
,
timeSeriesFile
.
getTimeInterval
().
getValue
());
psTimeSeries
.
setDouble
(
14
,
timeSeriesFile
.
getTimeInterval
().
getValue
());
psTimeSeries
.
setString
(
15
,
timeSeriesFile
.
getTimeInterval
().
getUnit
());
psTimeSeries
.
setString
(
15
,
timeSeriesFile
.
getTimeInterval
().
getUnit
());
}
}
}
else
if
(
abstractTimeSeries
instanceof
TypicalValuesTimeSeries
)
{
}
else
if
(
abstractTimeSeries
instanceof
TypicalValues
Regular
TimeSeries
)
{
TypicalValuesTimeSeries
timeSeries
=
(
TypicalValuesTimeSeries
)
abstractTimeSeries
;
TypicalValues
Regular
TimeSeries
timeSeries
=
(
TypicalValues
Regular
TimeSeries
)
abstractTimeSeries
;
if
(
timeSeries
.
isSetStartTime
())
{
if
(
timeSeries
.
isSetStartTime
())
{
psTimeSeries
.
setObject
(
9
,
timeSeries
.
getStartTime
());
psTimeSeries
.
setObject
(
9
,
timeSeries
.
getStartTime
());
...
@@ -125,8 +125,8 @@ public class TimeSeriesImporter implements ADEImporter {
...
@@ -125,8 +125,8 @@ public class TimeSeriesImporter implements ADEImporter {
psTimeSeries
.
setDouble
(
14
,
timeSeries
.
getTimeInterval
().
getValue
());
psTimeSeries
.
setDouble
(
14
,
timeSeries
.
getTimeInterval
().
getValue
());
psTimeSeries
.
setString
(
15
,
timeSeries
.
getTimeInterval
().
getUnit
());
psTimeSeries
.
setString
(
15
,
timeSeries
.
getTimeInterval
().
getUnit
());
}
}
}
else
if
(
abstractTimeSeries
instanceof
TypicalValuesTimeSeriesFile
)
{
}
else
if
(
abstractTimeSeries
instanceof
TypicalValues
Regular
TimeSeriesFile
)
{
TypicalValuesTimeSeriesFile
file
=
(
TypicalValuesTimeSeriesFile
)
abstractTimeSeries
;
TypicalValues
Regular
TimeSeriesFile
file
=
(
TypicalValues
Regular
TimeSeriesFile
)
abstractTimeSeries
;
if
(
file
.
isSetStartTime
())
{
if
(
file
.
isSetStartTime
())
{
LocalTime
localTime
=
file
.
getStartTime
().
toLocalTime
();
LocalTime
localTime
=
file
.
getStartTime
().
toLocalTime
();
// Store as UTC timestamp (dummy date doesn't matter)
// Store as UTC timestamp (dummy date doesn't matter)
...
@@ -141,7 +141,7 @@ public class TimeSeriesImporter implements ADEImporter {
...
@@ -141,7 +141,7 @@ public class TimeSeriesImporter implements ADEImporter {
psTimeSeries
.
setInt
(
11
,
file
.
getStartMonth
());
psTimeSeries
.
setInt
(
11
,
file
.
getStartMonth
());
}
}
if
(
file
.
isSetUom
())
if
(
file
.
isSetUom
())
psTimeSeries
.
setString
(
18
,
file
.
getUom
());
psTimeSeries
.
setString
(
18
,
file
.
getUom
()
.
getUom
()
);
if
(
file
.
isSetFileURI
())
if
(
file
.
isSetFileURI
())
psTimeSeries
.
setString
(
19
,
file
.
getFileURI
().
toString
());
psTimeSeries
.
setString
(
19
,
file
.
getFileURI
().
toString
());
...
@@ -177,7 +177,7 @@ public class TimeSeriesImporter implements ADEImporter {
...
@@ -177,7 +177,7 @@ public class TimeSeriesImporter implements ADEImporter {
if
(
sensorConnection
.
isSetObservationProperty
())
if
(
sensorConnection
.
isSetObservationProperty
())
psTimeSeries
.
setString
(
36
,
sensorConnection
.
getObservationProperty
());
psTimeSeries
.
setString
(
36
,
sensorConnection
.
getObservationProperty
());
if
(
sensorConnection
.
isSetUom
()
&&
sensorConnection
.
getUom
()
!=
null
)
{
if
(
sensorConnection
.
isSetUom
()
&&
sensorConnection
.
getUom
()
!=
null
)
{
psTimeSeries
.
setString
(
18
,
sensorConnection
.
getUom
());
psTimeSeries
.
setString
(
18
,
sensorConnection
.
getUom
()
.
getUom
()
);
}
}
if
(
sensorConnection
.
isSetSensorID
())
if
(
sensorConnection
.
isSetSensorID
())
psTimeSeries
.
setString
(
37
,
sensorConnection
.
getSensorID
());
psTimeSeries
.
setString
(
37
,
sensorConnection
.
getSensorID
());
...
@@ -205,6 +205,83 @@ public class TimeSeriesImporter implements ADEImporter {
...
@@ -205,6 +205,83 @@ public class TimeSeriesImporter implements ADEImporter {
psTimeSeries
.
setString
(
31
,
sensorConnection
.
getLinkToObservation
());
psTimeSeries
.
setString
(
31
,
sensorConnection
.
getLinkToObservation
());
if
(
sensorConnection
.
isSetLinkToSensorDescription
())
if
(
sensorConnection
.
isSetLinkToSensorDescription
())
psTimeSeries
.
setString
(
32
,
sensorConnection
.
getLinkToSensorDescription
());
psTimeSeries
.
setString
(
32
,
sensorConnection
.
getLinkToSensorDescription
());
}
else
if
(
abstractTimeSeries
instanceof
MonthlyTimeSeries
)
{
MonthlyTimeSeries
monthlyTimeSeries
=
(
MonthlyTimeSeries
)
abstractTimeSeries
;
if
(
monthlyTimeSeries
.
isSetTemporalExtent
())
{
ZonedDateTime
begin
=
monthlyTimeSeries
.
getTemporalExtent
().
getTimePeriod
().
getBeginPosition
();
ZonedDateTime
end
=
monthlyTimeSeries
.
getTemporalExtent
().
getTimePeriod
().
getEndPosition
();
// FIX 1: Force UTC
ZonedDateTime
beginUTC
=
begin
.
withZoneSameInstant
(
ZoneOffset
.
UTC
);
ZonedDateTime
endUTC
=
end
.
withZoneSameInstant
(
ZoneOffset
.
UTC
);
psTimeSeries
.
setTimestamp
(
7
,
Timestamp
.
from
(
beginUTC
.
toInstant
()));
psTimeSeries
.
setTimestamp
(
8
,
Timestamp
.
from
(
endUTC
.
toInstant
()));
}
if
(
monthlyTimeSeries
.
isSetValuesList
())
{
psTimeSeries
.
setString
(
16
,
monthlyTimeSeries
.
getValuesList
().
getValue
().
toString
());
psTimeSeries
.
setString
(
17
,
monthlyTimeSeries
.
getValuesList
().
getUom
());
}
}
else
if
(
abstractTimeSeries
instanceof
MonthlyTimeSeriesFile
)
{
MonthlyTimeSeriesFile
monthlyTimeSeriesFile
=
(
MonthlyTimeSeriesFile
)
abstractTimeSeries
;
if
(
monthlyTimeSeriesFile
.
isSetTemporalExtent
())
{
ZonedDateTime
begin
=
monthlyTimeSeriesFile
.
getTemporalExtent
().
getTimePeriod
().
getBeginPosition
();
ZonedDateTime
end
=
monthlyTimeSeriesFile
.
getTemporalExtent
().
getTimePeriod
().
getEndPosition
();
// FIX 1: Force UTC
ZonedDateTime
beginUTC
=
begin
.
withZoneSameInstant
(
ZoneOffset
.
UTC
);
ZonedDateTime
endUTC
=
end
.
withZoneSameInstant
(
ZoneOffset
.
UTC
);
psTimeSeries
.
setTimestamp
(
7
,
Timestamp
.
from
(
beginUTC
.
toInstant
()));
psTimeSeries
.
setTimestamp
(
8
,
Timestamp
.
from
(
endUTC
.
toInstant
()));
}
if
(
monthlyTimeSeriesFile
.
isSetUom
())
psTimeSeries
.
setString
(
18
,
monthlyTimeSeriesFile
.
getUom
().
getUom
());
if
(
monthlyTimeSeriesFile
.
isSetFileURI
())
psTimeSeries
.
setString
(
19
,
monthlyTimeSeriesFile
.
getFileURI
().
toString
());
if
(
monthlyTimeSeriesFile
.
isSetNumberOfHeaderLines
())
psTimeSeries
.
setLong
(
20
,
monthlyTimeSeriesFile
.
getNumberOfHeaderLines
());
if
(
monthlyTimeSeriesFile
.
isSetFieldSeparator
())
psTimeSeries
.
setString
(
21
,
monthlyTimeSeriesFile
.
getFieldSeparator
());
if
(
monthlyTimeSeriesFile
.
isSetRecordSeparator
())
psTimeSeries
.
setString
(
22
,
monthlyTimeSeriesFile
.
getRecordSeparator
());
if
(
monthlyTimeSeriesFile
.
isSetDecimalSymbol
())
psTimeSeries
.
setString
(
24
,
monthlyTimeSeriesFile
.
getDecimalSymbol
());
if
(
monthlyTimeSeriesFile
.
isSetValueColumnNumber
())
psTimeSeries
.
setInt
(
23
,
monthlyTimeSeriesFile
.
getValueColumnNumber
());
}
else
if
(
abstractTimeSeries
instanceof
TypicalValuesMonthlyTimeSeries
)
{
TypicalValuesMonthlyTimeSeries
typicalValuesMonthlyTimeSeries
=
new
TypicalValuesMonthlyTimeSeries
();
if
(
typicalValuesMonthlyTimeSeries
.
isTemporalExtent
()){
psTimeSeries
.
setDouble
(
12
,
typicalValuesMonthlyTimeSeries
.
getTemporalExtent
().
getValue
());
psTimeSeries
.
setString
(
13
,
typicalValuesMonthlyTimeSeries
.
getTemporalExtent
().
getUnit
());
}
if
(
typicalValuesMonthlyTimeSeries
.
isSetStartMonth
()){
psTimeSeries
.
setInt
(
11
,
typicalValuesMonthlyTimeSeries
.
getStartMonth
());
}
if
(
typicalValuesMonthlyTimeSeries
.
isSetValuesList
()){
psTimeSeries
.
setString
(
16
,
typicalValuesMonthlyTimeSeries
.
getValuesList
().
getValue
().
toString
());
psTimeSeries
.
setString
(
17
,
typicalValuesMonthlyTimeSeries
.
getValuesList
().
getUom
());
}
}
else
if
(
abstractTimeSeries
instanceof
TypicalValuesMonthlyTimeSeriesFile
){
TypicalValuesMonthlyTimeSeriesFile
typicalValuesMonthlyTimeSeriesFile
=
new
TypicalValuesMonthlyTimeSeriesFile
();
if
(
typicalValuesMonthlyTimeSeriesFile
.
isSetStartMonth
())
psTimeSeries
.
setInt
(
11
,
typicalValuesMonthlyTimeSeriesFile
.
getStartMonth
());
if
(
typicalValuesMonthlyTimeSeriesFile
.
isSetUom
())
psTimeSeries
.
setString
(
18
,
typicalValuesMonthlyTimeSeriesFile
.
getUom
().
getUom
());
if
(
typicalValuesMonthlyTimeSeriesFile
.
isSetFileURI
())
psTimeSeries
.
setString
(
19
,
typicalValuesMonthlyTimeSeriesFile
.
getFileURI
().
toString
());
if
(
typicalValuesMonthlyTimeSeriesFile
.
isSetNumberOfHeaderLines
())
psTimeSeries
.
setLong
(
20
,
typicalValuesMonthlyTimeSeriesFile
.
getNumberOfHeaderLines
());
if
(
typicalValuesMonthlyTimeSeriesFile
.
isSetFieldSeparator
())
psTimeSeries
.
setString
(
21
,
typicalValuesMonthlyTimeSeriesFile
.
getFieldSeparator
());
if
(
typicalValuesMonthlyTimeSeriesFile
.
isSetRecordSeparator
())
psTimeSeries
.
setString
(
22
,
typicalValuesMonthlyTimeSeriesFile
.
getRecordSeparator
());
if
(
typicalValuesMonthlyTimeSeriesFile
.
isSetDecimalSymbol
())
psTimeSeries
.
setString
(
24
,
typicalValuesMonthlyTimeSeriesFile
.
getDecimalSymbol
());
if
(
typicalValuesMonthlyTimeSeriesFile
.
isSetValueColumnNumber
())
psTimeSeries
.
setInt
(
23
,
typicalValuesMonthlyTimeSeriesFile
.
getValueColumnNumber
());
}
}
psTimeSeries
.
addBatch
();
psTimeSeries
.
addBatch
();
if
(++
batchCounter
==
helper
.
getDatabaseAdapter
().
getMaxBatchSize
())
if
(++
batchCounter
==
helper
.
getDatabaseAdapter
().
getMaxBatchSize
())
...
...
src/main/java/de/stuttgart/hft/ade/energy3/schema/ObjectMapper.java
View file @
83e7fafd
...
@@ -37,10 +37,10 @@ public class ObjectMapper implements ADEObjectMapper {
...
@@ -37,10 +37,10 @@ public class ObjectMapper implements ADEObjectMapper {
objectClassIds
.
put
(
RegularTimeSeriesFile
.
class
,
objectClassId
);
objectClassIds
.
put
(
RegularTimeSeriesFile
.
class
,
objectClassId
);
break
;
break
;
case
"TypicalValuesTimeSeries"
:
case
"TypicalValuesTimeSeries"
:
objectClassIds
.
put
(
TypicalValuesTimeSeries
.
class
,
objectClassId
);
objectClassIds
.
put
(
TypicalValues
Regular
TimeSeries
.
class
,
objectClassId
);
break
;
break
;
case
"TypicalValuesTimeSeriesFile"
:
case
"TypicalValuesTimeSeriesFile"
:
objectClassIds
.
put
(
TypicalValuesTimeSeriesFile
.
class
,
objectClassId
);
objectClassIds
.
put
(
TypicalValues
Regular
TimeSeriesFile
.
class
,
objectClassId
);
break
;
break
;
case
"SensorConnection"
:
case
"SensorConnection"
:
objectClassIds
.
put
(
SensorConnection
.
class
,
objectClassId
);
objectClassIds
.
put
(
SensorConnection
.
class
,
objectClassId
);
...
...
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