Commit 2ef0d8b9 authored by Rushikesh Padsala's avatar Rushikesh Padsala
Browse files

changed to beta8 classes

parent fa13f958
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--
-- CityGML Energy ADE 3.0 (beta 7)
-- CityGML Energy ADE 3.0 (beta 8)
--
-- Last update: 2025-10-14
-- Last update: 2025-12-15
--
-- This DDL script uninstalls the 3DCityDB schema for the Energy ADE. It must be run
-- from within the ADE Manager plugin of the 3DCityDB Importer/Exporter.
......@@ -25,94 +25,94 @@
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- *********************************** Drop foreign keys **********************************
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ALTER TABLE ng3_address_to_building_unit DROP CONSTRAINT ng3_addr_to_bdgu_fk1;
ALTER TABLE ng3_address_to_building_unit DROP CONSTRAINT ng3_addr_to_bdgu_fk2;
ALTER TABLE ng3_building DROP CONSTRAINT ng3_bdg_fk;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_bdg_fk;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_fk;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_lod1_fk;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_lod2_fk;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_lod3_fk;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_oc_fk;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_sched_fk1;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_sched_fk2;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_sched_fk3;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_tz_fk;
ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_uz_fk;
ALTER TABLE ng3_cityobject DROP CONSTRAINT ng3_cto_fk;
ALTER TABLE ng3_cityobject DROP CONSTRAINT ng3_cto_lcns_fk;
ALTER TABLE ng3_ctyobj_relation DROP CONSTRAINT ng3_cto_rel_fk1;
ALTER TABLE ng3_ctyobj_relation DROP CONSTRAINT ng3_cto_rel_fk2;
ALTER TABLE ng3_device DROP CONSTRAINT ng3_dev_fk;
ALTER TABLE ng3_device DROP CONSTRAINT ng3_dev_ng3_cto_fk;
ALTER TABLE ng3_device DROP CONSTRAINT ng3_dev_oc_fk;
ALTER TABLE ng3_device DROP CONSTRAINT ng3_dev_opt_fk;
ALTER TABLE ng3_device_operation DROP CONSTRAINT ng3_dev_opr_fk;
ALTER TABLE ng3_device_operation DROP CONSTRAINT ng3_dev_opr_dev_fk;
ALTER TABLE ng3_device_operation DROP CONSTRAINT ng3_dev_opr_sched_fk;
ALTER TABLE ng3_energy_perf_cert DROP CONSTRAINT ng3_epc_fk;
ALTER TABLE ng3_energy_perf_cert DROP CONSTRAINT ng3_epc_bdg_fk;
ALTER TABLE ng3_energy_perf_cert DROP CONSTRAINT ng3_epc_bdg_part_fk;
ALTER TABLE ng3_layer DROP CONSTRAINT ng3_lyr_fk;
ALTER TABLE ng3_layer DROP CONSTRAINT ng3_lyr_lcns_fk;
ALTER TABLE ng3_layer DROP CONSTRAINT ng3_lyr_mat_fk;
ALTER TABLE ng3_layered_construction DROP CONSTRAINT ng3_lcns_fk;
ALTER TABLE ng3_layered_construction DROP CONSTRAINT ng3_lcns_lcns_fk;
ALTER TABLE ng3_layered_construction DROP CONSTRAINT ng3_lcns_oc_fk;
ALTER TABLE ng3_layered_construction DROP CONSTRAINT ng3_lcns_lib_fk;
ALTER TABLE ng3_library DROP CONSTRAINT ng3_lib_fk;
ALTER TABLE ng3_library DROP CONSTRAINT ng3_lib_oc_fk;
ALTER TABLE ng3_material DROP CONSTRAINT ng3_mat_fk;
ALTER TABLE ng3_material DROP CONSTRAINT ng3_mat_lib_fk;
ALTER TABLE ng3_occupants DROP CONSTRAINT ng3_occ_fk;
ALTER TABLE ng3_occupants DROP CONSTRAINT ng3_occ_ng3_bdgp_fk;
ALTER TABLE ng3_occupants DROP CONSTRAINT ng3_occ_sched_fk;
ALTER TABLE ng3_opening DROP CONSTRAINT ng3_opn_fk;
ALTER TABLE ng3_optical_property DROP CONSTRAINT ng3_optpty_lcns_fk;
ALTER TABLE ng3_optical_property DROP CONSTRAINT ng3_optpty_oc_fk;
ALTER TABLE ng3_qualified_attribute DROP CONSTRAINT ng3_qatt_oc_fk;
ALTER TABLE ng3_qualified_attribute DROP CONSTRAINT ng3_qatt_bdg_fk;
ALTER TABLE ng3_qualified_attribute DROP CONSTRAINT ng3_qatt_bdg_part_fk;
ALTER TABLE ng3_refurbishment_measure DROP CONSTRAINT ng3_refurb_fk;
ALTER TABLE ng3_refurbishment_measure DROP CONSTRAINT ng3_refurb_bdg_fk;
ALTER TABLE ng3_refurbishment_measure DROP CONSTRAINT ng3_refurb_bdg_part_fk;
ALTER TABLE ng3_resource DROP CONSTRAINT ng3_res_fk;
ALTER TABLE ng3_resource DROP CONSTRAINT ng3_res_oc_fk;
ALTER TABLE ng3_resource DROP CONSTRAINT ng3_res_ts_fk;
ALTER TABLE ng3_resource DROP CONSTRAINT ng3_res_cto_fk;
ALTER TABLE ng3_schedule DROP CONSTRAINT ng3_sched_fk;
ALTER TABLE ng3_schedule DROP CONSTRAINT ng3_sched_oc_fk;
ALTER TABLE ng3_schedule DROP CONSTRAINT ng3_sched_ts_fk;
ALTER TABLE ng3_schedule DROP CONSTRAINT ng3_sched_lib_fk;
ALTER TABLE ng3_schedule_component DROP CONSTRAINT ng3_sched_comp_fk;
ALTER TABLE ng3_schedule_component DROP CONSTRAINT ng3_sched_comp_sched_fk1;
ALTER TABLE ng3_schedule_component DROP CONSTRAINT ng3_sched_comp_sched_fk2;
ALTER TABLE ng3_solar_collector DROP CONSTRAINT ng3_sol_coll_fk;
ALTER TABLE ng3_solar_collector DROP CONSTRAINT ng3_sol_coll_oc_fk;
ALTER TABLE ng3_solar_collector DROP CONSTRAINT ng3_sol_coll_lod2_fk;
ALTER TABLE ng3_solar_collector DROP CONSTRAINT ng3_sol_coll_lod3_fk;
ALTER TABLE ng3_storage_device DROP CONSTRAINT ng3_sto_dev_fk;
ALTER TABLE ng3_storage_device DROP CONSTRAINT ng3_sto_dev_oc_fk;
ALTER TABLE ng3_suitability DROP CONSTRAINT ng3_suit_cto_fk;
ALTER TABLE ng3_suitability DROP CONSTRAINT ng3_suit_sched_fk;
ALTER TABLE ng3_them_surf_to_thermal_zone DROP CONSTRAINT ng3_thm_surf_to_tz_fk1;
ALTER TABLE ng3_them_surf_to_thermal_zone DROP CONSTRAINT ng3_thm_surf_to_tz_fk2;
ALTER TABLE ng3_thematic_surface DROP CONSTRAINT ng3_them_surf_fk;
ALTER TABLE ng3_time_series DROP CONSTRAINT ng3_ts_fk;
ALTER TABLE ng3_time_series DROP CONSTRAINT ng3_ts_oc_fk;
ALTER TABLE ng3_urban_function_area DROP CONSTRAINT ng3_ufa_fk;
ALTER TABLE ng3_utl_ntw_connection DROP CONSTRAINT ng3_utl_ntw_con_cto_fk;
ALTER TABLE ng3_utl_ntw_connection DROP CONSTRAINT ng3_utl_ntw_con_fk;
ALTER TABLE ng3_weather_data DROP CONSTRAINT ng3_wth_data_fk;
ALTER TABLE ng3_weather_data DROP CONSTRAINT ng3_wth_data_ng3_cto_fk;
ALTER TABLE ng3_weather_data DROP CONSTRAINT ng3_wth_data_ts_fk;
--ALTER TABLE ng3_address_to_building_unit DROP CONSTRAINT ng3_addr_to_bdgu_fk1;
--ALTER TABLE ng3_address_to_building_unit DROP CONSTRAINT ng3_addr_to_bdgu_fk2;
--ALTER TABLE ng3_building DROP CONSTRAINT ng3_bdg_fk;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_bdg_fk;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_fk;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_lod1_fk;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_lod2_fk;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_lod3_fk;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_oc_fk;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_sched_fk1;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_sched_fk2;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_sched_fk3;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_tz_fk;
--ALTER TABLE ng3_building_partition DROP CONSTRAINT ng3_bdgp_uz_fk;
--ALTER TABLE ng3_cityobject DROP CONSTRAINT ng3_cto_fk;
--ALTER TABLE ng3_cityobject DROP CONSTRAINT ng3_cto_lcns_fk;
--ALTER TABLE ng3_ctyobj_relation DROP CONSTRAINT ng3_cto_rel_fk1;
--ALTER TABLE ng3_ctyobj_relation DROP CONSTRAINT ng3_cto_rel_fk2;
--ALTER TABLE ng3_device DROP CONSTRAINT ng3_dev_fk;
--ALTER TABLE ng3_device DROP CONSTRAINT ng3_dev_ng3_cto_fk;
--ALTER TABLE ng3_device DROP CONSTRAINT ng3_dev_oc_fk;
--ALTER TABLE ng3_device DROP CONSTRAINT ng3_dev_opt_fk;
--ALTER TABLE ng3_device_operation DROP CONSTRAINT ng3_dev_opr_fk;
--ALTER TABLE ng3_device_operation DROP CONSTRAINT ng3_dev_opr_dev_fk;
--ALTER TABLE ng3_device_operation DROP CONSTRAINT ng3_dev_opr_sched_fk;
--ALTER TABLE ng3_energy_perf_cert DROP CONSTRAINT ng3_epc_fk;
--ALTER TABLE ng3_energy_perf_cert DROP CONSTRAINT ng3_epc_bdg_fk;
--ALTER TABLE ng3_energy_perf_cert DROP CONSTRAINT ng3_epc_bdg_part_fk;
--ALTER TABLE ng3_layer DROP CONSTRAINT ng3_lyr_fk;
--ALTER TABLE ng3_layer DROP CONSTRAINT ng3_lyr_lcns_fk;
--ALTER TABLE ng3_layer DROP CONSTRAINT ng3_lyr_mat_fk;
--ALTER TABLE ng3_layered_construction DROP CONSTRAINT ng3_lcns_fk;
--ALTER TABLE ng3_layered_construction DROP CONSTRAINT ng3_lcns_lcns_fk;
--ALTER TABLE ng3_layered_construction DROP CONSTRAINT ng3_lcns_oc_fk;
--ALTER TABLE ng3_layered_construction DROP CONSTRAINT ng3_lcns_lib_fk;
--ALTER TABLE ng3_library DROP CONSTRAINT ng3_lib_fk;
--ALTER TABLE ng3_library DROP CONSTRAINT ng3_lib_oc_fk;
--ALTER TABLE ng3_material DROP CONSTRAINT ng3_mat_fk;
--ALTER TABLE ng3_material DROP CONSTRAINT ng3_mat_lib_fk;
--ALTER TABLE ng3_occupants DROP CONSTRAINT ng3_occ_fk;
--ALTER TABLE ng3_occupants DROP CONSTRAINT ng3_occ_ng3_bdgp_fk;
--ALTER TABLE ng3_occupants DROP CONSTRAINT ng3_occ_sched_fk;
--ALTER TABLE ng3_opening DROP CONSTRAINT ng3_opn_fk;
--ALTER TABLE ng3_optical_property DROP CONSTRAINT ng3_optpty_lcns_fk;
--ALTER TABLE ng3_optical_property DROP CONSTRAINT ng3_optpty_oc_fk;
--ALTER TABLE ng3_qualified_attribute DROP CONSTRAINT ng3_qatt_oc_fk;
--ALTER TABLE ng3_qualified_attribute DROP CONSTRAINT ng3_qatt_bdg_fk;
--ALTER TABLE ng3_qualified_attribute DROP CONSTRAINT ng3_qatt_bdg_part_fk;
--ALTER TABLE ng3_refurbishment_measure DROP CONSTRAINT ng3_refurb_fk;
--ALTER TABLE ng3_refurbishment_measure DROP CONSTRAINT ng3_refurb_bdg_fk;
--ALTER TABLE ng3_refurbishment_measure DROP CONSTRAINT ng3_refurb_bdg_part_fk;
--ALTER TABLE ng3_resource DROP CONSTRAINT ng3_res_fk;
--ALTER TABLE ng3_resource DROP CONSTRAINT ng3_res_oc_fk;
--ALTER TABLE ng3_resource DROP CONSTRAINT ng3_res_ts_fk;
--ALTER TABLE ng3_resource DROP CONSTRAINT ng3_res_cto_fk;
--ALTER TABLE ng3_schedule DROP CONSTRAINT ng3_sched_fk;
--ALTER TABLE ng3_schedule DROP CONSTRAINT ng3_sched_oc_fk;
--ALTER TABLE ng3_schedule DROP CONSTRAINT ng3_sched_ts_fk;
--ALTER TABLE ng3_schedule DROP CONSTRAINT ng3_sched_lib_fk;
--ALTER TABLE ng3_schedule_component DROP CONSTRAINT ng3_sched_comp_fk;
--ALTER TABLE ng3_schedule_component DROP CONSTRAINT ng3_sched_comp_sched_fk1;
--ALTER TABLE ng3_schedule_component DROP CONSTRAINT ng3_sched_comp_sched_fk2;
--ALTER TABLE ng3_solar_collector DROP CONSTRAINT ng3_sol_coll_fk;
--ALTER TABLE ng3_solar_collector DROP CONSTRAINT ng3_sol_coll_oc_fk;
--ALTER TABLE ng3_solar_collector DROP CONSTRAINT ng3_sol_coll_lod2_fk;
--ALTER TABLE ng3_solar_collector DROP CONSTRAINT ng3_sol_coll_lod3_fk;
--ALTER TABLE ng3_storage_device DROP CONSTRAINT ng3_sto_dev_fk;
--ALTER TABLE ng3_storage_device DROP CONSTRAINT ng3_sto_dev_oc_fk;
--ALTER TABLE ng3_suitability DROP CONSTRAINT ng3_suit_cto_fk;
--ALTER TABLE ng3_suitability DROP CONSTRAINT ng3_suit_sched_fk;
--ALTER TABLE ng3_them_surf_to_thermal_zone DROP CONSTRAINT ng3_thm_surf_to_tz_fk1;
--ALTER TABLE ng3_them_surf_to_thermal_zone DROP CONSTRAINT ng3_thm_surf_to_tz_fk2;
--ALTER TABLE ng3_thematic_surface DROP CONSTRAINT ng3_them_surf_fk;
--ALTER TABLE ng3_time_series DROP CONSTRAINT ng3_ts_fk;
--ALTER TABLE ng3_time_series DROP CONSTRAINT ng3_ts_oc_fk;
--ALTER TABLE ng3_urban_function_area DROP CONSTRAINT ng3_ufa_fk;
--ALTER TABLE ng3_utl_ntw_connection DROP CONSTRAINT ng3_utl_ntw_con_cto_fk;
--ALTER TABLE ng3_utl_ntw_connection DROP CONSTRAINT ng3_utl_ntw_con_fk;
--ALTER TABLE ng3_weather_data DROP CONSTRAINT ng3_wth_data_fk;
--ALTER TABLE ng3_weather_data DROP CONSTRAINT ng3_wth_data_ng3_cto_fk;
--ALTER TABLE ng3_weather_data DROP CONSTRAINT ng3_wth_data_ts_fk;
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- *********************************** Drop tables ***************************************
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DROP TABLE ng3_address_to_building_unit CASCADE;
DROP TABLE ng3_building CASCADE;
DROP TABLE ng3_building_partition CASCADE;
DROP TABLE ng3_space CASCADE;
DROP TABLE ng3_cityobject CASCADE;
DROP TABLE ng3_ctyobj_relation CASCADE;
DROP TABLE ng3_device CASCADE;
......@@ -133,13 +133,13 @@ DROP TABLE ng3_schedule_component CASCADE;
DROP TABLE ng3_solar_collector CASCADE;
DROP TABLE ng3_storage_device CASCADE;
DROP TABLE ng3_suitability CASCADE;
DROP TABLE ng3_them_surf_to_thermal_zone CASCADE;
DROP TABLE ng3_thematic_surface CASCADE;
DROP TABLE ng3_time_series CASCADE;
DROP TABLE ng3_urban_function_area CASCADE;
DROP TABLE ng3_utl_ntw_connection CASCADE;
DROP TABLE ng3_weather_data CASCADE;
DROP TABLE ng3_sensor_data CASCADE;
DROP TABLE ng3_zone_opening CASCADE;
DROP TABLE ng3_zone_thematic_surface CASCADE;
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- *********************************** Drop Sequences *************************************
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......
......@@ -10,7 +10,7 @@ import org.citydb.core.query.filter.projection.ProjectionFilter;
import org.citygml4j.ade.energy3.model.core.*;
import org.citygml4j.ade.energy3.model.module.EnergyADEModule;
import org.citygml4j.model.citygml.building.AbstractBuilding;
import org.sig3d.citygml.energyADE3beta7.ThermalStatusValueType;
import org.sig3d.citygml.energyADE3beta8.ThermalStatusValueType;
import java.sql.Connection;
import java.sql.PreparedStatement;
......
......@@ -25,7 +25,7 @@ public class CityObjectPropertiesExporter implements ADEExporter {
private final CityGMLExportHelper helper;
private final ExportManager manager;
private final Connection connection;
private WeatherDataExporter weatherDataExporter;
//private WeatherDataExporter weatherDataExporter;
private ResourceExporter resourceExporter;
private String module;
......@@ -41,7 +41,7 @@ public class CityObjectPropertiesExporter implements ADEExporter {
module = EnergyADEModule.v3_0.getNamespaceURI();
ps = connection.prepareStatement(select);
weatherDataExporter = manager.getExporter(WeatherDataExporter.class);
// weatherDataExporter = manager.getExporter(WeatherDataExporter.class);
resourceExporter = manager.getExporter(ResourceExporter.class);
}
......@@ -52,12 +52,12 @@ public class CityObjectPropertiesExporter implements ADEExporter {
Collection<AbstractCityObject> result = new ArrayList<>();
while (rs.next()) {
Object pointObj = rs.getObject(2);
if (projectionFilter.containsProperty("weatherData", module)) {
for (WeatherData weatherData : weatherDataExporter.doExport(objectId)) {
WeatherDataProperty property = new WeatherDataProperty(weatherData);
cityObject.addGenericApplicationPropertyOfCityObject(property);
}
}
// if (projectionFilter.containsProperty("weatherData", module)) {
// for (WeatherData weatherData : weatherDataExporter.doExport(objectId)) {
// WeatherDataProperty property = new WeatherDataProperty(weatherData);
// cityObject.addGenericApplicationPropertyOfCityObject(property);
// }
// }
if (projectionFilter.containsProperty("resource", module)) {
for (AbstractResource resource : resourceExporter.doExport(objectId)) {
......
......@@ -48,8 +48,8 @@ public class ExportManager implements ADEExportManager {
public void exportObject(ADEModelObject object, long objectId, AbstractObjectType<?> objectType, ProjectionFilter projectionFilter) throws CityGMLExportException, SQLException {
if (object instanceof WeatherStation)
getExporter(WeatherStationExporter.class).doExport((WeatherStation) object, objectId, objectType, projectionFilter);
else if (object instanceof WeatherData)
getExporter(WeatherDataExporter.class).doExport(objectId);
// else if (object instanceof WeatherData)
// getExporter(WeatherDataExporter.class).doExport(objectId);
else if (object instanceof UrbanFunctionArea)
getExporter(UrbanFunctionAreaExporter.class).doExport((UrbanFunctionArea) object, objectId, objectType, projectionFilter);
else if (object instanceof AbstractTimeSeries)
......@@ -96,8 +96,8 @@ public class ExportManager implements ADEExportManager {
exporter = new WeatherStationExporter(connection, helper, this);
else if (type == ResourceExporter.class)
exporter = new ResourceExporter(connection, helper, this);
else if (type == WeatherDataExporter.class)
exporter = new WeatherDataExporter(connection, helper, this);
// else if (type == WeatherDataExporter.class)
// exporter = new WeatherDataExporter(connection, helper, this);
else if (type == CityObjectPropertiesExporter.class)
exporter = new CityObjectPropertiesExporter(connection, helper, this);
else if (type == BuildingPropertiesExporter.class)
......
......@@ -10,7 +10,7 @@ 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.energyADE3beta7.ResourceStatusValueType;
import org.sig3d.citygml.energyADE3beta8.ResourceStatusValueType;
import java.sql.*;
import java.util.ArrayList;
......
package de.stuttgart.hft.ade.energy3.exporter;
import de.stuttgart.hft.ade.energy3.schema.ADETable;
import org.citydb.config.geometry.GeometryObject;
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.operation.exporter.database.content.GMLConverter;
import org.citydb.core.query.filter.projection.CombinedProjectionFilter;
import org.citydb.core.query.filter.projection.ProjectionFilter;
import org.citydb.sqlbuilder.expression.PlaceHolder;
import org.citydb.sqlbuilder.schema.Table;
import org.citydb.sqlbuilder.select.Select;
import org.citydb.sqlbuilder.select.operator.comparison.ComparisonFactory;
import org.citygml4j.ade.energy3.model.core.ReferencePointProperty;
import org.citygml4j.ade.energy3.model.core.WeatherData;
import org.citygml4j.ade.energy3.model.module.EnergyADEModule;
import org.citygml4j.ade.energy3.model.supportingClasses.AbstractTimeSeries;
import org.citygml4j.ade.energy3.model.supportingClasses.AbstractTimeSeriesProperty;
import org.citygml4j.model.gml.basicTypes.Code;
import org.citygml4j.model.gml.basicTypes.Measure;
import org.citygml4j.model.gml.geometry.primitives.Point;
import org.citygml4j.model.gml.geometry.primitives.PointProperty;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
public class WeatherDataExporter implements ADEExporter {
private final CityGMLExportHelper helper;
private final int objectClassId;
private PreparedStatement ps;
private TimeSeriesExporter timeSeriesExporter;
private GMLConverter gmlConverter;
private String module;
public WeatherDataExporter(Connection connection, CityGMLExportHelper helper, ExportManager manager) throws CityGMLExportException, SQLException {
this.helper = helper;
objectClassId = manager.getObjectMapper().getObjectClassId(WeatherData.class);
String tableName = manager.getSchemaMapper().getTableName(ADETable.WEATHER_DATA);
CombinedProjectionFilter projectionFilter = helper.getCombinedProjectionFilter(tableName);
module = EnergyADEModule.v3_0.getNamespaceURI();
Table table = new Table(helper.getTableNameWithSchema(tableName));
Select select = new Select().addProjection(
table.getColumn("id"),
table.getColumn("type"),
table.getColumn("type_codespace"),
table.getColumn("value_type"),
table.getColumn("value_type_codespace"),
table.getColumn("yearly_value"),
table.getColumn("yearly_value_uom"),
table.getColumn("library_code"),
table.getColumn("library_code_codespace"),
table.getColumn("time_series_id"),
table.getColumn("cityobject_id")
);
if (projectionFilter.containsProperty("position", module))
select.addProjection(table.getColumn("position"));
select.addSelection(ComparisonFactory.equalTo(table.getColumn("cityobject_id"), new PlaceHolder<>()));
ps = connection.prepareStatement(select.toString());
timeSeriesExporter = manager.getExporter(TimeSeriesExporter.class);
gmlConverter = helper.getGMLConverter();
}
public Collection<WeatherData> doExport(long parentId) throws CityGMLExportException, SQLException {
ps.setLong(1, parentId);
try (ResultSet rs = ps.executeQuery()) {
Collection<WeatherData> result = new ArrayList<>();
while (rs.next()) {
long weatherDataId = rs.getLong(1);
WeatherData weatherData = helper.createObject(weatherDataId, objectClassId, WeatherData.class);
if (weatherData == null) {
helper.logOrThrowErrorMessage("Failed to instantiate " + helper.getObjectSignature(objectClassId, weatherDataId) + " as weather data object.");
continue;
}
ObjectType objectType = helper.getObjectType(objectClassId);
ProjectionFilter projectionFilter = helper.getProjectionFilter(objectType);
weatherData.setId(String.valueOf(weatherDataId));
// Set type
String typeValue = rs.getString(2);
String typeCodeSpace = rs.getString(3);
if (typeValue != null || typeCodeSpace != null) {
Code type = new Code();
type.setValue(typeValue);
type.setCodeSpace(typeCodeSpace);
type.setParent(weatherData);
weatherData.setType(type);
}
// Set value type
String valueTypeValue = rs.getString(4);
String valueTypeCodeSpace = rs.getString(5);
if (valueTypeValue != null || valueTypeCodeSpace != null) {
Code valueType = new Code();
valueType.setValue(valueTypeValue);
valueType.setCodeSpace(valueTypeCodeSpace);
valueType.setParent(weatherData);
weatherData.setValueType(valueType);
}
// Set yearly value and UOM
double yearlyValue = rs.getDouble(6);
if (!rs.wasNull()) {
Measure yearlyMeasure = new Measure();
yearlyMeasure.setValue(yearlyValue);
String yearlyValueUom = rs.getString(7);
if (yearlyValueUom != null) {
yearlyMeasure.setUom(yearlyValueUom);
}
yearlyMeasure.setParent(weatherData);
weatherData.setYearlyValue(yearlyMeasure);
}
// Set library code
String libraryCodeValue = rs.getString(8);
String libraryCodeSpace = rs.getString(9);
if (libraryCodeValue != null || libraryCodeSpace != null) {
Code libraryCode = new Code();
libraryCode.setValue(libraryCodeValue);
libraryCode.setCodeSpace(libraryCodeSpace);
libraryCode.setParent(weatherData);
weatherData.setLibraryCode(libraryCode);
}
// Set time series
long timeSeriesId = rs.getLong(10);
if (!rs.wasNull()) {
Collection<AbstractTimeSeries> timeSeries = timeSeriesExporter.doExport(timeSeriesId);
if (timeSeries != null && !timeSeries.isEmpty()) {
AbstractTimeSeries firstSeries = timeSeries.iterator().next();
weatherData.setTimeDependentValues(new AbstractTimeSeriesProperty(firstSeries));
}
}
// Set position (if requested)
if (projectionFilter.containsProperty("position", module)) {
Object pointObj = rs.getObject("position");
if (pointObj != null) {
try {
GeometryObject point = helper.getDatabaseAdapter().getGeometryConverter().getPoint(pointObj);
if (point != null) {
Point gmlPoint = gmlConverter.getPoint(point);
PointProperty pointProperty = new PointProperty(gmlPoint);
ReferencePointProperty refPointProp = new ReferencePointProperty(pointProperty);
weatherData.setPosition(refPointProp);
}
} catch (Exception e) {
// Skip invalid geometry to continue export
}
}
}
result.add(weatherData);
}
return result;
}
}
@Override
public void close() throws CityGMLExportException, SQLException {
ps.close();
}
}
\ No newline at end of file
//package de.stuttgart.hft.ade.energy3.exporter;
//
//import de.stuttgart.hft.ade.energy3.schema.ADETable;
//import org.citydb.config.geometry.GeometryObject;
//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.operation.exporter.database.content.GMLConverter;
//import org.citydb.core.query.filter.projection.CombinedProjectionFilter;
//import org.citydb.core.query.filter.projection.ProjectionFilter;
//import org.citydb.sqlbuilder.expression.PlaceHolder;
//import org.citydb.sqlbuilder.schema.Table;
//import org.citydb.sqlbuilder.select.Select;
//import org.citydb.sqlbuilder.select.operator.comparison.ComparisonFactory;
//import org.citygml4j.ade.energy3.model.core.ReferencePointProperty;
//import org.citygml4j.ade.energy3.model.core.WeatherData;
//import org.citygml4j.ade.energy3.model.module.EnergyADEModule;
//import org.citygml4j.ade.energy3.model.supportingClasses.AbstractTimeSeries;
//import org.citygml4j.ade.energy3.model.supportingClasses.AbstractTimeSeriesProperty;
//import org.citygml4j.model.gml.basicTypes.Code;
//import org.citygml4j.model.gml.basicTypes.Measure;
//import org.citygml4j.model.gml.geometry.primitives.Point;
//import org.citygml4j.model.gml.geometry.primitives.PointProperty;
//
//import java.sql.Connection;
//import java.sql.PreparedStatement;
//import java.sql.ResultSet;
//import java.sql.SQLException;
//import java.util.ArrayList;
//import java.util.Collection;
//
//public class WeatherDataExporter implements ADEExporter {
//
// private final CityGMLExportHelper helper;
// private final int objectClassId;
//
// private PreparedStatement ps;
// private TimeSeriesExporter timeSeriesExporter;
// private GMLConverter gmlConverter;
// private String module;
//
// public WeatherDataExporter(Connection connection, CityGMLExportHelper helper, ExportManager manager) throws CityGMLExportException, SQLException {
// this.helper = helper;
// objectClassId = manager.getObjectMapper().getObjectClassId(WeatherData.class);
//
// //String tableName = manager.getSchemaMapper().getTableName(ADETable.WEATHER_DATA);
//// CombinedProjectionFilter projectionFilter = helper.getCombinedProjectionFilter(tableName);
//// module = EnergyADEModule.v3_0.getNamespaceURI();
////
//// Table table = new Table(helper.getTableNameWithSchema(tableName));
//
// Select select = new Select().addProjection(
// table.getColumn("id"),
// table.getColumn("type"),
// table.getColumn("type_codespace"),
// table.getColumn("value_type"),
// table.getColumn("value_type_codespace"),
// table.getColumn("yearly_value"),
// table.getColumn("yearly_value_uom"),
// table.getColumn("library_code"),
// table.getColumn("library_code_codespace"),
// table.getColumn("time_series_id"),
// table.getColumn("cityobject_id")
// );
//
// if (projectionFilter.containsProperty("position", module))
// select.addProjection(table.getColumn("position"));
//
// select.addSelection(ComparisonFactory.equalTo(table.getColumn("cityobject_id"), new PlaceHolder<>()));
//
// ps = connection.prepareStatement(select.toString());
//
// timeSeriesExporter = manager.getExporter(TimeSeriesExporter.class);
// gmlConverter = helper.getGMLConverter();
// }
//
// public Collection<WeatherData> doExport(long parentId) throws CityGMLExportException, SQLException {
// ps.setLong(1, parentId);
//
// try (ResultSet rs = ps.executeQuery()) {
// Collection<WeatherData> result = new ArrayList<>();
//
// while (rs.next()) {
// long weatherDataId = rs.getLong(1);
//
// WeatherData weatherData = helper.createObject(weatherDataId, objectClassId, WeatherData.class);
// if (weatherData == null) {
// helper.logOrThrowErrorMessage("Failed to instantiate " + helper.getObjectSignature(objectClassId, weatherDataId) + " as weather data object.");
// continue;
// }
//
// ObjectType objectType = helper.getObjectType(objectClassId);
// ProjectionFilter projectionFilter = helper.getProjectionFilter(objectType);
//
// weatherData.setId(String.valueOf(weatherDataId));
//
// // Set type
// String typeValue = rs.getString(2);
// String typeCodeSpace = rs.getString(3);
// if (typeValue != null || typeCodeSpace != null) {
// Code type = new Code();
// type.setValue(typeValue);
// type.setCodeSpace(typeCodeSpace);
// type.setParent(weatherData);
// weatherData.setType(type);
// }
//
// // Set value type
// String valueTypeValue = rs.getString(4);
// String valueTypeCodeSpace = rs.getString(5);
// if (valueTypeValue != null || valueTypeCodeSpace != null) {
// Code valueType = new Code();
// valueType.setValue(valueTypeValue);
// valueType.setCodeSpace(valueTypeCodeSpace);
// valueType.setParent(weatherData);
// weatherData.setValueType(valueType);
// }
//
// // Set yearly value and UOM
// double yearlyValue = rs.getDouble(6);
// if (!rs.wasNull()) {
// Measure yearlyMeasure = new Measure();
// yearlyMeasure.setValue(yearlyValue);
// String yearlyValueUom = rs.getString(7);
// if (yearlyValueUom != null) {
// yearlyMeasure.setUom(yearlyValueUom);
// }
// yearlyMeasure.setParent(weatherData);
// weatherData.setYearlyValue(yearlyMeasure);
// }
//
// // Set library code
// String libraryCodeValue = rs.getString(8);
// String libraryCodeSpace = rs.getString(9);
// if (libraryCodeValue != null || libraryCodeSpace != null) {
// Code libraryCode = new Code();
// libraryCode.setValue(libraryCodeValue);
// libraryCode.setCodeSpace(libraryCodeSpace);
// libraryCode.setParent(weatherData);
// weatherData.setLibraryCode(libraryCode);
// }
//
// // Set time series
// long timeSeriesId = rs.getLong(10);
// if (!rs.wasNull()) {
// Collection<AbstractTimeSeries> timeSeries = timeSeriesExporter.doExport(timeSeriesId);
// if (timeSeries != null && !timeSeries.isEmpty()) {
// AbstractTimeSeries firstSeries = timeSeries.iterator().next();
// weatherData.setTimeDependentValues(new AbstractTimeSeriesProperty(firstSeries));
// }
// }
//
// // Set position (if requested)
// if (projectionFilter.containsProperty("position", module)) {
// Object pointObj = rs.getObject("position");
// if (pointObj != null) {
// try {
// GeometryObject point = helper.getDatabaseAdapter().getGeometryConverter().getPoint(pointObj);
// if (point != null) {
// Point gmlPoint = gmlConverter.getPoint(point);
// PointProperty pointProperty = new PointProperty(gmlPoint);
// ReferencePointProperty refPointProp = new ReferencePointProperty(pointProperty);
// weatherData.setPosition(refPointProp);
// }
// } catch (Exception e) {
// // Skip invalid geometry to continue export
// }
// }
// }
//
// result.add(weatherData);
// }
//
// return result;
// }
// }
//
// @Override
// public void close() throws CityGMLExportException, SQLException {
// ps.close();
// }
//}
\ No newline at end of file
......@@ -25,7 +25,7 @@ public class WeatherStationExporter implements ADEExporter {
private PreparedStatement ps;
private TimeSeriesExporter timeSeriesExporter;
private WeatherDataExporter weatherDataExporter;
//private WeatherDataExporter weatherDataExporter;
private GMLConverter gmlConverter;
private String module;
......@@ -42,7 +42,7 @@ public class WeatherStationExporter implements ADEExporter {
ps = connection.prepareStatement(select.toString());
timeSeriesExporter = manager.getExporter(TimeSeriesExporter.class);
weatherDataExporter = manager.getExporter(WeatherDataExporter.class);
//weatherDataExporter = manager.getExporter(WeatherDataExporter.class);
gmlConverter = helper.getGMLConverter();
}
......
......@@ -10,10 +10,10 @@ import org.citydb.core.database.schema.mapping.SchemaMapping;
import org.citydb.core.operation.importer.CityGMLImportException;
import org.citydb.core.operation.importer.util.GeometryConverter;
import org.citydb.core.registry.ObjectRegistry;
import org.sig3d.citygml.energyADE3beta7.AbstractQualifiedAttributeType;
import org.sig3d.citygml.energyADE3beta7.QualifiedAreaType;
import org.sig3d.citygml.energyADE3beta7.QualifiedHeightType;
import org.sig3d.citygml.energyADE3beta7.QualifiedVolumeType;
import org.sig3d.citygml.energyADE3beta8.AbstractQualifiedAttributeType;
import org.sig3d.citygml.energyADE3beta8.QualifiedAreaType;
import org.sig3d.citygml.energyADE3beta8.QualifiedHeightType;
import org.sig3d.citygml.energyADE3beta8.QualifiedVolumeType;
import java.sql.Connection;
import java.sql.PreparedStatement;
......
......@@ -11,9 +11,9 @@ import org.citydb.core.operation.importer.CityGMLImportException;
import org.citydb.core.operation.importer.util.GeometryConverter;
import org.citygml4j.ade.energy3.model.core.*;
import org.citygml4j.model.citygml.building.AbstractBuilding;
import org.sig3d.citygml.energyADE3beta7.QualifiedAreaType;
import org.sig3d.citygml.energyADE3beta7.QualifiedHeightType;
import org.sig3d.citygml.energyADE3beta7.QualifiedVolumeType;
import org.sig3d.citygml.energyADE3beta8.QualifiedAreaType;
import org.sig3d.citygml.energyADE3beta8.QualifiedHeightType;
import org.sig3d.citygml.energyADE3beta8.QualifiedVolumeType;
import java.sql.Connection;
import java.sql.PreparedStatement;
......
......@@ -31,10 +31,10 @@ public class WeatherDataImporter implements ADEImporter {
this.connection = connection;
this.helper = helper;
ps = connection.prepareStatement("insert into " +
helper.getTableNameWithSchema(manager.getSchemaMapper().getTableName(ADETable.WEATHER_DATA)) + " " +
"(id, type, type_codespace, value_type, value_type_codespace, yearly_value, yearly_value_uom, library_code, library_code_codespace, time_series_id, cityObject_id, position) " +
"values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
// ps = connection.prepareStatement("insert into " +
// helper.getTableNameWithSchema(manager.getSchemaMapper().getTableName(ADETable.WEATHER_DATA)) + " " +
// "(id, type, type_codespace, value_type, value_type_codespace, yearly_value, yearly_value_uom, library_code, library_code_codespace, time_series_id, cityObject_id, position) " +
// "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
geometryConverter = helper.getGeometryConverter();
}
......
......@@ -6,7 +6,7 @@ import org.citydb.core.ade.importer.ADEImporter;
public enum ADETable {
ADDRESS_TO_BUILDING_UNIT(null),
BUILDING(BuildingPropertiesImporter.class),
BUILDING_PARTITION(null),
//BUILDING_PARTITION(null),
CITYOBJECT(CityObjectPropertiesImporter.class),
CTYOBJ_RELATION(null),
DEVICE(AbstractDeviceImporter.class),
......@@ -15,9 +15,9 @@ public enum ADETable {
//FACILITIES(null),
//HEAT_EXCHANGE_TYPE(null),
//IMAGE_TEXTURE(null),
LAYER(null),
LAYERED_CONSTRUCTION(null),
//LAYER_COMPONENT(null),
LAYER(null),
LIBRARY(null),
MATERIAL(null),
OCCUPANTS(null),
......@@ -25,12 +25,14 @@ public enum ADETable {
OPTICAL_PROPERTY(null),
//PERIOD_OF_YEAR(null),
QUALIFIED_ATTRIBUTE(AbstractQualifiedAttributeImporter.class),
RESOURCE(ResourceImporter.class),
REFURBISHMENT_MEASURE(RefurbishmentMeasureImporter.class),
RESOURCE(ResourceImporter.class),
SCHEDULE(null),
SCHEDULE_COMPONENT(null),
SENSOR_DATA (null),
//SYSTEM_OPERATION(null),
SOLAR_COLLECTOR(null),
SPACE(null),
//STORAGE_SYSTEM(null),
STORAGE_DEVICE(null),
//SENSOR_CONNECTION(null),
......@@ -38,14 +40,16 @@ public enum ADETable {
SUITABILITY(null),
//THERMAL_BOUNDARY(null),
//THERMAL_OPENING(null),
THEM_SURF_TO_THERMAL_ZONE(null),
//THEM_SURF_TO_THERMAL_ZONE(null),
THEMATIC_SURFACE(null),
//THERMAL_ZONE(null),
TIME_SERIES(TimeSeriesImporter.class),
URBAN_FUNCTION_AREA(UrbanFunctionAreaImporter.class),
//USAGE_ZONE(null),
UTL_NTW_CONNECTION(UtilityNetworkConnectionImporter.class),
WEATHER_DATA(WeatherDataImporter.class);
//WEATHER_DATA(WeatherDataImporter.class);
ZONE_OPENING(null),
ZONE_THEMATIC_SURFACE(null);
private Class<? extends ADEImporter> importerClass;
......
Supports Markdown
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