diff --git a/impexp-client/src/main/java/org/citydb/cli/ExportCommand.java b/impexp-client/src/main/java/org/citydb/cli/ExportCommand.java index 8323a137e..19456cf7c 100644 --- a/impexp-client/src/main/java/org/citydb/cli/ExportCommand.java +++ b/impexp-client/src/main/java/org/citydb/cli/ExportCommand.java @@ -108,7 +108,7 @@ public Integer call() throws Exception { } private void setExportOptions(ExportConfig exportConfig) { - exportConfig.getCityGMLOptions().setFileEncoding(encoding); + exportConfig.getGeneralOptions().setFileEncoding(encoding); if (queryOption != null) { exportConfig.getAppearances().setExportAppearances(queryOption.isExportAppearances()); diff --git a/impexp-client/src/main/java/org/citydb/cli/ImportCommand.java b/impexp-client/src/main/java/org/citydb/cli/ImportCommand.java index d9902ceca..7e9331b7d 100644 --- a/impexp-client/src/main/java/org/citydb/cli/ImportCommand.java +++ b/impexp-client/src/main/java/org/citydb/cli/ImportCommand.java @@ -31,6 +31,10 @@ public class ImportCommand extends CliCommand { description = "Files or directories to import (glob patterns allowed).") private String[] files; + @CommandLine.Option(names = "--input-encoding", + description = "Encoding of the input file(s).") + private String encoding; + @CommandLine.Option(names = "--import-log", paramLabel = "", description = "Record imported top-level features to this file.") private Path importLogFile; @@ -97,6 +101,8 @@ public Integer call() throws Exception { } private void setImportOptions(ImportConfig importConfig) { + importConfig.getGeneralOptions().setFileEncoding(encoding); + if (importLogFile != null) { importConfig.getImportLog().setLogFile(importLogFile.toAbsolutePath().toString()); importConfig.getImportLog().setLogImportedFeatures(true); diff --git a/impexp-client/src/main/java/org/citydb/cli/options/deleter/DeleteListOption.java b/impexp-client/src/main/java/org/citydb/cli/options/deleter/DeleteListOption.java index e4b16fd0d..28cb8c963 100644 --- a/impexp-client/src/main/java/org/citydb/cli/options/deleter/DeleteListOption.java +++ b/impexp-client/src/main/java/org/citydb/cli/options/deleter/DeleteListOption.java @@ -37,7 +37,7 @@ import java.nio.file.Path; public class DeleteListOption implements CliOption { - enum Type {gml, db} + enum Type {resource, db} @CommandLine.Option(names = {"-f", "--delete-list"}, required = true, description = "Name of the CSV file containing the delete list.") @@ -55,7 +55,7 @@ enum Type {gml, db} description = "Index of the id column (default: 1).") private Integer index; - @CommandLine.Option(names = {"-C", "--id-column-type"}, paramLabel = "", defaultValue = "gml", + @CommandLine.Option(names = {"-C", "--id-column-type"}, paramLabel = "", defaultValue = "resource", description = "Type of id column value: ${COMPLETION-CANDIDATES} (default: ${DEFAULT-VALUE}).") private Type type; @@ -77,7 +77,7 @@ enum Type {gml, db} public DeleteListParser toDeleteListParser() { DeleteListParser parser = new DeleteListParser(file) - .withIdType(type == Type.db ? DeleteListParser.IdType.DATABASE_ID : DeleteListParser.IdType.GML_ID) + .withIdType(type == Type.db ? DeleteListParser.IdType.DATABASE_ID : DeleteListParser.IdType.RESOURCE_ID) .withHeader(header) .withDelimiter(delimiter) .withQuoteChar(quote.charAt(0)) diff --git a/impexp-client/src/main/java/org/citydb/cli/options/importer/FilterOption.java b/impexp-client/src/main/java/org/citydb/cli/options/importer/FilterOption.java index 877b78f95..eedc23318 100644 --- a/impexp-client/src/main/java/org/citydb/cli/options/importer/FilterOption.java +++ b/impexp-client/src/main/java/org/citydb/cli/options/importer/FilterOption.java @@ -65,7 +65,7 @@ public ImportFilter toImportFilter() { if (idOption != null) { SimpleAttributeFilter attributeFilter = new SimpleAttributeFilter(); - attributeFilter.setGmlIdFilter(idOption.toResourceIdOperator()); + attributeFilter.setResourceIdFilter(idOption.toResourceIdOperator()); importFilter.setAttributeFilter(attributeFilter); importFilter.setUseAttributeFilter(true); } diff --git a/impexp-client/src/main/java/org/citydb/cli/options/vis/QueryOption.java b/impexp-client/src/main/java/org/citydb/cli/options/vis/QueryOption.java index 4ddb01c55..7fd7dfa5b 100644 --- a/impexp-client/src/main/java/org/citydb/cli/options/vis/QueryOption.java +++ b/impexp-client/src/main/java/org/citydb/cli/options/vis/QueryOption.java @@ -59,8 +59,8 @@ public SimpleKmlQuery toSimpleKmlQuery() { if (resourceIdOption != null) { ResourceIdOperator idOperator = resourceIdOption.toResourceIdOperator(); if (idOperator != null) { - query.setUseGmlIdFilter(true); - query.setGmlIdFilter(idOperator); + query.setUseResourceIdFilter(true); + query.setResourceIdFilter(idOperator); } } diff --git a/impexp-client/src/main/java/org/citydb/gui/components/dialog/ConfirmationCheckDialog.java b/impexp-client/src/main/java/org/citydb/gui/components/dialog/ConfirmationCheckDialog.java index 05840c63c..01f5c8f3d 100644 --- a/impexp-client/src/main/java/org/citydb/gui/components/dialog/ConfirmationCheckDialog.java +++ b/impexp-client/src/main/java/org/citydb/gui/components/dialog/ConfirmationCheckDialog.java @@ -1,59 +1,62 @@ package org.citydb.gui.components.dialog; import org.citydb.config.i18n.Language; -import org.citydb.gui.util.GuiUtil; import javax.swing.*; import java.awt.*; +import java.util.ArrayList; +import java.util.List; public class ConfirmationCheckDialog { - private final Component parent; - private final String title; - private final int optionType; - private final int messageType; + private final List messages; + private final JCheckBox disableDialog; - private JPanel content; - private JCheckBox disableDialog; + private Component parent; + private int messageType; + private int optionType; + private String title; - public ConfirmationCheckDialog(Component parent, String title, Component message, int optionType, int messageType) { - this.parent = parent; - this.title = title; - this.optionType = optionType; - this.messageType = messageType; - - initGui(message); + private ConfirmationCheckDialog() { + messages = new ArrayList<>(); + disableDialog = new JCheckBox(Language.I18N.getString("common.dialog.msg.noShow")); } - public ConfirmationCheckDialog(Component parent, String title, Component message, int optionType) { - this(parent, title, message, optionType, JOptionPane.QUESTION_MESSAGE); + public static ConfirmationCheckDialog defaults() { + ConfirmationCheckDialog dialog = new ConfirmationCheckDialog(); + dialog.messageType = JOptionPane.QUESTION_MESSAGE; + dialog.optionType = JOptionPane.YES_NO_CANCEL_OPTION; + return dialog; } - public ConfirmationCheckDialog(Component parent, String title, Component message) { - this(parent, title, message, JOptionPane.YES_NO_CANCEL_OPTION); + public ConfirmationCheckDialog withParentComponent(Component parent) { + this.parent = parent; + return this; } - public ConfirmationCheckDialog(Component parent, String title, String message, int optionType, int messageType) { - this(parent, title, new JLabel(message), optionType, messageType); + public ConfirmationCheckDialog withMessageType(int messageType) { + this.messageType = messageType; + return this; } - public ConfirmationCheckDialog(Component parent, String title, String message, int optionType) { - this(parent, title, message, optionType, JOptionPane.QUESTION_MESSAGE); + public ConfirmationCheckDialog withOptionType(int optionType) { + this.optionType = optionType; + return this; } - public ConfirmationCheckDialog(Component parent, String title, String message) { - this(parent, title, message, JOptionPane.YES_NO_CANCEL_OPTION); + public ConfirmationCheckDialog withTitle(String title) { + this.title = title; + return this; } - private void initGui(Component message) { - content = new JPanel(new GridBagLayout()); - disableDialog = new JCheckBox(Language.I18N.getString("common.dialog.msg.noShow")); - - content.add(message, GuiUtil.setConstraints(0, 0, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); - content.add(disableDialog, GuiUtil.setConstraints(0, 1, 1, 0, GridBagConstraints.BOTH, 10, 0, 0, 0)); + public ConfirmationCheckDialog addMessage(Object message) { + messages.add(message); + return this; } public int show() { - return JOptionPane.showConfirmDialog(parent, content, title, optionType, messageType); + messages.add("\n"); + messages.add(disableDialog); + return JOptionPane.showConfirmDialog(parent, messages.toArray(), title, optionType, messageType); } public boolean keepShowingDialog() { diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/common/XSLTransformationPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/common/XSLTransformationPanel.java index 955711f20..e66ab27fe 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/common/XSLTransformationPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/common/XSLTransformationPanel.java @@ -73,8 +73,9 @@ public XSLTransformationPanel(boolean isExport, Config config) { @Override public boolean isModified() { - XSLTransformation transformation = isExport ? config.getExportConfig().getXSLTransformation() : - config.getImportConfig().getXSLTransformation(); + XSLTransformation transformation = isExport ? + config.getExportConfig().getCityGMLOptions().getXSLTransformation() : + config.getImportConfig().getCityGMLOptions().getXSLTransformation(); if (transformation.isEnabled() != applyStylesheets.isSelected()) return true; if (!transformation.isSetStylesheets() && !first.stylesheet.getText().trim().isEmpty()) return true; @@ -114,8 +115,8 @@ private void initGui() { @Override public void setSettings() { XSLTransformation transformation = isExport ? - config.getExportConfig().getXSLTransformation() : - config.getImportConfig().getXSLTransformation(); + config.getExportConfig().getCityGMLOptions().getXSLTransformation() : + config.getImportConfig().getCityGMLOptions().getXSLTransformation(); transformation.setEnabled(applyStylesheets.isSelected()); @@ -158,8 +159,8 @@ public void setSettings() { @Override public void loadSettings() { XSLTransformation transformation = isExport ? - config.getExportConfig().getXSLTransformation() : - config.getImportConfig().getXSLTransformation(); + config.getExportConfig().getCityGMLOptions().getXSLTransformation() : + config.getImportConfig().getCityGMLOptions().getXSLTransformation(); applyStylesheets.setSelected(transformation.isEnabled()); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/common/filter/AttributeFilterView.java b/impexp-client/src/main/java/org/citydb/gui/modules/common/filter/AttributeFilterView.java index d10000b00..ace622023 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/common/filter/AttributeFilterView.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/common/filter/AttributeFilterView.java @@ -43,10 +43,10 @@ public class AttributeFilterView extends FilterView { private JPanel component; - private JLabel gmlIdLabel; - private JTextField gmlIdText; - private JLabel gmlNameLabel; - private JTextField gmlNameText; + private JLabel resourceIdLabel; + private JTextField resourceIdText; + private JLabel nameLabel; + private JTextField nameText; private JLabel lineageLabel; private JTextField lineageText; @@ -59,42 +59,42 @@ private void init() { component = new JPanel(); component.setLayout(new GridBagLayout()); - gmlIdLabel = new JLabel(); - gmlIdText = new JTextField(); - gmlNameLabel = new JLabel(); - gmlNameText = new JTextField(); + resourceIdLabel = new JLabel(); + resourceIdText = new JTextField(); + nameLabel = new JLabel(); + nameText = new JTextField(); lineageLabel = new JLabel(); lineageText = new JTextField(); - // gml:id filter - component.add(gmlIdLabel, GuiUtil.setConstraints(0, 0, 0, 0, GridBagConstraints.HORIZONTAL, 10, 0, 5, 5)); - component.add(gmlIdText, GuiUtil.setConstraints(1, 0, 1, 0, GridBagConstraints.HORIZONTAL, 10, 5, 5, 0)); + // resource id filter + component.add(resourceIdLabel, GuiUtil.setConstraints(0, 0, 0, 0, GridBagConstraints.HORIZONTAL, 10, 0, 5, 5)); + component.add(resourceIdText, GuiUtil.setConstraints(1, 0, 1, 0, GridBagConstraints.HORIZONTAL, 10, 5, 5, 0)); - // gml:name filter - component.add(gmlNameLabel, GuiUtil.setConstraints(0, 1, 0, 0, GridBagConstraints.HORIZONTAL, 0, 0, 5, 5)); - component.add(gmlNameText, GuiUtil.setConstraints(1, 1, 1, 0, GridBagConstraints.HORIZONTAL, 0, 5, 5, 0)); + // name filter + component.add(nameLabel, GuiUtil.setConstraints(0, 1, 0, 0, GridBagConstraints.HORIZONTAL, 0, 0, 5, 5)); + component.add(nameText, GuiUtil.setConstraints(1, 1, 1, 0, GridBagConstraints.HORIZONTAL, 0, 5, 5, 0)); // citydb:lineage filter component.add(lineageLabel, GuiUtil.setConstraints(0, 2, 0, 0, GridBagConstraints.HORIZONTAL, 0, 0, 0, 5)); component.add(lineageText, GuiUtil.setConstraints(1, 2, 1, 0, GridBagConstraints.HORIZONTAL, 0, 5, 0, 0)); - PopupMenuDecorator.getInstance().decorate(gmlNameText, gmlIdText, lineageText); + PopupMenuDecorator.getInstance().decorate(nameText, resourceIdText, lineageText); } @Override public void doTranslation() { - gmlIdLabel.setText(Language.I18N.getString("filter.label.gmlId")); - gmlNameLabel.setText(Language.I18N.getString("filter.label.gmlName")); + resourceIdLabel.setText(Language.I18N.getString("filter.label.id")); + nameLabel.setText(Language.I18N.getString("filter.label.name")); lineageLabel.setText(Language.I18N.getString("filter.label.lineage")); } @Override public void setEnabled(boolean enable) { - gmlIdLabel.setEnabled(enable); - gmlIdText.setEnabled(enable); - gmlNameLabel.setEnabled(enable); - gmlNameText.setEnabled(enable); + resourceIdLabel.setEnabled(enable); + resourceIdText.setEnabled(enable); + nameLabel.setEnabled(enable); + nameText.setEnabled(enable); lineageLabel.setEnabled(enable); lineageText.setEnabled(enable); } @@ -123,13 +123,13 @@ public Icon getIcon() { public void loadSettings() { SimpleQuery query = simpleQuerySupplier.get(); - // gml:id filter - ResourceIdOperator gmlIdFilter = query.getSelectionFilter().getGmlIdFilter(); - gmlIdText.setText(String.join(",", gmlIdFilter.getResourceIds())); + // resource id filter + ResourceIdOperator resourceIdFilter = query.getSelectionFilter().getResourceIdFilter(); + resourceIdText.setText(String.join(",", resourceIdFilter.getResourceIds())); - // gml:name - LikeOperator gmlNameFilter = query.getSelectionFilter().getGmlNameFilter(); - gmlNameText.setText(gmlNameFilter.getLiteral()); + // name + LikeOperator nameFilter = query.getSelectionFilter().getNameFilter(); + nameText.setText(nameFilter.getLiteral()); // citydb:lineage LikeOperator lineageFilter = query.getSelectionFilter().getLineageFilter(); @@ -140,19 +140,19 @@ public void loadSettings() { public void setSettings() { SimpleQuery query = simpleQuerySupplier.get(); - // gml:id filter - ResourceIdOperator gmlIdFilter = query.getSelectionFilter().getGmlIdFilter(); - gmlIdFilter.reset(); - if (!gmlIdText.getText().trim().isEmpty()) { - String trimmed = gmlIdText.getText().replaceAll("\\s+", ""); - gmlIdFilter.setResourceIds(Util.string2string(trimmed, ",")); + // resource id filter + ResourceIdOperator resourceIdFilter = query.getSelectionFilter().getResourceIdFilter(); + resourceIdFilter.reset(); + if (!resourceIdText.getText().trim().isEmpty()) { + String trimmed = resourceIdText.getText().replaceAll("\\s+", ""); + resourceIdFilter.setResourceIds(Util.string2string(trimmed, ",")); } - // gml:name - LikeOperator gmlNameFilter = query.getSelectionFilter().getGmlNameFilter(); - gmlNameFilter.reset(); - if (!gmlNameText.getText().trim().isEmpty()) - gmlNameFilter.setLiteral(gmlNameText.getText().trim()); + // name + LikeOperator nameFilter = query.getSelectionFilter().getNameFilter(); + nameFilter.reset(); + if (!nameText.getText().trim().isEmpty()) + nameFilter.setLiteral(nameText.getText().trim()); // citydb:lineage LikeOperator lineageFilter = query.getSelectionFilter().getLineageFilter(); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/common/filter/XMLQueryView.java b/impexp-client/src/main/java/org/citydb/gui/modules/common/filter/XMLQueryView.java index 8e5159fa8..e6a83a103 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/common/filter/XMLQueryView.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/common/filter/XMLQueryView.java @@ -254,11 +254,11 @@ else if (featureVersionFilter.isSetStartDate() SimpleSelectionFilter selectionFilter = simpleQuery.getSelectionFilter(); if (!selectionFilter.isUseSQLFilter()) { - if (selectionFilter.isSetGmlIdFilter() && selectionFilter.getGmlIdFilter().isSetResourceIds()) - predicates.add(selectionFilter.getGmlIdFilter()); + if (selectionFilter.isSetResourceIdFilter() && selectionFilter.getResourceIdFilter().isSetResourceIds()) + predicates.add(selectionFilter.getResourceIdFilter()); - if (selectionFilter.isSetGmlNameFilter() && selectionFilter.getGmlNameFilter().isSetLiteral()) { - LikeOperator nameFilter = selectionFilter.getGmlNameFilter(); + if (selectionFilter.isSetNameFilter() && selectionFilter.getNameFilter().isSetLiteral()) { + LikeOperator nameFilter = selectionFilter.getNameFilter(); nameFilter.setValueReference("gml:name"); predicates.add(nameFilter); } diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/database/operations/SrsOperation.java b/impexp-client/src/main/java/org/citydb/gui/modules/database/operations/SrsOperation.java index c64f36449..5a1cb7a55 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/database/operations/SrsOperation.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/database/operations/SrsOperation.java @@ -287,7 +287,6 @@ private void doOperation() { if (changeSrid && config.getGuiConfig().isShowChangeSridWarning()) { JPanel confirmPanel = new JPanel(new GridBagLayout()); - JLabel headerLabel = new JLabel(Language.I18N.getString("db.dialog.srs.changeSrid")); JLabel sridLabel = new JLabel(Language.I18N.getString("pref.db.srs.label.srid") + ":"); JLabel sridValue = new JLabel(String.valueOf(srs.getSrid())); JLabel geometriesLabel = new JLabel(Language.I18N.getString("db.label.operation.srs.geometries") + ":"); @@ -298,15 +297,16 @@ private void doOperation() { sridValue.setFont(sridValue.getFont().deriveFont(Font.BOLD)); geometriesValue.setFont(sridValue.getFont()); - confirmPanel.add(headerLabel, GuiUtil.setConstraints(0, 0, 2, 1, 1, 0, GridBagConstraints.HORIZONTAL, 0, 0, 0, 0)); - confirmPanel.add(sridLabel, GuiUtil.setConstraints(0, 1, 0, 0, GridBagConstraints.HORIZONTAL, 10, 0, 0, 0)); - confirmPanel.add(sridValue, GuiUtil.setConstraints(1, 1, 1, 0, GridBagConstraints.HORIZONTAL, 10, 5, 0, 0)); - confirmPanel.add(geometriesLabel, GuiUtil.setConstraints(0, 2, 0, 0, GridBagConstraints.HORIZONTAL, 5, 0, 0, 0)); - confirmPanel.add(geometriesValue, GuiUtil.setConstraints(1, 2, 1, 0, GridBagConstraints.HORIZONTAL, 5, 5, 0, 0)); + confirmPanel.add(sridLabel, GuiUtil.setConstraints(0, 0, 0, 0, GridBagConstraints.HORIZONTAL, 10, 0, 0, 0)); + confirmPanel.add(sridValue, GuiUtil.setConstraints(1, 0, 1, 0, GridBagConstraints.HORIZONTAL, 10, 5, 0, 0)); + confirmPanel.add(geometriesLabel, GuiUtil.setConstraints(0, 1, 0, 0, GridBagConstraints.HORIZONTAL, 5, 0, 0, 0)); + confirmPanel.add(geometriesValue, GuiUtil.setConstraints(1, 1, 1, 0, GridBagConstraints.HORIZONTAL, 5, 5, 0, 0)); - ConfirmationCheckDialog dialog = new ConfirmationCheckDialog(viewController.getTopFrame(), - Language.I18N.getString("db.dialog.srs.window"), - confirmPanel); + ConfirmationCheckDialog dialog = ConfirmationCheckDialog.defaults() + .withParentComponent(viewController.getTopFrame()) + .withTitle(Language.I18N.getString("db.dialog.srs.window")) + .addMessage(Language.I18N.getString("db.dialog.srs.changeSrid") + "\n") + .addMessage(confirmPanel); int result = dialog.show(); config.getGuiConfig().setShowChangeSridWarning(dialog.keepShowingDialog()); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/database/view/DatabasePanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/database/view/DatabasePanel.java index 6d131fb5b..22f8e77cd 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/database/view/DatabasePanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/database/view/DatabasePanel.java @@ -569,10 +569,11 @@ public boolean showWarning(DatabaseConnectionWarning warning) { } if (showWarning) { - ConfirmationCheckDialog dialog = new ConfirmationCheckDialog(viewController.getTopFrame(), - Language.I18N.getString("db.dialog.warn.title"), - warning.getFormattedMessage(), - JOptionPane.OK_CANCEL_OPTION); + ConfirmationCheckDialog dialog = ConfirmationCheckDialog.defaults() + .withParentComponent(viewController.getTopFrame()) + .withOptionType(JOptionPane.OK_CANCEL_OPTION) + .withTitle(Language.I18N.getString("db.dialog.warn.title")) + .addMessage(warning.getFormattedMessage()); option = dialog.show(); if (!dialog.keepShowingDialog()) { diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityGMLExportPreferences.java b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityGMLExportPreferences.java index 3174fb73c..e99abfe5a 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityGMLExportPreferences.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityGMLExportPreferences.java @@ -37,13 +37,19 @@ public class CityGMLExportPreferences extends AbstractPreferences { public CityGMLExportPreferences(Config config) { super(new CityGMLExportEntry()); - root.addChildEntry(new DefaultPreferencesEntry(new VersionPanel(config))); + root.addChildEntry(new DefaultPreferencesEntry(new GeneralPanel(config))); root.addChildEntry(new DefaultPreferencesEntry(new TilingOptionsPanel(config))); root.addChildEntry(new DefaultPreferencesEntry(new CityObjectGroupPanel(config))); root.addChildEntry(new DefaultPreferencesEntry(new AddressPanel(config))); root.addChildEntry(new DefaultPreferencesEntry(new AppearancePanel(config))); - root.addChildEntry(new DefaultPreferencesEntry(new XLinkPanel(config))); - root.addChildEntry(new DefaultPreferencesEntry(new XSLTransformationPanel(true, config))); + + DefaultPreferencesEntry cityGMLOptions = new CityGMLOptionsPanel(); + root.addChildEntry(cityGMLOptions); + cityGMLOptions.addChildEntry(new DefaultPreferencesEntry(new CityGMLGeneralPanel(config))); + cityGMLOptions.addChildEntry(new DefaultPreferencesEntry(new XLinkPanel(config))); + cityGMLOptions.addChildEntry(new DefaultPreferencesEntry(new XSLTransformationPanel(true, config))); + + root.addChildEntry(new DefaultPreferencesEntry(new CityJSONOptionsPanel(config))); root.addChildEntry(new DefaultPreferencesEntry(new ResourcesPanel(config))); } diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityGMLGeneralPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityGMLGeneralPanel.java new file mode 100644 index 000000000..b432c55b9 --- /dev/null +++ b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityGMLGeneralPanel.java @@ -0,0 +1,85 @@ +/* + * 3D City Database - The Open Source CityGML Database + * http://www.3dcitydb.org/ + * + * Copyright 2013 - 2020 + * Chair of Geoinformatics + * Technical University of Munich, Germany + * https://www.gis.bgu.tum.de/ + * + * The 3D City Database is jointly developed with the following + * cooperation partners: + * + * virtualcitySYSTEMS GmbH, Berlin + * M.O.S.S. Computer Grafik Systeme GmbH, Taufkirchen + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.citydb.gui.modules.exporter.preferences; + +import org.citydb.config.Config; +import org.citydb.config.i18n.Language; +import org.citydb.gui.components.common.TitledPanel; +import org.citydb.gui.modules.common.AbstractPreferencesComponent; +import org.citydb.gui.util.GuiUtil; + +import javax.swing.*; +import java.awt.*; + +public class CityGMLGeneralPanel extends AbstractPreferencesComponent { + private TitledPanel formatOptionsPanel; + private JCheckBox prettyPrint; + + public CityGMLGeneralPanel(Config config) { + super(config); + initGui(); + } + + @Override + public boolean isModified() { + if (prettyPrint.isSelected() != config.getExportConfig().getCityGMLOptions().isPrettyPrint()) return true; + return false; + } + + private void initGui() { + prettyPrint = new JCheckBox(); + + setLayout(new GridBagLayout()); + formatOptionsPanel = new TitledPanel() + .withToggleButton(prettyPrint) + .showSeparator(false) + .buildWithoutContent(); + + add(formatOptionsPanel, GuiUtil.setConstraints(0, 0, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); + } + + @Override + public void loadSettings() { + prettyPrint.setSelected(config.getExportConfig().getCityGMLOptions().isPrettyPrint()); + } + + @Override + public void setSettings() { + config.getExportConfig().getCityGMLOptions().setPrettyPrint(prettyPrint.isSelected()); + } + + @Override + public void doTranslation() { + formatOptionsPanel.setTitle(Language.I18N.getString("pref.export.common.label.prettyPrint")); + } + + @Override + public String getTitle() { + return Language.I18N.getString("pref.tree.export.cityGML.general"); + } +} diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityGMLOptionsPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityGMLOptionsPanel.java new file mode 100644 index 000000000..731098e19 --- /dev/null +++ b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityGMLOptionsPanel.java @@ -0,0 +1,17 @@ +package org.citydb.gui.modules.exporter.preferences; + +import org.citydb.config.i18n.Language; +import org.citydb.gui.modules.common.DefaultPreferencesEntry; +import org.citydb.gui.modules.common.NullComponent; + +public class CityGMLOptionsPanel extends DefaultPreferencesEntry { + + public CityGMLOptionsPanel() { + super(NullComponent.getInstance()); + } + + @Override + public String getLocalizedTitle() { + return Language.I18N.getString("pref.tree.export.cityGMLOptions"); + } +} diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityJSONOptionsPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityJSONOptionsPanel.java new file mode 100644 index 000000000..7b39b2f4f --- /dev/null +++ b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/CityJSONOptionsPanel.java @@ -0,0 +1,135 @@ +package org.citydb.gui.modules.exporter.preferences; + +import org.citydb.config.Config; +import org.citydb.config.i18n.Language; +import org.citydb.config.project.exporter.CityJSONOptions; +import org.citydb.gui.components.common.TitledPanel; +import org.citydb.gui.factory.PopupMenuDecorator; +import org.citydb.gui.modules.common.AbstractPreferencesComponent; +import org.citydb.gui.util.GuiUtil; + +import javax.swing.*; +import java.awt.*; + +public class CityJSONOptionsPanel extends AbstractPreferencesComponent { + private TitledPanel generalOptionsPanel; + private JCheckBox prettyPrint; + private JCheckBox useGeometryCompression; + private JCheckBox removeDuplicateChildGeometries; + private JCheckBox addSequenceIdWhenSorting; + + private TitledPanel precisionPanel; + private JLabel significantDigitsLabel; + private JLabel significantDigitsUnitLabel; + private JSpinner significantDigits; + private JLabel significantTextureDigitsLabel; + private JLabel significantTextureDigitsUnitLabel; + private JSpinner significantTextureDigits; + + protected CityJSONOptionsPanel(Config config) { + super(config); + initGui(); + } + + @Override + public boolean isModified() { + CityJSONOptions cityJSONOptions = config.getExportConfig().getCityJSONOptions(); + if (prettyPrint.isSelected() != cityJSONOptions.isPrettyPrint()) return true; + if (useGeometryCompression.isSelected() != cityJSONOptions.isUseGeometryCompression()) return true; + if (removeDuplicateChildGeometries.isSelected() != cityJSONOptions.isRemoveDuplicateChildGeometries()) return true; + if (addSequenceIdWhenSorting.isSelected() != cityJSONOptions.isAddSequenceIdWhenSorting()) return true; + if (((Number) significantDigits.getValue()).intValue() != cityJSONOptions.getSignificantDigits()) return true; + if (((Number) significantTextureDigits.getValue()).intValue() != cityJSONOptions.getSignificantTextureDigits()) return true; + return false; + } + + private void initGui() { + prettyPrint = new JCheckBox(); + useGeometryCompression = new JCheckBox(); + removeDuplicateChildGeometries = new JCheckBox(); + addSequenceIdWhenSorting = new JCheckBox(); + + significantDigitsLabel = new JLabel(); + significantDigitsUnitLabel = new JLabel(); + significantTextureDigitsLabel = new JLabel(); + significantTextureDigitsUnitLabel = new JLabel(); + significantDigits = new JSpinner(new SpinnerNumberModel(1, 1, 20, 1)); + significantTextureDigits = new JSpinner(new SpinnerNumberModel(1, 1, 20, 1)); + + PopupMenuDecorator.getInstance().decorate(significantDigits, significantTextureDigits, + ((JSpinner.DefaultEditor) significantDigits.getEditor()).getTextField(), + ((JSpinner.DefaultEditor) significantTextureDigits.getEditor()).getTextField()); + + setLayout(new GridBagLayout()); + { + JPanel content = new JPanel(); + content.setLayout(new GridBagLayout()); + { + content.add(prettyPrint, GuiUtil.setConstraints(0, 0, 1, 1, GridBagConstraints.BOTH, 0, 0, 5, 0)); + content.add(useGeometryCompression, GuiUtil.setConstraints(0, 1, 1, 1, GridBagConstraints.BOTH, 0, 0, 5, 0)); + content.add(removeDuplicateChildGeometries, GuiUtil.setConstraints(0, 2, 1, 1, GridBagConstraints.BOTH, 0, 0, 5, 0)); + content.add(addSequenceIdWhenSorting, GuiUtil.setConstraints(0, 3, 1, 1, GridBagConstraints.BOTH, 0, 0, 0, 0)); + } + + generalOptionsPanel = new TitledPanel().build(content); + } + { + JPanel content = new JPanel(); + content.setLayout(new GridBagLayout()); + { + content.add(significantDigitsLabel, GuiUtil.setConstraints(0, 0, 0, 0, GridBagConstraints.BOTH, 0, 0, 5, 5)); + content.add(significantDigits, GuiUtil.setConstraints(1, 0, 0, 0, GridBagConstraints.BOTH, 0, 5, 5, 5)); + content.add(significantDigitsUnitLabel, GuiUtil.setConstraints(2, 0, 1, 0, GridBagConstraints.BOTH, 0, 0, 5, 0)); + content.add(significantTextureDigitsLabel, GuiUtil.setConstraints(0, 1, 0, 0, GridBagConstraints.BOTH, 0, 0, 0, 5)); + content.add(significantTextureDigits, GuiUtil.setConstraints(1, 1, 0, 0, GridBagConstraints.BOTH, 0, 5, 0, 5)); + content.add(significantTextureDigitsUnitLabel, GuiUtil.setConstraints(2, 1, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); + } + + precisionPanel = new TitledPanel().build(content); + } + + add(generalOptionsPanel, GuiUtil.setConstraints(0, 0, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); + add(precisionPanel, GuiUtil.setConstraints(0, 1, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); + } + + @Override + public void setSettings() { + CityJSONOptions cityJSONOptions = config.getExportConfig().getCityJSONOptions(); + cityJSONOptions.setPrettyPrint(prettyPrint.isSelected()); + cityJSONOptions.setUseGeometryCompression(useGeometryCompression.isSelected()); + cityJSONOptions.setRemoveDuplicateChildGeometries(removeDuplicateChildGeometries.isSelected()); + cityJSONOptions.setAddSequenceIdWhenSorting(addSequenceIdWhenSorting.isSelected()); + cityJSONOptions.setSignificantDigits(((Number) significantDigits.getValue()).intValue()); + cityJSONOptions.setSignificantTextureDigits(((Number) significantTextureDigits.getValue()).intValue()); + } + + @Override + public void loadSettings() { + CityJSONOptions cityJSONOptions = config.getExportConfig().getCityJSONOptions(); + prettyPrint.setSelected(cityJSONOptions.isPrettyPrint()); + useGeometryCompression.setSelected(cityJSONOptions.isUseGeometryCompression()); + removeDuplicateChildGeometries.setSelected(cityJSONOptions.isRemoveDuplicateChildGeometries()); + addSequenceIdWhenSorting.setSelected(cityJSONOptions.isAddSequenceIdWhenSorting()); + significantDigits.setValue(cityJSONOptions.getSignificantDigits()); + significantTextureDigits.setValue(cityJSONOptions.getSignificantTextureDigits()); + } + + @Override + public void doTranslation() { + generalOptionsPanel.setTitle(Language.I18N.getString("pref.export.cityjson.border.general")); + prettyPrint.setText(Language.I18N.getString("pref.export.common.label.prettyPrint")); + useGeometryCompression.setText(Language.I18N.getString("pref.export.cityjson.label.geometryCompression")); + removeDuplicateChildGeometries.setText(Language.I18N.getString("pref.export.cityjson.label.removeDuplicates")); + addSequenceIdWhenSorting.setText(Language.I18N.getString("pref.export.cityjson.label.sequenceId")); + precisionPanel.setTitle(Language.I18N.getString("pref.export.cityjson.border.precision")); + significantDigitsLabel.setText(Language.I18N.getString("pref.export.cityjson.label.digits")); + significantDigitsUnitLabel.setText(Language.I18N.getString("pref.export.cityjson.label.digitsUnits")); + significantTextureDigitsLabel.setText(Language.I18N.getString("pref.export.cityjson.label.textureDigits")); + significantTextureDigitsUnitLabel.setText(Language.I18N.getString("pref.export.cityjson.label.textureDigitsUnits")); + } + + @Override + public String getTitle() { + return Language.I18N.getString("pref.tree.export.cityJSONOptions"); + } +} diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/GeneralPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/GeneralPanel.java new file mode 100644 index 000000000..4e07fc95f --- /dev/null +++ b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/GeneralPanel.java @@ -0,0 +1,213 @@ +/* + * 3D City Database - The Open Source CityGML Database + * http://www.3dcitydb.org/ + * + * Copyright 2013 - 2019 + * Chair of Geoinformatics + * Technical University of Munich, Germany + * https://www.gis.bgu.tum.de/ + * + * The 3D City Database is jointly developed with the following + * cooperation partners: + * + * virtualcitySYSTEMS GmbH, Berlin + * M.O.S.S. Computer Grafik Systeme GmbH, Taufkirchen + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.citydb.gui.modules.exporter.preferences; + +import org.citydb.config.Config; +import org.citydb.config.i18n.Language; +import org.citydb.config.project.exporter.FeatureEnvelopeMode; +import org.citydb.config.project.exporter.GeneralOptions; +import org.citydb.config.project.exporter.OutputFormat; +import org.citydb.config.project.query.filter.version.CityGMLVersionType; +import org.citydb.event.global.PropertyChangeEvent; +import org.citydb.gui.components.common.TitledPanel; +import org.citydb.gui.modules.common.AbstractPreferencesComponent; +import org.citydb.gui.util.GuiUtil; +import org.citydb.registry.ObjectRegistry; +import org.citydb.util.Util; + +import javax.swing.*; +import java.awt.*; + +public class GeneralPanel extends AbstractPreferencesComponent { + private TitledPanel versionPanel; + private JRadioButton cityGMLv2; + private JRadioButton cityGMLv1; + private JLabel versionHintLabel; + private JLabel compressedOutputFormatLabel; + private JComboBox compressedOutputFormat; + + private TitledPanel envelopePanel; + private JLabel featureEnvelopeLabel; + private JComboBox featureEnvelope; + private JCheckBox cityModelEnvelope; + private JCheckBox useTileExtent; + + public GeneralPanel(Config config) { + super(config); + initGui(); + } + + @Override + public boolean isModified() { + CityGMLVersionType version = config.getExportConfig().getSimpleQuery().getVersion(); + if (cityGMLv2.isSelected() && version != CityGMLVersionType.v2_0_0) return true; + if (cityGMLv1.isSelected() && version != CityGMLVersionType.v1_0_0) return true; + + GeneralOptions generalOptions = config.getExportConfig().getGeneralOptions(); + if (compressedOutputFormat.getSelectedItem() != generalOptions.getCompressedOutputFormat()) return true; + if (featureEnvelope.getSelectedItem() != generalOptions.getEnvelope().getFeatureMode()) return true; + if (cityModelEnvelope.isSelected() != generalOptions.getEnvelope().isUseEnvelopeOnCityModel()) return true; + if (useTileExtent.isSelected() != generalOptions.getEnvelope().isUseTileExtentForCityModel()) return true; + + return false; + } + + private void initGui() { + cityGMLv2 = new JRadioButton(); + cityGMLv1 = new JRadioButton(); + + ButtonGroup versionGroup = new ButtonGroup(); + versionGroup.add(cityGMLv2); + versionGroup.add(cityGMLv1); + + versionHintLabel = new JLabel(); + versionHintLabel.setFont(versionHintLabel.getFont().deriveFont(Font.ITALIC)); + + compressedOutputFormatLabel = new JLabel(); + compressedOutputFormat = new JComboBox<>(); + for (OutputFormat outputFormat : OutputFormat.values()) { + compressedOutputFormat.addItem(outputFormat); + } + + featureEnvelopeLabel = new JLabel(); + featureEnvelope = new JComboBox<>(); + for (FeatureEnvelopeMode mode : FeatureEnvelopeMode.values()) { + featureEnvelope.addItem(mode); + } + + featureEnvelope.setRenderer(new DefaultListCellRenderer() { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + if (value == FeatureEnvelopeMode.TOP_LEVEL) { + value = Language.I18N.getString("pref.export.general.feature.topLevel"); + } else if (value == FeatureEnvelopeMode.ALL) { + value = Language.I18N.getString("pref.export.general.feature.all"); + } else { + value = Language.I18N.getString("pref.export.general.feature.none"); + } + + return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + } + }); + + cityModelEnvelope = new JCheckBox(); + useTileExtent = new JCheckBox(); + + setLayout(new GridBagLayout()); + { + JPanel content = new JPanel(); + content.setLayout(new GridBagLayout()); + + int lmargin = GuiUtil.getTextOffset(cityGMLv2); + content.add(cityGMLv2, GuiUtil.setConstraints(0, 0, 2, 1, 1, 1, GridBagConstraints.BOTH, 0, 0, 0, 0)); + content.add(versionHintLabel, GuiUtil.setConstraints(0, 1, 2, 1, 1, 1, GridBagConstraints.BOTH, 5, lmargin, 0, 0)); + content.add(cityGMLv1, GuiUtil.setConstraints(0, 2, 2, 1, 1, 1, GridBagConstraints.BOTH, 5, 0, 0, 0)); + content.add(compressedOutputFormatLabel, GuiUtil.setConstraints(0, 3, 0, 0, GridBagConstraints.HORIZONTAL, 5, 0, 0, 5)); + content.add(compressedOutputFormat, GuiUtil.setConstraints(1, 3, 1, 0, GridBagConstraints.HORIZONTAL, 5, 5, 0, 0)); + + versionPanel = new TitledPanel().build(content); + } + { + JPanel content = new JPanel(); + content.setLayout(new GridBagLayout()); + + int lmargin = GuiUtil.getTextOffset(cityModelEnvelope); + content.add(featureEnvelopeLabel, GuiUtil.setConstraints(0, 0, 0, 0, GridBagConstraints.HORIZONTAL, 0, 0, 0, 5)); + content.add(featureEnvelope, GuiUtil.setConstraints(1, 0, 1, 0, GridBagConstraints.HORIZONTAL, 0, 5, 0, 0)); + content.add(cityModelEnvelope, GuiUtil.setConstraints(0, 1, 2, 1, 1, 1, GridBagConstraints.BOTH, 5, 0, 0, 0)); + content.add(useTileExtent, GuiUtil.setConstraints(0, 2, 2, 1, 1, 1, GridBagConstraints.BOTH, 5, lmargin, 0, 0)); + + envelopePanel = new TitledPanel().build(content); + } + + add(versionPanel, GuiUtil.setConstraints(0, 0, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); + add(envelopePanel, GuiUtil.setConstraints(0, 1, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); + + cityModelEnvelope.addActionListener(e -> setEnabledEnvelopeOptions()); + } + + @Override + public void doTranslation() { + versionPanel.setTitle(Language.I18N.getString("pref.export.general.border.general")); + cityGMLv2.setText(Language.I18N.getString("pref.export.general.label.citygmlv2")); + cityGMLv1.setText(Language.I18N.getString("pref.export.general.label.citygmlv1")); + versionHintLabel.setText(Language.I18N.getString("pref.export.general.label.versionHint")); + compressedOutputFormatLabel.setText(Language.I18N.getString("pref.export.general.label.compressedFormat")); + envelopePanel.setTitle(Language.I18N.getString("pref.export.general.border.bbox")); + featureEnvelopeLabel.setText(Language.I18N.getString("pref.export.general.label.feature")); + cityModelEnvelope.setText(Language.I18N.getString("pref.export.general.label.cityModel")); + useTileExtent.setText(Language.I18N.getString("pref.export.general.label.useTileExtent")); + } + + @Override + public void loadSettings() { + CityGMLVersionType version = config.getExportConfig().getSimpleQuery().getVersion(); + if (version == null) { + version = CityGMLVersionType.v2_0_0; + } + + cityGMLv2.setSelected(version == CityGMLVersionType.v2_0_0); + cityGMLv1.setSelected(version == CityGMLVersionType.v1_0_0); + firePropertyChange(version); + + GeneralOptions generalOptions = config.getExportConfig().getGeneralOptions(); + compressedOutputFormat.setSelectedItem(generalOptions.getCompressedOutputFormat()); + featureEnvelope.setSelectedItem(generalOptions.getEnvelope().getFeatureMode()); + cityModelEnvelope.setSelected(generalOptions.getEnvelope().isUseEnvelopeOnCityModel()); + useTileExtent.setSelected(generalOptions.getEnvelope().isUseTileExtentForCityModel()); + + setEnabledEnvelopeOptions(); + } + + @Override + public void setSettings() { + CityGMLVersionType version = cityGMLv1.isSelected() ? CityGMLVersionType.v1_0_0 : CityGMLVersionType.v2_0_0; + config.getExportConfig().getSimpleQuery().setVersion(version); + firePropertyChange(version); + + GeneralOptions generalOptions = config.getExportConfig().getGeneralOptions(); + generalOptions.setCompressedOutputFormat((OutputFormat) compressedOutputFormat.getSelectedItem()); + generalOptions.getEnvelope().setFeatureMode((FeatureEnvelopeMode) featureEnvelope.getSelectedItem()); + generalOptions.getEnvelope().setUseEnvelopeOnCityModel(cityModelEnvelope.isSelected()); + generalOptions.getEnvelope().setUseTileExtentForCityModel(useTileExtent.isSelected()); + } + + private void setEnabledEnvelopeOptions() { + useTileExtent.setEnabled(cityModelEnvelope.isSelected()); + } + + @Override + public String getTitle() { + return Language.I18N.getString("pref.tree.export.general"); + } + + private void firePropertyChange(CityGMLVersionType version) { + ObjectRegistry.getInstance().getEventDispatcher().triggerEvent( + new PropertyChangeEvent("citygml.version", null, Util.toCityGMLVersion(version), this)); + } +} diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/ResourcesPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/ResourcesPanel.java index d8d559547..8174fdb36 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/ResourcesPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/ResourcesPanel.java @@ -31,7 +31,7 @@ import org.citydb.config.i18n.Language; import org.citydb.config.project.database.ExportBatching; import org.citydb.config.project.resources.ThreadPool; -import org.citydb.config.project.resources.UIDCacheConfig; +import org.citydb.config.project.resources.IdCacheConfig; import org.citydb.gui.components.common.TitledPanel; import org.citydb.gui.factory.PopupMenuDecorator; import org.citydb.gui.modules.common.AbstractPreferencesComponent; @@ -83,8 +83,8 @@ public ResourcesPanel(Config config) { public boolean isModified() { ThreadPool threadPool = config.getExportConfig().getResources().getThreadPool(); ExportBatching exportBatching = config.getDatabaseConfig().getExportBatching(); - UIDCacheConfig geometry = config.getExportConfig().getResources().getGmlIdCache().getGeometry(); - UIDCacheConfig feature = config.getExportConfig().getResources().getGmlIdCache().getFeature(); + IdCacheConfig geometry = config.getExportConfig().getResources().getIdCache().getGeometry(); + IdCacheConfig feature = config.getExportConfig().getResources().getIdCache().getFeature(); try { expResMinThreadsText.commitEdit(); } catch (ParseException e) { } try { expResMaxThreadsText.commitEdit(); } catch (ParseException e) { } @@ -280,8 +280,8 @@ public void doTranslation() { public void loadSettings() { ThreadPool threadPool = config.getExportConfig().getResources().getThreadPool(); ExportBatching exportBatching = config.getDatabaseConfig().getExportBatching(); - UIDCacheConfig geometry = config.getExportConfig().getResources().getGmlIdCache().getGeometry(); - UIDCacheConfig feature = config.getExportConfig().getResources().getGmlIdCache().getFeature(); + IdCacheConfig geometry = config.getExportConfig().getResources().getIdCache().getGeometry(); + IdCacheConfig feature = config.getExportConfig().getResources().getIdCache().getFeature(); int featureBatchSize = exportBatching.getFeatureBatchSize(); if (featureBatchSize > ExportBatching.MAX_BATCH_SIZE) @@ -312,8 +312,8 @@ public void loadSettings() { public void setSettings() { ThreadPool threadPool = config.getExportConfig().getResources().getThreadPool(); ExportBatching exportBatching = config.getDatabaseConfig().getExportBatching(); - UIDCacheConfig geometry = config.getExportConfig().getResources().getGmlIdCache().getGeometry(); - UIDCacheConfig feature = config.getExportConfig().getResources().getGmlIdCache().getFeature(); + IdCacheConfig geometry = config.getExportConfig().getResources().getIdCache().getGeometry(); + IdCacheConfig feature = config.getExportConfig().getResources().getIdCache().getFeature(); int minThreads = ((Number)expResMinThreadsText.getValue()).intValue(); int maxThreads = ((Number)expResMaxThreadsText.getValue()).intValue(); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/VersionPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/VersionPanel.java deleted file mode 100644 index e5e79fa1b..000000000 --- a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/VersionPanel.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 3D City Database - The Open Source CityGML Database - * http://www.3dcitydb.org/ - * - * Copyright 2013 - 2019 - * Chair of Geoinformatics - * Technical University of Munich, Germany - * https://www.gis.bgu.tum.de/ - * - * The 3D City Database is jointly developed with the following - * cooperation partners: - * - * virtualcitySYSTEMS GmbH, Berlin - * M.O.S.S. Computer Grafik Systeme GmbH, Taufkirchen - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.citydb.gui.modules.exporter.preferences; - -import org.citydb.config.Config; -import org.citydb.config.i18n.Language; -import org.citydb.config.project.query.filter.version.CityGMLVersionType; -import org.citydb.event.global.PropertyChangeEvent; -import org.citydb.gui.components.common.TitledPanel; -import org.citydb.gui.modules.common.AbstractPreferencesComponent; -import org.citydb.gui.util.GuiUtil; -import org.citydb.registry.ObjectRegistry; -import org.citydb.util.Util; - -import javax.swing.*; -import java.awt.*; - -public class VersionPanel extends AbstractPreferencesComponent { - private TitledPanel versionPanel; - private JRadioButton[] cityGMLVersionBox; - - public VersionPanel(Config config) { - super(config); - initGui(); - } - - @Override - public boolean isModified() { - CityGMLVersionType version = config.getExportConfig().getSimpleQuery().getVersion(); - for (int i = 0; i < CityGMLVersionType.values().length; i++) { - if (cityGMLVersionBox[i].isSelected()) { - return version != CityGMLVersionType.fromValue(cityGMLVersionBox[i].getText()); - } - } - - return false; - } - - private void initGui() { - ButtonGroup group = new ButtonGroup(); - cityGMLVersionBox = new JRadioButton[CityGMLVersionType.values().length]; - - for (int i = 0; i < CityGMLVersionType.values().length; i++) { - cityGMLVersionBox[i] = new JRadioButton(); - cityGMLVersionBox[i].setText(CityGMLVersionType.values()[i].toString()); - group.add(cityGMLVersionBox[i]); - } - - setLayout(new GridBagLayout()); - JPanel content = new JPanel(); - content.setLayout(new GridBagLayout()); - { - for (int i = 0; i < cityGMLVersionBox.length; i++) { - content.add(cityGMLVersionBox[i], GuiUtil.setConstraints(0, i, 1, 1, GridBagConstraints.BOTH, i == 0 ? 0 : 5, 0, 0, 0)); - } - - versionPanel = new TitledPanel().build(content); - } - - add(versionPanel, GuiUtil.setConstraints(0, 0, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); - } - - @Override - public void doTranslation() { - versionPanel.setTitle(Language.I18N.getString("pref.export.version.border.versions")); - } - - @Override - public void loadSettings() { - CityGMLVersionType version = config.getExportConfig().getSimpleQuery().getVersion(); - if (version != null) { - for (int i = 0; i < CityGMLVersionType.values().length; i++) { - if (CityGMLVersionType.values()[i] == version) { - cityGMLVersionBox[i].setSelected(true); - break; - } - } - } else { - cityGMLVersionBox[0].setSelected(true); - version = CityGMLVersionType.values()[0]; - } - - firePropertyChange(version); - } - - @Override - public void setSettings() { - for (int i = 0; i < CityGMLVersionType.values().length; i++) { - if (cityGMLVersionBox[i].isSelected()) { - config.getExportConfig().getSimpleQuery().setVersion(CityGMLVersionType.fromValue(cityGMLVersionBox[i].getText())); - firePropertyChange(CityGMLVersionType.values()[i]); - break; - } - } - } - - @Override - public String getTitle() { - return Language.I18N.getString("pref.tree.export.version"); - } - - private void firePropertyChange(CityGMLVersionType version) { - ObjectRegistry.getInstance().getEventDispatcher().triggerEvent( - new PropertyChangeEvent("citygml.version", null, Util.toCityGMLVersion(version), this)); - } -} diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/XLinkPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/XLinkPanel.java index 4bf4a6b00..f4e1be40a 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/XLinkPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/preferences/XLinkPanel.java @@ -65,8 +65,8 @@ public XLinkPanel(Config config) { @Override public boolean isModified() { - XLinkFeatureConfig feature = config.getExportConfig().getXlink().getFeature(); - XLinkConfig geometry = config.getExportConfig().getXlink().getGeometry(); + XLinkFeatureConfig feature = config.getExportConfig().getCityGMLOptions().getXlink().getFeature(); + XLinkConfig geometry = config.getExportConfig().getCityGMLOptions().getXlink().getGeometry(); if (!featureIdPrefix.getText().equals(feature.getIdPrefix())) return true; if (xlinkToFeature.isSelected() != feature.isModeXLink()) return true; @@ -180,8 +180,8 @@ public void doTranslation() { @Override public void loadSettings() { - XLinkFeatureConfig feature = config.getExportConfig().getXlink().getFeature(); - XLinkConfig geometry = config.getExportConfig().getXlink().getGeometry(); + XLinkFeatureConfig feature = config.getExportConfig().getCityGMLOptions().getXlink().getFeature(); + XLinkConfig geometry = config.getExportConfig().getCityGMLOptions().getXlink().getGeometry(); if (feature.getIdPrefix() != null && feature.getIdPrefix().trim().length() != 0) featureIdPrefix.setText(feature.getIdPrefix()); @@ -218,8 +218,8 @@ public void loadSettings() { @Override public void setSettings() { - XLinkFeatureConfig feature = config.getExportConfig().getXlink().getFeature(); - XLinkConfig geometry = config.getExportConfig().getXlink().getGeometry(); + XLinkFeatureConfig feature = config.getExportConfig().getCityGMLOptions().getXlink().getFeature(); + XLinkConfig geometry = config.getExportConfig().getCityGMLOptions().getXlink().getGeometry(); if (featureIdPrefix.getText() != null && DefaultGMLIdManager.getInstance().isValidPrefix(featureIdPrefix.getText())) feature.setIdPrefix(featureIdPrefix.getText().trim()); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/view/ExportPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/view/ExportPanel.java index afb30d56e..24cbc6f69 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/view/ExportPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/view/ExportPanel.java @@ -33,6 +33,7 @@ import org.citydb.config.exception.ErrorCode; import org.citydb.config.geometry.BoundingBox; import org.citydb.config.i18n.Language; +import org.citydb.config.project.exporter.OutputFormat; import org.citydb.config.project.exporter.SimpleQuery; import org.citydb.config.project.exporter.SimpleTiling; import org.citydb.config.project.exporter.SimpleTilingMode; @@ -45,6 +46,8 @@ import org.citydb.event.Event; import org.citydb.event.EventDispatcher; import org.citydb.event.global.InterruptEvent; +import org.citydb.file.output.OutputFileFactory; +import org.citydb.gui.components.dialog.ConfirmationCheckDialog; import org.citydb.gui.components.dialog.ExportStatusDialog; import org.citydb.gui.factory.PopupMenuDecorator; import org.citydb.gui.util.GuiUtil; @@ -69,11 +72,11 @@ import java.io.File; import java.io.IOException; import java.nio.file.InvalidPathException; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; import java.util.concurrent.locks.ReentrantLock; -@SuppressWarnings("serial") public class ExportPanel extends JPanel implements DropTargetListener { private final ReentrantLock mainLock = new ReentrantLock(); private final Logger log = Logger.getInstance(); @@ -194,6 +197,8 @@ private void doExport() { return; } + boolean useTiling = false; + if (config.getExportConfig().isUseSimpleQuery()) { SimpleQuery query = config.getExportConfig().getSimpleQuery(); @@ -201,8 +206,8 @@ private void doExport() { if (query.isUseSelectionFilter()) { SimpleSelectionFilter selectionFilter = query.getSelectionFilter(); if (!selectionFilter.isUseSQLFilter() - && !selectionFilter.getGmlIdFilter().isSetResourceIds() - && !selectionFilter.getGmlNameFilter().isSetLiteral() + && !selectionFilter.getResourceIdFilter().isSetResourceIds() + && !selectionFilter.getNameFilter().isSetLiteral() && !selectionFilter.getLineageFilter().isSetLiteral()) { viewController.errorMessage(Language.I18N.getString("export.dialog.error.incorrectData"), Language.I18N.getString("export.dialog.error.incorrectData.attributes")); @@ -250,8 +255,10 @@ private void doExport() { return; } - if (bboxFilter.getMode() == SimpleTilingMode.TILING) + if (bboxFilter.getMode() == SimpleTilingMode.TILING) { tileAmount = bboxFilter.getRows() * bboxFilter.getColumns(); + useTiling = true; + } } // feature types @@ -268,10 +275,32 @@ private void doExport() { return; } - // copy tiling options if required - if (query.isSetTiling() && !(query.getTiling().getTilingOptions() instanceof SimpleTilingOptions)) { - query.getTiling().setTilingOptions(config.getExportConfig().getSimpleQuery().getBboxFilter().getTilingOptions()); - tileAmount = query.getTiling().getRows() * query.getTiling().getColumns(); + if (query.isSetTiling()) { + // copy tiling options if required + if (!(query.getTiling().getTilingOptions() instanceof SimpleTilingOptions)) { + query.getTiling().setTilingOptions(config.getExportConfig().getSimpleQuery().getBboxFilter().getTilingOptions()); + tileAmount = query.getTiling().getRows() * query.getTiling().getColumns(); + } + + useTiling = true; + } + } + + Path outputFile = Paths.get(browseText.getText()); + if (!useTiling + && OutputFileFactory.getOutputFormat(outputFile, config) == OutputFormat.CITYJSON + && config.getGuiConfig().isShowCityJSONTilingWarning()) { + ConfirmationCheckDialog dialog = ConfirmationCheckDialog.defaults() + .withParentComponent(viewController.getTopFrame()) + .withMessageType(JOptionPane.WARNING_MESSAGE) + .withOptionType(JOptionPane.YES_NO_OPTION) + .withTitle(Language.I18N.getString("export.dialog.warn.cityjson.title")) + .addMessage(Language.I18N.getString("export.dialog.warn.cityjson.msg")); + + int result = dialog.show(); + config.getGuiConfig().setShowCityJSONTilingWarning(dialog.keepShowingDialog()); + if (result != JOptionPane.YES_OPTION) { + return; } } @@ -335,12 +364,13 @@ private void saveFile(String title) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle(title); - FileNameExtensionFilter filter = new FileNameExtensionFilter("CityGML Files (*.gml, *.xml, *.zip, *.gz, *.gzip)", - "gml", "xml", "zip", "gz", "gzip"); + FileNameExtensionFilter filter = new FileNameExtensionFilter("CityGML Files (*.gml, *.xml, *.json, *.zip, *.gz, *.gzip)", + "gml", "xml", "json", "zip", "gz", "gzip"); chooser.addChoosableFileFilter(filter); chooser.addChoosableFileFilter(new FileNameExtensionFilter("CityGML GML Files (*.gml, *.xml)", "gml", "xml")); - chooser.addChoosableFileFilter(new FileNameExtensionFilter("CityGML ZIP Files (*.zip)", "zip")); - chooser.addChoosableFileFilter(new FileNameExtensionFilter("CityGML Compressed Files (*.gz, *.gzip)", "gz", "gzip")); + chooser.addChoosableFileFilter(new FileNameExtensionFilter("CityJSON Files (*.json)", "json")); + chooser.addChoosableFileFilter(new FileNameExtensionFilter("ZIP Files (*.zip)", "zip")); + chooser.addChoosableFileFilter(new FileNameExtensionFilter("Compressed Files (*.gz, *.gzip)", "gz", "gzip")); chooser.addChoosableFileFilter(chooser.getAcceptAllFileFilter()); chooser.setFileFilter(filter); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/view/FilterPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/view/FilterPanel.java index 202b1ce8a..ac23e6dec 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/exporter/view/FilterPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/exporter/view/FilterPanel.java @@ -48,7 +48,10 @@ import org.citydb.gui.components.feature.FeatureTypeTree; import org.citydb.gui.factory.PopupMenuDecorator; import org.citydb.gui.factory.SrsComboBoxFactory; -import org.citydb.gui.modules.common.filter.*; +import org.citydb.gui.modules.common.filter.AttributeFilterView; +import org.citydb.gui.modules.common.filter.FilterView; +import org.citydb.gui.modules.common.filter.SQLFilterView; +import org.citydb.gui.modules.common.filter.XMLQueryView; import org.citydb.gui.util.GuiUtil; import org.citydb.log.Logger; import org.citydb.plugin.extension.view.ViewController; @@ -115,7 +118,7 @@ public class FilterPanel extends JPanel implements EventHandler { public FilterPanel(ViewController viewController, Config config) { this.config = config; - ObjectRegistry.getInstance().getEventDispatcher().addEventHandler(EventType.PROPERTY_CHANGE_EVENT, this); + ObjectRegistry.getInstance().getEventDispatcher().addEventHandler(EventType.PROPERTY_CHANGE_EVENT, this); initGui(viewController); } @@ -606,6 +609,6 @@ public void updateUI() { public void handleEvent(Event event) throws Exception { PropertyChangeEvent e = (PropertyChangeEvent)event; if (e.getPropertyName().equals("citygml.version")) - featureTree.updateCityGMLVersion((CityGMLVersion)e.getNewValue(), useFeatureFilter.isSelected()); + featureTree.updateCityGMLVersion((CityGMLVersion) e.getNewValue(), useFeatureFilter.isSelected()); } } diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/AddressPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/AddressPanel.java index 292caac79..69406230d 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/AddressPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/AddressPanel.java @@ -29,7 +29,6 @@ import org.citydb.config.Config; import org.citydb.config.i18n.Language; -import org.citydb.config.project.importer.ImportAddress; import org.citydb.gui.components.common.TitledPanel; import org.citydb.gui.modules.common.AbstractPreferencesComponent; import org.citydb.gui.util.GuiUtil; @@ -48,8 +47,7 @@ public AddressPanel(Config config) { @Override public boolean isModified() { - ImportAddress address = config.getImportConfig().getAddress(); - if (importXAL.isSelected() != address.isSetImportXAL()) return true; + if (importXAL.isSelected() != config.getImportConfig().getCityGMLOptions().isImportXalAddress()) return true; return false; } @@ -67,14 +65,12 @@ private void initGui() { @Override public void loadSettings() { - ImportAddress address = config.getImportConfig().getAddress(); - importXAL.setSelected(address.isSetImportXAL()); + importXAL.setSelected(config.getImportConfig().getCityGMLOptions().isImportXalAddress()); } @Override public void setSettings() { - ImportAddress address = config.getImportConfig().getAddress(); - address.setImportXAL(importXAL.isSelected()); + config.getImportConfig().getCityGMLOptions().setImportXalAddress(importXAL.isSelected()); } @Override diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/CityGMLImportPreferences.java b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/CityGMLImportPreferences.java index 06b450c25..366f75e1e 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/CityGMLImportPreferences.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/CityGMLImportPreferences.java @@ -38,13 +38,18 @@ public CityGMLImportPreferences(Config config) { super(new CityGMLImportEntry()); root.addChildEntry(new DefaultPreferencesEntry(new ContinuationPanel(config))); - root.addChildEntry(new DefaultPreferencesEntry(new IdHandlingPanel(config))); - root.addChildEntry(new DefaultPreferencesEntry(new AddressPanel(config))); + root.addChildEntry(new DefaultPreferencesEntry(new ResourceIdPanel(config))); root.addChildEntry(new DefaultPreferencesEntry(new AppearancePanel(config))); root.addChildEntry(new DefaultPreferencesEntry(new GeometryPanel(config))); + + DefaultPreferencesEntry cityGMLOptions = new CityGMLOptionsPanel(); + root.addChildEntry(cityGMLOptions); + cityGMLOptions.addChildEntry(new DefaultPreferencesEntry(new AddressPanel(config))); + cityGMLOptions.addChildEntry(new DefaultPreferencesEntry(new XMLValidationPanel(config))); + cityGMLOptions.addChildEntry(new DefaultPreferencesEntry(new XSLTransformationPanel(false, config))); + + root.addChildEntry(new DefaultPreferencesEntry(new CityJSONOptionsPanel(config))); root.addChildEntry(new DefaultPreferencesEntry(new IndexPanel(config))); - root.addChildEntry(new DefaultPreferencesEntry(new XMLValidationPanel(config))); - root.addChildEntry(new DefaultPreferencesEntry(new XSLTransformationPanel(false, config))); root.addChildEntry(new DefaultPreferencesEntry(new ImportLogPanel(config))); root.addChildEntry(new DefaultPreferencesEntry(new ResourcesPanel(config))); } diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/CityGMLOptionsPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/CityGMLOptionsPanel.java new file mode 100644 index 000000000..77ca52301 --- /dev/null +++ b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/CityGMLOptionsPanel.java @@ -0,0 +1,17 @@ +package org.citydb.gui.modules.importer.preferences; + +import org.citydb.config.i18n.Language; +import org.citydb.gui.modules.common.DefaultPreferencesEntry; +import org.citydb.gui.modules.common.NullComponent; + +public class CityGMLOptionsPanel extends DefaultPreferencesEntry { + + public CityGMLOptionsPanel() { + super(NullComponent.getInstance()); + } + + @Override + public String getLocalizedTitle() { + return Language.I18N.getString("pref.tree.import.cityGMLOptions"); + } +} diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/CityJSONOptionsPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/CityJSONOptionsPanel.java new file mode 100644 index 000000000..ec81d3c20 --- /dev/null +++ b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/CityJSONOptionsPanel.java @@ -0,0 +1,85 @@ +/* + * 3D City Database - The Open Source CityGML Database + * http://www.3dcitydb.org/ + * + * Copyright 2013 - 2020 + * Chair of Geoinformatics + * Technical University of Munich, Germany + * https://www.gis.bgu.tum.de/ + * + * The 3D City Database is jointly developed with the following + * cooperation partners: + * + * virtualcitySYSTEMS GmbH, Berlin + * M.O.S.S. Computer Grafik Systeme GmbH, Taufkirchen + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.citydb.gui.modules.importer.preferences; + +import org.citydb.config.Config; +import org.citydb.config.i18n.Language; +import org.citydb.gui.components.common.TitledPanel; +import org.citydb.gui.modules.common.AbstractPreferencesComponent; +import org.citydb.gui.util.GuiUtil; + +import javax.swing.*; +import java.awt.*; + +public class CityJSONOptionsPanel extends AbstractPreferencesComponent { + private TitledPanel mapUnknownExtensionsPanel; + private JCheckBox mapUnknownExtensions; + + public CityJSONOptionsPanel(Config config) { + super(config); + initGui(); + } + + @Override + public boolean isModified() { + if (mapUnknownExtensions.isSelected() != config.getImportConfig().getCityJSONOptions().isMapUnknownExtensions()) return true; + return false; + } + + private void initGui() { + mapUnknownExtensions = new JCheckBox(); + + setLayout(new GridBagLayout()); + mapUnknownExtensionsPanel = new TitledPanel() + .withToggleButton(mapUnknownExtensions) + .showSeparator(false) + .buildWithoutContent(); + + add(mapUnknownExtensionsPanel, GuiUtil.setConstraints(0, 0, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); + } + + @Override + public void loadSettings() { + mapUnknownExtensions.setSelected(config.getImportConfig().getCityJSONOptions().isMapUnknownExtensions()); + } + + @Override + public void setSettings() { + config.getImportConfig().getCityJSONOptions().setMapUnknownExtensions(mapUnknownExtensions.isSelected()); + } + + @Override + public void doTranslation() { + mapUnknownExtensionsPanel.setTitle(Language.I18N.getString("pref.import.cityjson.label.mapUnknownExtensions")); + } + + @Override + public String getTitle() { + return Language.I18N.getString("pref.tree.import.cityJSONOptions"); + } +} diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/IdHandlingPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/ResourceIdPanel.java similarity index 72% rename from impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/IdHandlingPanel.java rename to impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/ResourceIdPanel.java index 5ed2df224..521d9bb5b 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/IdHandlingPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/ResourceIdPanel.java @@ -30,7 +30,7 @@ import org.citydb.config.Config; import org.citydb.config.i18n.Language; import org.citydb.config.project.importer.CodeSpaceMode; -import org.citydb.config.project.importer.ImportGmlId; +import org.citydb.config.project.importer.ImportResourceId; import org.citydb.config.project.importer.UUIDMode; import org.citydb.database.adapter.AbstractDatabaseAdapter; import org.citydb.database.version.DatabaseVersion; @@ -49,7 +49,7 @@ import java.awt.*; import java.awt.event.ActionListener; -public class IdHandlingPanel extends AbstractPreferencesComponent implements EventHandler { +public class ResourceIdPanel extends AbstractPreferencesComponent implements EventHandler { private TitledPanel idAssignmentPanel; private JLabel idPrefixLabel; private JTextField idPrefix; @@ -63,7 +63,7 @@ public class IdHandlingPanel extends AbstractPreferencesComponent implements Eve private JRadioButton impIdCSRadioUser; private JTextField impIdCSUserText; - public IdHandlingPanel(Config config) { + public ResourceIdPanel(Config config) { super(config); initGui(); @@ -72,17 +72,17 @@ public IdHandlingPanel(Config config) { @Override public boolean isModified() { - ImportGmlId gmlId = config.getImportConfig().getGmlId(); + ImportResourceId resourceId = config.getImportConfig().getResourceId(); - if (!idPrefix.getText().equals(gmlId.getIdPrefix())) return true; - if (impIdCheckExtRef.isSelected() != gmlId.isSetKeepGmlIdAsExternalReference()) return true; - if (impIdRadioAdd.isSelected() != gmlId.isUUIDModeComplement()) return true; - if (impIdRadioExchange.isSelected() != gmlId.isUUIDModeReplace()) return true; - if (!impIdCSUserText.getText().equals(gmlId.getCodeSpace())) return true; - if (impIdCSRadioNone.isSelected() != gmlId.isSetNoneCodeSpaceMode()) return true; - if (impIdCSRadioFile.isSelected() != gmlId.isSetRelativeCodeSpaceMode()) return true; - if (impIdCSRadioFilePath.isSelected() != gmlId.isSetAbsoluteCodeSpaceMode()) return true; - if (impIdCSRadioUser.isSelected() != gmlId.isSetUserCodeSpaceMode()) return true; + if (!idPrefix.getText().equals(resourceId.getIdPrefix())) return true; + if (impIdCheckExtRef.isSelected() != resourceId.isSetKeepIdAsExternalReference()) return true; + if (impIdRadioAdd.isSelected() != resourceId.isUUIDModeComplement()) return true; + if (impIdRadioExchange.isSelected() != resourceId.isUUIDModeReplace()) return true; + if (!impIdCSUserText.getText().equals(resourceId.getCodeSpace())) return true; + if (impIdCSRadioNone.isSelected() != resourceId.isSetNoneCodeSpaceMode()) return true; + if (impIdCSRadioFile.isSelected() != resourceId.isSetRelativeCodeSpaceMode()) return true; + if (impIdCSRadioFilePath.isSelected() != resourceId.isSetAbsoluteCodeSpaceMode()) return true; + if (impIdCSRadioUser.isSelected() != resourceId.isSetUserCodeSpaceMode()) return true; return false; } @@ -148,11 +148,11 @@ private void initGui(){ PopupMenuDecorator.getInstance().decorate(idPrefix, impIdCSUserText); - ActionListener gmlIdListener = e -> setEnabledGmlId(); + ActionListener resourceIdListener = e -> setEnabledResourceId(); ActionListener codeSpaceListener = e -> setEnabledCodeSpace(); - impIdRadioAdd.addActionListener(gmlIdListener); - impIdRadioExchange.addActionListener(gmlIdListener); + impIdRadioAdd.addActionListener(resourceIdListener); + impIdRadioExchange.addActionListener(resourceIdListener); impIdCSRadioNone.addActionListener(codeSpaceListener); impIdCSRadioFile.addActionListener(codeSpaceListener); @@ -160,7 +160,7 @@ private void initGui(){ impIdCSRadioUser.addActionListener(codeSpaceListener); } - private void setEnabledGmlId() { + private void setEnabledResourceId() { impIdCheckExtRef.setEnabled(impIdRadioExchange.isSelected()); } @@ -178,92 +178,92 @@ private void setEnabledCodespaceDialog(boolean enable) { @Override public void doTranslation() { - idAssignmentPanel.setTitle(Language.I18N.getString("pref.import.idHandling.border.id")); - idPrefixLabel.setText(Language.I18N.getString("pref.import.idHandling.label.id.prefix")); - impIdCheckExtRef.setText(Language.I18N.getString("pref.import.idHandling.label.id.extReference")); - impIdRadioAdd.setText(Language.I18N.getString("pref.import.idHandling.label.id.add")); - impIdRadioExchange.setText(Language.I18N.getString("pref.import.idHandling.label.id.exchange")); + idAssignmentPanel.setTitle(Language.I18N.getString("pref.import.id.border.id")); + idPrefixLabel.setText(Language.I18N.getString("pref.import.id.label.id.prefix")); + impIdCheckExtRef.setText(Language.I18N.getString("pref.import.id.label.id.extReference")); + impIdRadioAdd.setText(Language.I18N.getString("pref.import.id.label.id.add")); + impIdRadioExchange.setText(Language.I18N.getString("pref.import.id.label.id.exchange")); - codespacePanel.setTitle(Language.I18N.getString("pref.import.idHandling.border.idCodeSpace")); - impIdCSRadioNone.setText(Language.I18N.getString("pref.import.idHandling.label.idCodeSpace.none")); - impIdCSRadioFile.setText(Language.I18N.getString("pref.import.idHandling.label.idCodeSpace.file")); - impIdCSRadioFilePath.setText(Language.I18N.getString("pref.import.idHandling.label.idCodeSpace.filePath")); - impIdCSRadioUser.setText(Language.I18N.getString("pref.import.idHandling.label.idCodeSpace.user")); + codespacePanel.setTitle(Language.I18N.getString("pref.import.id.border.idCodeSpace")); + impIdCSRadioNone.setText(Language.I18N.getString("pref.import.id.label.idCodeSpace.none")); + impIdCSRadioFile.setText(Language.I18N.getString("pref.import.id.label.idCodeSpace.file")); + impIdCSRadioFilePath.setText(Language.I18N.getString("pref.import.id.label.idCodeSpace.filePath")); + impIdCSRadioUser.setText(Language.I18N.getString("pref.import.id.label.idCodeSpace.user")); } @Override public void loadSettings() { - ImportGmlId gmlId = config.getImportConfig().getGmlId(); + ImportResourceId resourceId = config.getImportConfig().getResourceId(); - if (gmlId.getIdPrefix() != null && gmlId.getIdPrefix().trim().length() != 0) - idPrefix.setText(gmlId.getIdPrefix()); + if (resourceId.getIdPrefix() != null && resourceId.getIdPrefix().trim().length() != 0) + idPrefix.setText(resourceId.getIdPrefix()); else { idPrefix.setText(DefaultGMLIdManager.getInstance().getDefaultPrefix()); - gmlId.setIdPrefix(DefaultGMLIdManager.getInstance().getDefaultPrefix()); + resourceId.setIdPrefix(DefaultGMLIdManager.getInstance().getDefaultPrefix()); } - if (gmlId.isUUIDModeReplace()) + if (resourceId.isUUIDModeReplace()) impIdRadioExchange.setSelected(true); else impIdRadioAdd.setSelected(true); - impIdCheckExtRef.setSelected(gmlId.isSetKeepGmlIdAsExternalReference()); + impIdCheckExtRef.setSelected(resourceId.isSetKeepIdAsExternalReference()); - setEnabledGmlId(); + setEnabledResourceId(); - if (gmlId.isSetNoneCodeSpaceMode()) + if (resourceId.isSetNoneCodeSpaceMode()) impIdCSRadioNone.setSelected(true); - else if (gmlId.isSetUserCodeSpaceMode()) + else if (resourceId.isSetUserCodeSpaceMode()) impIdCSRadioUser.setSelected(true); - else if (gmlId.isSetRelativeCodeSpaceMode()) + else if (resourceId.isSetRelativeCodeSpaceMode()) impIdCSRadioFile.setSelected(true); else impIdCSRadioFilePath.setSelected(true); - impIdCSUserText.setText(gmlId.getCodeSpace()); + impIdCSUserText.setText(resourceId.getCodeSpace()); setEnabledCodeSpace(); } @Override public void setSettings() { - ImportGmlId gmlId = config.getImportConfig().getGmlId(); + ImportResourceId resourceId = config.getImportConfig().getResourceId(); if (idPrefix.getText() != null && DefaultGMLIdManager.getInstance().isValidPrefix(idPrefix.getText())) - gmlId.setIdPrefix(idPrefix.getText()); + resourceId.setIdPrefix(idPrefix.getText()); else { - gmlId.setIdPrefix(DefaultGMLIdManager.getInstance().getDefaultPrefix()); + resourceId.setIdPrefix(DefaultGMLIdManager.getInstance().getDefaultPrefix()); idPrefix.setText(DefaultGMLIdManager.getInstance().getDefaultPrefix()); } if (impIdRadioAdd.isSelected()) - gmlId.setUuidMode(UUIDMode.COMPLEMENT); + resourceId.setUuidMode(UUIDMode.COMPLEMENT); else - gmlId.setUuidMode(UUIDMode.REPLACE); + resourceId.setUuidMode(UUIDMode.REPLACE); - gmlId.setKeepGmlIdAsExternalReference(impIdCheckExtRef.isSelected()); + resourceId.setKeepIdAsExternalReference(impIdCheckExtRef.isSelected()); if (impIdCSRadioNone.isSelected()) - gmlId.setCodeSpaceMode(CodeSpaceMode.NONE); + resourceId.setCodeSpaceMode(CodeSpaceMode.NONE); else if (impIdCSRadioFile.isSelected()) - gmlId.setCodeSpaceMode(CodeSpaceMode.RELATIVE); + resourceId.setCodeSpaceMode(CodeSpaceMode.RELATIVE); else if (impIdCSRadioFilePath.isSelected()) - gmlId.setCodeSpaceMode(CodeSpaceMode.ABSOLUTE); + resourceId.setCodeSpaceMode(CodeSpaceMode.ABSOLUTE); else - gmlId.setCodeSpaceMode(CodeSpaceMode.USER); + resourceId.setCodeSpaceMode(CodeSpaceMode.USER); - String gmlIdCodeSpace = impIdCSUserText.getText().trim(); - if (gmlIdCodeSpace.length() > 0) - gmlId.setCodeSpace(gmlIdCodeSpace); + String codeSpace = impIdCSUserText.getText().trim(); + if (codeSpace.length() > 0) + resourceId.setCodeSpace(codeSpace); else - gmlIdCodeSpace = gmlId.getCodeSpace(); + codeSpace = resourceId.getCodeSpace(); - impIdCSUserText.setText(gmlIdCodeSpace); + impIdCSUserText.setText(codeSpace); } @Override public String getTitle() { - return Language.I18N.getString("pref.tree.import.idHandling"); + return Language.I18N.getString("pref.tree.import.id"); } @Override diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/ResourcesPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/ResourcesPanel.java index edc03f66c..aa1546778 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/ResourcesPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/ResourcesPanel.java @@ -31,7 +31,7 @@ import org.citydb.config.i18n.Language; import org.citydb.config.project.database.ImportBatching; import org.citydb.config.project.resources.ThreadPool; -import org.citydb.config.project.resources.UIDCacheConfig; +import org.citydb.config.project.resources.IdCacheConfig; import org.citydb.gui.components.common.TitledPanel; import org.citydb.gui.factory.PopupMenuDecorator; import org.citydb.gui.modules.common.AbstractPreferencesComponent; @@ -92,9 +92,9 @@ public ResourcesPanel(Config config) { public boolean isModified() { ThreadPool threadPool = config.getImportConfig().getResources().getThreadPool(); ImportBatching commit = config.getDatabaseConfig().getImportBatching(); - UIDCacheConfig geometry = config.getImportConfig().getResources().getGmlIdCache().getGeometry(); - UIDCacheConfig feature = config.getImportConfig().getResources().getGmlIdCache().getFeature(); - UIDCacheConfig texImage = config.getImportConfig().getResources().getTexImageCache(); + IdCacheConfig geometry = config.getImportConfig().getResources().getIdCache().getGeometry(); + IdCacheConfig feature = config.getImportConfig().getResources().getIdCache().getFeature(); + IdCacheConfig texImage = config.getImportConfig().getResources().getTexImageCache(); try { impResMinThreadsText.commitEdit(); } catch (ParseException e) { } try { impResMaxThreadsText.commitEdit(); } catch (ParseException e) { } @@ -331,9 +331,9 @@ public void doTranslation() { public void loadSettings() { ThreadPool threadPool = config.getImportConfig().getResources().getThreadPool(); ImportBatching commit = config.getDatabaseConfig().getImportBatching(); - UIDCacheConfig geometry = config.getImportConfig().getResources().getGmlIdCache().getGeometry(); - UIDCacheConfig feature = config.getImportConfig().getResources().getGmlIdCache().getFeature(); - UIDCacheConfig texImage = config.getImportConfig().getResources().getTexImageCache(); + IdCacheConfig geometry = config.getImportConfig().getResources().getIdCache().getGeometry(); + IdCacheConfig feature = config.getImportConfig().getResources().getIdCache().getFeature(); + IdCacheConfig texImage = config.getImportConfig().getResources().getTexImageCache(); int commitFeature = commit.getFeatureBatchSize(); if (commitFeature > ImportBatching.MAX_BATCH_SIZE) @@ -367,9 +367,9 @@ public void loadSettings() { public void setSettings() { ThreadPool threadPool = config.getImportConfig().getResources().getThreadPool(); ImportBatching commit = config.getDatabaseConfig().getImportBatching(); - UIDCacheConfig geometry = config.getImportConfig().getResources().getGmlIdCache().getGeometry(); - UIDCacheConfig feature = config.getImportConfig().getResources().getGmlIdCache().getFeature(); - UIDCacheConfig texImage = config.getImportConfig().getResources().getTexImageCache(); + IdCacheConfig geometry = config.getImportConfig().getResources().getIdCache().getGeometry(); + IdCacheConfig feature = config.getImportConfig().getResources().getIdCache().getFeature(); + IdCacheConfig texImage = config.getImportConfig().getResources().getTexImageCache(); int minThreads = ((Number)impResMinThreadsText.getValue()).intValue(); int maxThreads = ((Number)impResMaxThreadsText.getValue()).intValue(); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/XMLValidationPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/XMLValidationPanel.java index 317dbd32a..3a568d755 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/XMLValidationPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/importer/preferences/XMLValidationPanel.java @@ -50,7 +50,7 @@ public XMLValidationPanel(Config config) { @Override public boolean isModified() { - XMLValidation xmlValidation = config.getImportConfig().getXMLValidation(); + XMLValidation xmlValidation = config.getImportConfig().getCityGMLOptions().getXMLValidation(); if (useXMLValidation.isSelected() != xmlValidation.isSetUseXMLValidation()) return true; if (oneError.isSelected() != xmlValidation.isSetReportOneErrorPerFeature()) return true; @@ -97,7 +97,7 @@ private void setEnabledValidation() { @Override public void loadSettings() { - XMLValidation xmlValidation = config.getImportConfig().getXMLValidation(); + XMLValidation xmlValidation = config.getImportConfig().getCityGMLOptions().getXMLValidation(); useXMLValidation.setSelected(xmlValidation.isSetUseXMLValidation()); oneError.setSelected(xmlValidation.isSetReportOneErrorPerFeature()); @@ -107,7 +107,7 @@ public void loadSettings() { @Override public void setSettings() { - XMLValidation xmlValidation = config.getImportConfig().getXMLValidation(); + XMLValidation xmlValidation = config.getImportConfig().getCityGMLOptions().getXMLValidation(); xmlValidation.setUseXMLValidation(useXMLValidation.isSelected()); xmlValidation.setReportOneErrorPerFeature(oneError.isSelected()); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/importer/view/FilterPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/importer/view/FilterPanel.java index 1b7f70834..c782d1aea 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/importer/view/FilterPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/importer/view/FilterPanel.java @@ -64,10 +64,10 @@ public class FilterPanel extends JPanel { private TitledPanel bboxFilterPanel; private TitledPanel featureFilterPanel; - private JLabel gmlIdLabel; - private JTextField gmlIdText; - private JLabel gmlNameLabel; - private JTextField gmlNameText; + private JLabel resourceIdLabel; + private JTextField resourceIdText; + private JLabel nameLabel; + private JTextField nameText; private JLabel countLabel; private JLabel startIndexLabel; @@ -97,10 +97,10 @@ private void initGui(ViewController viewController) { bboxFilterPanel = new TitledPanel().withToggleButton(useBBoxFilter); featureFilterPanel = new TitledPanel().withToggleButton(useFeatureFilter); - gmlIdLabel = new JLabel(); - gmlIdText = new JTextField(); - gmlNameLabel = new JLabel(); - gmlNameText = new JTextField(); + resourceIdLabel = new JLabel(); + resourceIdText = new JTextField(); + nameLabel = new JLabel(); + nameText = new JTextField(); countLabel = new JLabel(); startIndexLabel = new JLabel(); @@ -138,10 +138,10 @@ private void initGui(ViewController viewController) { JPanel content = new JPanel(); content.setLayout(new GridBagLayout()); { - content.add(gmlIdLabel, GuiUtil.setConstraints(0, 0, 0, 0, GridBagConstraints.HORIZONTAL, 0, 0, 5, 5)); - content.add(gmlIdText, GuiUtil.setConstraints(1, 0, 1, 0, GridBagConstraints.HORIZONTAL, 0, 5, 5, 0)); - content.add(gmlNameLabel, GuiUtil.setConstraints(0, 1, 0, 0, GridBagConstraints.HORIZONTAL, 0, 0, 0, 5)); - content.add(gmlNameText, GuiUtil.setConstraints(1, 1, 1, 0, GridBagConstraints.HORIZONTAL, 0, 5, 0, 0)); + content.add(resourceIdLabel, GuiUtil.setConstraints(0, 0, 0, 0, GridBagConstraints.HORIZONTAL, 0, 0, 5, 5)); + content.add(resourceIdText, GuiUtil.setConstraints(1, 0, 1, 0, GridBagConstraints.HORIZONTAL, 0, 5, 5, 0)); + content.add(nameLabel, GuiUtil.setConstraints(0, 1, 0, 0, GridBagConstraints.HORIZONTAL, 0, 0, 0, 5)); + content.add(nameText, GuiUtil.setConstraints(1, 1, 1, 0, GridBagConstraints.HORIZONTAL, 0, 5, 0, 0)); } attributeFilterPanel.build(content); @@ -188,7 +188,7 @@ private void initGui(ViewController viewController) { useBBoxFilter.addActionListener(e -> setEnabledBBoxFilter()); useFeatureFilter.addActionListener(e -> setEnabledFeatureFilter()); - PopupMenuDecorator.getInstance().decorate(featureTree, gmlNameText, gmlIdText, countText, startIndexText); + PopupMenuDecorator.getInstance().decorate(featureTree, nameText, resourceIdText, countText, startIndexText); UIManager.addPropertyChangeListener(e -> { if ("lookAndFeel".equals(e.getPropertyName())) { @@ -204,10 +204,10 @@ private void updateComponentUI() { } private void setEnabledAttributeFilter() { - gmlIdLabel.setEnabled(useAttributeFilter.isSelected()); - gmlIdText.setEnabled(useAttributeFilter.isSelected()); - gmlNameLabel.setEnabled(useAttributeFilter.isSelected()); - gmlNameText.setEnabled(useAttributeFilter.isSelected()); + resourceIdLabel.setEnabled(useAttributeFilter.isSelected()); + resourceIdText.setEnabled(useAttributeFilter.isSelected()); + nameLabel.setEnabled(useAttributeFilter.isSelected()); + nameText.setEnabled(useAttributeFilter.isSelected()); } private void setEnabledCounterFilter() { @@ -240,8 +240,8 @@ public void doTranslation() { bboxFilterPanel.setTitle(Language.I18N.getString("filter.border.boundingBox")); featureFilterPanel.setTitle(Language.I18N.getString("filter.border.featureClass")); - gmlIdLabel.setText(Language.I18N.getString("filter.label.gmlId")); - gmlNameLabel.setText(Language.I18N.getString("filter.label.gmlName")); + resourceIdLabel.setText(Language.I18N.getString("filter.label.id")); + nameLabel.setText(Language.I18N.getString("filter.label.name")); countLabel.setText(Language.I18N.getString("filter.label.counter.count")); startIndexLabel.setText(Language.I18N.getString("filter.label.counter.startIndex")); bboxOverlaps.setText(Language.I18N.getString("filter.label.boundingBox.overlaps")); @@ -256,13 +256,13 @@ public void loadSettings() { useBBoxFilter.setSelected(filter.isUseBboxFilter()); useFeatureFilter.setSelected(filter.isUseTypeNames()); - // gml:id filter - ResourceIdOperator gmlIdFilter = filter.getAttributeFilter().getGmlIdFilter(); - gmlIdText.setText(String.join(",", gmlIdFilter.getResourceIds())); + // resource id filter + ResourceIdOperator resourceIdFilter = filter.getAttributeFilter().getResourceIdFilter(); + resourceIdText.setText(String.join(",", resourceIdFilter.getResourceIds())); - // gml:name - LikeOperator gmlNameFilter = filter.getAttributeFilter().getGmlNameFilter(); - gmlNameText.setText(gmlNameFilter.getLiteral()); + // name filter + LikeOperator nameFilter = filter.getAttributeFilter().getNameFilter(); + nameText.setText(nameFilter.getLiteral()); // counter filter CounterFilter counterFilter = filter.getCounterFilter(); @@ -299,19 +299,19 @@ public void setSettings() { filter.setUseBboxFilter(useBBoxFilter.isSelected()); filter.setUseTypeNames(useFeatureFilter.isSelected()); - // gml:id filter - ResourceIdOperator gmlIdFilter = filter.getAttributeFilter().getGmlIdFilter(); - gmlIdFilter.reset(); - if (gmlIdText.getText().trim().length() > 0) { - String trimmed = gmlIdText.getText().replaceAll("\\s+", ""); - gmlIdFilter.setResourceIds(Util.string2string(trimmed, ",")); + // resource id filter + ResourceIdOperator resourceIdFilter = filter.getAttributeFilter().getResourceIdFilter(); + resourceIdFilter.reset(); + if (resourceIdText.getText().trim().length() > 0) { + String trimmed = resourceIdText.getText().replaceAll("\\s+", ""); + resourceIdFilter.setResourceIds(Util.string2string(trimmed, ",")); } - // gml:name - LikeOperator gmlNameFilter = filter.getAttributeFilter().getGmlNameFilter(); - gmlNameFilter.reset(); - if (gmlNameText.getText().trim().length() > 0) - gmlNameFilter.setLiteral(gmlNameText.getText().trim()); + // name filter + LikeOperator nameFilter = filter.getAttributeFilter().getNameFilter(); + nameFilter.reset(); + if (nameText.getText().trim().length() > 0) + nameFilter.setLiteral(nameText.getText().trim()); // counter filter CounterFilter counterFilter = filter.getCounterFilter(); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/importer/view/ImportPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/importer/view/ImportPanel.java index 31d34573d..9e10ce3ff 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/importer/view/ImportPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/importer/view/ImportPanel.java @@ -74,7 +74,6 @@ import java.util.List; import java.util.concurrent.locks.ReentrantLock; -@SuppressWarnings("serial") public class ImportPanel extends JPanel { private final ReentrantLock mainLock = new ReentrantLock(); private final Logger log = Logger.getInstance(); @@ -225,8 +224,8 @@ private void doImport() { // attribute filter if (filter.isUseAttributeFilter() - && !filter.getAttributeFilter().getGmlIdFilter().isSetResourceIds() - && !filter.getAttributeFilter().getGmlNameFilter().isSetLiteral()) { + && !filter.getAttributeFilter().getResourceIdFilter().isSetResourceIds() + && !filter.getAttributeFilter().getNameFilter().isSetLiteral()) { viewController.errorMessage(Language.I18N.getString("import.dialog.error.incorrectData"), Language.I18N.getString("common.dialog.error.incorrectData.attributes")); return; @@ -425,8 +424,8 @@ private void loadFile(String title) { chooser.addChoosableFileFilter(filter); chooser.addChoosableFileFilter(new FileNameExtensionFilter("CityGML GML Files (*.gml, *.xml)", "gml", "xml")); chooser.addChoosableFileFilter(new FileNameExtensionFilter("CityJSON Files (*.json)", "json")); - chooser.addChoosableFileFilter(new FileNameExtensionFilter("CityGML ZIP Files (*.zip)", "zip")); - chooser.addChoosableFileFilter(new FileNameExtensionFilter("CityGML Compressed Files (*.gz, *.gzip)", "gz", "gzip")); + chooser.addChoosableFileFilter(new FileNameExtensionFilter("ZIP Files (*.zip)", "zip")); + chooser.addChoosableFileFilter(new FileNameExtensionFilter("Compressed Files (*.gz, *.gzip)", "gz", "gzip")); chooser.addChoosableFileFilter(chooser.getAcceptAllFileFilter()); chooser.setFileFilter(filter); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/kml/view/KmlExportPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/kml/view/KmlExportPanel.java index 88d19afc3..15377ee75 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/kml/view/KmlExportPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/kml/view/KmlExportPanel.java @@ -103,16 +103,16 @@ public class KmlExportPanel extends JPanel implements EventHandler { private JTextField browseText; private JButton browseButton; - private TitledPanel gmlIdPanel; + private TitledPanel resourceIdPanel; private TitledPanel bboxPanel; private TitledPanel tilingPanel; private TitledPanel lodPanel; private TitledPanel displayAsPanel; private TitledPanel featureFilterPanel; - private JCheckBox useGmlIdFilter; - private JLabel gmlIdLabel; - private JTextField gmlIdText; + private JCheckBox useResourceIdFilter; + private JLabel resourceIdLabel; + private JTextField resourceIdText; private JCheckBox useBboxFilter; private BoundingBoxPanel bboxComponent; @@ -173,10 +173,10 @@ private void initGui() { browsePanel.add(browseText, GuiUtil.setConstraints(0, 0, 1, 1, GridBagConstraints.BOTH, 0, 0, 0, 5)); browsePanel.add(browseButton, GuiUtil.setConstraints(1, 0, 0, 0, GridBagConstraints.NONE, 0, 5, 0, 0)); - useGmlIdFilter = new JCheckBox(); + useResourceIdFilter = new JCheckBox(); useBboxFilter = new JCheckBox(); - gmlIdLabel = new JLabel("gml:id"); - gmlIdText = new JTextField(); + resourceIdLabel = new JLabel(); + resourceIdText = new JTextField(); bboxComponent = viewController.getComponentFactory().createBoundingBoxPanel(); tilingCheckBox = new JCheckBox(); @@ -313,17 +313,17 @@ private void initGui() { mainPanel.add(tilingPanel, GuiUtil.setConstraints(0, 1, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); } { - // gml:id - JPanel gmlIdConent = new JPanel(); - gmlIdConent.setLayout(new GridBagLayout()); - gmlIdConent.add(gmlIdLabel, GuiUtil.setConstraints(0, 0, 0, 0, GridBagConstraints.HORIZONTAL, 0, 0, 0, 5)); - gmlIdConent.add(gmlIdText, GuiUtil.setConstraints(1, 0, 1, 1, GridBagConstraints.HORIZONTAL, 0, 5, 0, 0)); + // resource id + JPanel resourceIdConent = new JPanel(); + resourceIdConent.setLayout(new GridBagLayout()); + resourceIdConent.add(resourceIdLabel, GuiUtil.setConstraints(0, 0, 0, 0, GridBagConstraints.HORIZONTAL, 0, 0, 0, 5)); + resourceIdConent.add(resourceIdText, GuiUtil.setConstraints(1, 0, 1, 1, GridBagConstraints.HORIZONTAL, 0, 5, 0, 0)); - gmlIdPanel = new TitledPanel() - .withToggleButton(useGmlIdFilter) - .build(gmlIdConent); + resourceIdPanel = new TitledPanel() + .withToggleButton(useResourceIdFilter) + .build(resourceIdConent); - mainPanel.add(gmlIdPanel, GuiUtil.setConstraints(0, 2, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); + mainPanel.add(resourceIdPanel, GuiUtil.setConstraints(0, 2, 1, 0, GridBagConstraints.BOTH, 0, 0, 0, 0)); } { // bbox @@ -359,7 +359,7 @@ private void initGui() { add(scrollPane, GuiUtil.setConstraints(0, 1, 1, 1, GridBagConstraints.BOTH, 0, 0, 0, 0)); add(exportButton, GuiUtil.setConstraints(0, 2, 0, 0, GridBagConstraints.NONE, 10, 10, 10, 10)); - PopupMenuDecorator.getInstance().decorate(browseText, gmlIdText, tileSizeText, rowsText, columnsText, + PopupMenuDecorator.getInstance().decorate(browseText, resourceIdText, tileSizeText, rowsText, columnsText, footprintVisibleFromText, extrudedVisibleFromText, geometryVisibleFromText, colladaVisibleFromText, featureTree); PopupMenuDecorator.getInstance().decorateAndGetCheckBoxGroup(footprintCheckbox, extrudedCheckbox, @@ -380,13 +380,14 @@ private void updateComponentUI() { public void doTranslation() { browseButton.setText(Language.I18N.getString("common.button.browse")); - gmlIdPanel.setTitle(Language.I18N.getString("filter.border.attributes")); + resourceIdPanel.setTitle(Language.I18N.getString("filter.border.attributes")); bboxPanel.setTitle(Language.I18N.getString("filter.border.boundingBox")); tilingPanel.setTitle(Language.I18N.getString("pref.export.boundingBox.border.tiling")); manualTilingRadioButton.setText(Language.I18N.getString("pref.export.boundingBox.label.rows")); columnsLabel.setText(Language.I18N.getString("pref.export.boundingBox.label.columns")); automaticTilingRadioButton.setText(Language.I18N.getString("kmlExport.label.automatic")); + resourceIdLabel.setText(Language.I18N.getString("filter.label.id")); lodPanel.setTitle(Language.I18N.getString("kmlExport.label.fromLOD")); int selectedIndex = lodComboBox.getSelectedIndex(); @@ -422,7 +423,7 @@ public void loadSettings() { SimpleKmlQuery query = config.getKmlExportConfig().getQuery(); useFeatureFilter.setSelected(query.isUseTypeNames()); - useGmlIdFilter.setSelected(query.isUseGmlIdFilter()); + useResourceIdFilter.setSelected(query.isUseResourceIdFilter()); useBboxFilter.setSelected(query.isUseBboxFilter()); // feature type filter @@ -430,9 +431,9 @@ public void loadSettings() { featureTree.getCheckingModel().clearChecking(); featureTree.setSelected(featureTypeFilter.getTypeNames()); - // gml:id filter - ResourceIdOperator gmlIdFilter = query.getGmlIdFilter(); - gmlIdText.setText(String.join(",", gmlIdFilter.getResourceIds())); + // resource id filter + ResourceIdOperator resourceIdFilter = query.getResourceIdFilter(); + resourceIdText.setText(String.join(",", resourceIdFilter.getResourceIds())); // bbox filter KmlTiling spatialFilter = query.getSpatialFilter(); @@ -518,7 +519,7 @@ public void setSettings() { // filter SimpleKmlQuery query = config.getKmlExportConfig().getQuery(); - query.setUseGmlIdFilter(useGmlIdFilter.isSelected()); + query.setUseResourceIdFilter(useResourceIdFilter.isSelected()); query.setUseBboxFilter(useBboxFilter.isSelected()); query.setUseTypeNames(useFeatureFilter.isSelected()); @@ -527,12 +528,12 @@ public void setSettings() { featureTypeFilter.reset(); featureTypeFilter.setTypeNames(featureTree.getSelectedTypeNames()); - // gml:id filter - ResourceIdOperator gmlIdFilter = query.getGmlIdFilter(); - gmlIdFilter.reset(); - if (gmlIdText.getText().trim().length() > 0) { - String trimmed = gmlIdText.getText().replaceAll("\\s+", ""); - gmlIdFilter.setResourceIds(Util.string2string(trimmed, ",")); + // resource id filter + ResourceIdOperator resourceIdFilter = query.getResourceIdFilter(); + resourceIdFilter.reset(); + if (resourceIdText.getText().trim().length() > 0) { + String trimmed = resourceIdText.getText().replaceAll("\\s+", ""); + resourceIdFilter.setResourceIds(Util.string2string(trimmed, ",")); } // bbox filter @@ -628,7 +629,7 @@ protected Void doInBackground() { browseButton.addActionListener(e -> saveFile()); ActionListener filterListener = e -> setFilterEnabledValues(); - useGmlIdFilter.addActionListener(filterListener); + useResourceIdFilter.addActionListener(filterListener); useBboxFilter.addActionListener(filterListener); tilingCheckBox.addActionListener(filterListener); manualTilingRadioButton.addActionListener(filterListener); @@ -665,11 +666,11 @@ private void doExport() { return; } - // gmlId - if (query.isUseGmlIdFilter() - && !query.getGmlIdFilter().isSetResourceIds()) { + // resource id + if (query.isUseResourceIdFilter() + && !query.getResourceIdFilter().isSetResourceIds()) { viewController.errorMessage(Language.I18N.getString("export.dialog.error.incorrectData"), - Language.I18N.getString("common.dialog.error.incorrectData.gmlId")); + Language.I18N.getString("common.dialog.error.incorrectData.id")); return; } @@ -816,8 +817,8 @@ public void run() { } private void setFilterEnabledValues() { - gmlIdLabel.setEnabled(useGmlIdFilter.isSelected()); - gmlIdText.setEnabled(useGmlIdFilter.isSelected()); + resourceIdLabel.setEnabled(useResourceIdFilter.isSelected()); + resourceIdText.setEnabled(useResourceIdFilter.isSelected()); bboxComponent.setEnabled(useBboxFilter.isSelected()); automaticTilingRadioButton.setEnabled(tilingCheckBox.isSelected()); diff --git a/impexp-client/src/main/java/org/citydb/gui/modules/preferences/view/PreferencesPanel.java b/impexp-client/src/main/java/org/citydb/gui/modules/preferences/view/PreferencesPanel.java index 84ead8630..e35aa0b04 100644 --- a/impexp-client/src/main/java/org/citydb/gui/modules/preferences/view/PreferencesPanel.java +++ b/impexp-client/src/main/java/org/citydb/gui/modules/preferences/view/PreferencesPanel.java @@ -276,9 +276,10 @@ public boolean requestChange() { if (activeEntry.isModified()) { int res; if (config.getGuiConfig().isShowPreferencesConfirmDialog()) { - ConfirmationCheckDialog dialog = new ConfirmationCheckDialog(getTopLevelAncestor(), - Language.I18N.getString("pref.dialog.apply.title"), - Language.I18N.getString("pref.dialog.apply.msg")); + ConfirmationCheckDialog dialog = ConfirmationCheckDialog.defaults() + .withParentComponent(getTopLevelAncestor()) + .withTitle(Language.I18N.getString("pref.dialog.apply.title")) + .addMessage(Language.I18N.getString("pref.dialog.apply.msg")); res = dialog.show(); config.getGuiConfig().setShowPreferencesConfirmDialog(dialog.keepShowingDialog()); diff --git a/impexp-config/build.gradle b/impexp-config/build.gradle index c8b54772d..df601f310 100644 --- a/impexp-config/build.gradle +++ b/impexp-config/build.gradle @@ -3,7 +3,7 @@ plugins { } dependencies { - api 'org.citygml4j:citygml4j:2.11.2' + api 'org.citygml4j:citygml4j:2.11.3-b20210129.0027' } bintray { diff --git a/impexp-config/src/main/java/org/citydb/config/gui/GuiConfig.java b/impexp-config/src/main/java/org/citydb/config/gui/GuiConfig.java index 2f3950861..d2ead18bd 100644 --- a/impexp-config/src/main/java/org/citydb/config/gui/GuiConfig.java +++ b/impexp-config/src/main/java/org/citydb/config/gui/GuiConfig.java @@ -53,6 +53,7 @@ "showUnsupportedADEWarning", "showKmlExportUnsupportedADEWarning", "showChangeSridWarning", + "showCityJSONTilingWarning", "recentlyUsedProjects" }) public class GuiConfig { @@ -66,6 +67,7 @@ public class GuiConfig { private boolean showUnsupportedADEWarning = true; private boolean showKmlExportUnsupportedADEWarning = true; private boolean showChangeSridWarning = true; + private boolean showCityJSONTilingWarning = true; @XmlElementWrapper(name = "recentlyUsedProjects") @XmlElement(name = "fileName") private List recentlyUsedProjects; @@ -168,6 +170,14 @@ public void setShowChangeSridWarning(boolean showChangeSridWarning) { this.showChangeSridWarning = showChangeSridWarning; } + public boolean isShowCityJSONTilingWarning() { + return showCityJSONTilingWarning; + } + + public void setShowCityJSONTilingWarning(boolean showCityJSONTilingWarning) { + this.showCityJSONTilingWarning = showCityJSONTilingWarning; + } + public List getRecentlyUsedConfigFiles() { return recentlyUsedProjects; } diff --git a/impexp-config/src/main/java/org/citydb/config/project/exporter/CityGMLOptions.java b/impexp-config/src/main/java/org/citydb/config/project/exporter/CityGMLOptions.java index 6c175c1a8..3d76b6d45 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/exporter/CityGMLOptions.java +++ b/impexp-config/src/main/java/org/citydb/config/project/exporter/CityGMLOptions.java @@ -28,34 +28,28 @@ package org.citydb.config.project.exporter; +import org.citydb.config.project.common.XSLTransformation; + +import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; -@XmlType(name = "CityGMLOptionsType", propOrder = { - "fileEncoding", - "writeProductHeader", - "gmlEnvelope", - "namespaces" -}) +@XmlType(name = "CityGMLExportOptionsType", propOrder = {}) public class CityGMLOptions { - private String fileEncoding; private Boolean writeProductHeader; - private GMLEnvelope gmlEnvelope; + @XmlElement(defaultValue = "true") + private boolean prettyPrint = true; @XmlJavaTypeAdapter(NamespaceAdapter.class) private LinkedHashMap namespaces; + private XLink xlink; + private XSLTransformation xslTransformation; public CityGMLOptions() { - gmlEnvelope = new GMLEnvelope(); - } - - public String getFileEncoding() { - return fileEncoding != null ? fileEncoding : "UTF-8"; - } - - public void setFileEncoding(String fileEncoding) { - this.fileEncoding = fileEncoding; + xlink = new XLink(); + xslTransformation = new XSLTransformation(); } public boolean isWriteProductHeader() { @@ -66,12 +60,12 @@ public void setWriteProductHeader(Boolean writeProductHeader) { this.writeProductHeader = writeProductHeader; } - public GMLEnvelope getGMLEnvelope() { - return gmlEnvelope; + public boolean isPrettyPrint() { + return prettyPrint; } - public void setGMLEnvelope(GMLEnvelope gmlEnvelope) { - this.gmlEnvelope = gmlEnvelope; + public void setPrettyPrint(boolean prettyPrint) { + this.prettyPrint = prettyPrint; } public boolean isSetNamespaces() { @@ -85,4 +79,34 @@ public Namespace getNamespace(String uri) { public Map getNamespaces() { return namespaces; } + + public void setNamespaces(List namespaces) { + if (this.namespaces == null) { + this.namespaces = new LinkedHashMap<>(); + } + + namespaces.stream() + .filter(Namespace::isSetURI) + .forEach(v -> this.namespaces.put(v.getURI(), v)); + } + + public XLink getXlink() { + return xlink; + } + + public void setXlink(XLink xlink) { + if (xlink != null) { + this.xlink = xlink; + } + } + + public XSLTransformation getXSLTransformation() { + return xslTransformation; + } + + public void setXSLTransformation(XSLTransformation xslTransformation) { + if (xslTransformation != null) { + this.xslTransformation = xslTransformation; + } + } } diff --git a/impexp-config/src/main/java/org/citydb/config/project/exporter/CityJSONOptions.java b/impexp-config/src/main/java/org/citydb/config/project/exporter/CityJSONOptions.java new file mode 100644 index 000000000..0e3443ae9 --- /dev/null +++ b/impexp-config/src/main/java/org/citydb/config/project/exporter/CityJSONOptions.java @@ -0,0 +1,103 @@ +/* + * 3D City Database - The Open Source CityGML Database + * http://www.3dcitydb.org/ + * + * Copyright 2013 - 2019 + * Chair of Geoinformatics + * Technical University of Munich, Germany + * https://www.gis.bgu.tum.de/ + * + * The 3D City Database is jointly developed with the following + * cooperation partners: + * + * virtualcitySYSTEMS GmbH, Berlin + * M.O.S.S. Computer Grafik Systeme GmbH, Taufkirchen + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.citydb.config.project.exporter; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + +@XmlType(name = "CityJSONExportOptionsType", propOrder = {}) +public class CityJSONOptions { + @XmlElement(defaultValue = "false") + private boolean prettyPrint; + @XmlElement(defaultValue = "3") + @XmlSchemaType(name = "positiveInteger") + private int significantDigits = 3; + @XmlElement(defaultValue = "7") + @XmlSchemaType(name = "positiveInteger") + private int significantTextureDigits = 7; + @XmlElement(defaultValue = "true") + private boolean useGeometryCompression = true; + @XmlElement(defaultValue = "false") + private boolean addSequenceIdWhenSorting; + @XmlElement(defaultValue = "false") + private boolean removeDuplicateChildGeometries; + + public boolean isPrettyPrint() { + return prettyPrint; + } + + public void setPrettyPrint(boolean prettyPrint) { + this.prettyPrint = prettyPrint; + } + + public int getSignificantDigits() { + return significantDigits; + } + + public void setSignificantDigits(int significantDigits) { + if (significantDigits > 0) { + this.significantDigits = significantDigits; + } + } + + public int getSignificantTextureDigits() { + return significantTextureDigits; + } + + public void setSignificantTextureDigits(int significantTextureDigits) { + if (significantTextureDigits > 0) { + this.significantTextureDigits = significantTextureDigits; + } + } + + public boolean isUseGeometryCompression() { + return useGeometryCompression; + } + + public void setUseGeometryCompression(boolean useGeometryCompression) { + this.useGeometryCompression = useGeometryCompression; + } + + public boolean isAddSequenceIdWhenSorting() { + return addSequenceIdWhenSorting; + } + + public void setAddSequenceIdWhenSorting(boolean addSequenceIdWhenSorting) { + this.addSequenceIdWhenSorting = addSequenceIdWhenSorting; + } + + public boolean isRemoveDuplicateChildGeometries() { + return removeDuplicateChildGeometries; + } + + public void setRemoveDuplicateChildGeometries(boolean removeDuplicateChildGeometries) { + this.removeDuplicateChildGeometries = removeDuplicateChildGeometries; + } +} diff --git a/impexp-config/src/main/java/org/citydb/config/project/exporter/CityModelEnvelopeMode.java b/impexp-config/src/main/java/org/citydb/config/project/exporter/CityModelEnvelopeMode.java index 10d01f9d3..1a71eb5fd 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/exporter/CityModelEnvelopeMode.java +++ b/impexp-config/src/main/java/org/citydb/config/project/exporter/CityModelEnvelopeMode.java @@ -9,21 +9,21 @@ public class CityModelEnvelopeMode { @XmlAttribute private Boolean useTileExtent; @XmlValue - private Boolean useEnvelope; + private boolean enabled; public boolean isUseTileExtent() { return useTileExtent != null ? useTileExtent : false; } - public void setUseTileExtent(boolean useTileExtent) { + public void setUseTileExtent(Boolean useTileExtent) { this.useTileExtent = useTileExtent; } - public boolean isUseEnvelope() { - return useEnvelope != null ? useEnvelope : false; + public boolean isEnabled() { + return enabled; } - public void setUseEnvelope(boolean useEnvelope) { - this.useEnvelope = useEnvelope; + public void setEnabled(boolean enabled) { + this.enabled = enabled; } } diff --git a/impexp-config/src/main/java/org/citydb/config/project/exporter/ExportConfig.java b/impexp-config/src/main/java/org/citydb/config/project/exporter/ExportConfig.java index b0fa9c8c3..6c0d3360e 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/exporter/ExportConfig.java +++ b/impexp-config/src/main/java/org/citydb/config/project/exporter/ExportConfig.java @@ -28,11 +28,11 @@ package org.citydb.config.project.exporter; import org.citydb.config.project.common.Path; -import org.citydb.config.project.common.XSLTransformation; import org.citydb.config.project.query.QueryConfig; import org.citydb.config.project.resources.Resources; import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; @@ -41,14 +41,14 @@ "query", "simpleQuery", "path", + "generalOptions", "continuation", "cityObjectGroup", "address", "appearances", - "xlink", - "xslTransformation", "metadataProvider", "cityGMLOptions", + "cityJSONOptions", "resources" }) public class ExportConfig { @@ -57,27 +57,28 @@ public class ExportConfig { private QueryConfig query; private SimpleQuery simpleQuery; private Path path; + @XmlElement(name = "general") + private GeneralOptions generalOptions; private Continuation continuation; private ExportCityObjectGroup cityObjectGroup; private ExportAddress address; private ExportAppearance appearances; - private XLink xlink; - private XSLTransformation xslTransformation; private String metadataProvider; private CityGMLOptions cityGMLOptions; + private CityJSONOptions cityJSONOptions; private Resources resources; public ExportConfig() { query = new QueryConfig(); simpleQuery = new SimpleQuery(); path = new Path(); + generalOptions = new GeneralOptions(); continuation = new Continuation(); cityObjectGroup = new ExportCityObjectGroup(); address = new ExportAddress(); appearances = new ExportAppearance(); - xlink = new XLink(); - xslTransformation = new XSLTransformation(); cityGMLOptions = new CityGMLOptions(); + cityJSONOptions = new CityJSONOptions(); resources = new Resources(); } @@ -94,8 +95,9 @@ public QueryConfig getQuery() { } public void setQuery(QueryConfig query) { - if (query != null) + if (query != null) { this.query = query; + } } public SimpleQuery getSimpleQuery() { @@ -103,8 +105,9 @@ public SimpleQuery getSimpleQuery() { } public void setSimpleQuery(SimpleQuery query) { - if (query != null) + if (query != null) { this.simpleQuery = query; + } } public Path getPath() { @@ -112,8 +115,19 @@ public Path getPath() { } public void setPath(Path path) { - if (path != null) + if (path != null) { this.path = path; + } + } + + public GeneralOptions getGeneralOptions() { + return generalOptions; + } + + public void setGeneralOptions(GeneralOptions generalOptions) { + if (generalOptions != null) { + this.generalOptions = generalOptions; + } } public Continuation getContinuation() { @@ -121,8 +135,9 @@ public Continuation getContinuation() { } public void setContinuation(Continuation continuation) { - if (continuation != null) + if (continuation != null) { this.continuation = continuation; + } } public ExportAddress getAddress() { @@ -130,8 +145,9 @@ public ExportAddress getAddress() { } public void setAddress(ExportAddress address) { - if (address != null) + if (address != null) { this.address = address; + } } public ExportAppearance getAppearances() { @@ -139,8 +155,9 @@ public ExportAppearance getAppearances() { } public void setAppearances(ExportAppearance appearances) { - if (appearances != null) + if (appearances != null) { this.appearances = appearances; + } } public ExportCityObjectGroup getCityObjectGroup() { @@ -148,26 +165,9 @@ public ExportCityObjectGroup getCityObjectGroup() { } public void setCityObjectGroup(ExportCityObjectGroup cityObjectGroup) { - if (cityObjectGroup != null) + if (cityObjectGroup != null) { this.cityObjectGroup = cityObjectGroup; - } - - public XLink getXlink() { - return xlink; - } - - public void setXlink(XLink xlink) { - if (xlink != null) - this.xlink = xlink; - } - - public XSLTransformation getXSLTransformation() { - return xslTransformation; - } - - public void setXSLTransformation(XSLTransformation xslTransformation) { - if (xslTransformation != null) - this.xslTransformation = xslTransformation; + } } public boolean isSetMetadataProvider() { @@ -187,8 +187,19 @@ public CityGMLOptions getCityGMLOptions() { } public void setCityGMLOptions(CityGMLOptions cityGMLOptions) { - if (cityGMLOptions != null) + if (cityGMLOptions != null) { this.cityGMLOptions = cityGMLOptions; + } + } + + public CityJSONOptions getCityJSONOptions() { + return cityJSONOptions; + } + + public void setCityJSONOptions(CityJSONOptions cityJSONOptions) { + if (cityJSONOptions != null) { + this.cityJSONOptions = cityJSONOptions; + } } public Resources getResources() { @@ -196,8 +207,9 @@ public Resources getResources() { } public void setResources(Resources system) { - if (system != null) + if (system != null) { this.resources = system; + } } } diff --git a/impexp-config/src/main/java/org/citydb/config/project/exporter/GMLEnvelope.java b/impexp-config/src/main/java/org/citydb/config/project/exporter/ExportEnvelope.java similarity index 58% rename from impexp-config/src/main/java/org/citydb/config/project/exporter/GMLEnvelope.java rename to impexp-config/src/main/java/org/citydb/config/project/exporter/ExportEnvelope.java index 181357513..c61aa8588 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/exporter/GMLEnvelope.java +++ b/impexp-config/src/main/java/org/citydb/config/project/exporter/ExportEnvelope.java @@ -28,37 +28,43 @@ package org.citydb.config.project.exporter; +import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; -@XmlType(name = "GMLEnvelopeType", propOrder = { - "cityModel", - "features" +@XmlType(name = "ExportEnvelopeType", propOrder = { + "featureMode", + "cityModel" }) -public class GMLEnvelope { +public class ExportEnvelope { + @XmlElement(name = "features") + private FeatureEnvelopeMode featureMode = FeatureEnvelopeMode.TOP_LEVEL; private CityModelEnvelopeMode cityModel; - private FeatureEnvelopeMode features = FeatureEnvelopeMode.TOP_LEVEL; - public boolean isSetCityModelEnvelopeMode() { - return cityModel != null; + public ExportEnvelope() { + cityModel = new CityModelEnvelopeMode(); } - public CityModelEnvelopeMode getCityModelEnvelopeMode() { - return cityModel; + public FeatureEnvelopeMode getFeatureMode() { + return featureMode != null ? featureMode : FeatureEnvelopeMode.TOP_LEVEL; } - public void setCityModelEnvelopeMode(CityModelEnvelopeMode mode) { - this.cityModel = mode; + public void setFeatureMode(FeatureEnvelopeMode featureMode) { + this.featureMode = featureMode; } public boolean isUseEnvelopeOnCityModel() { - return cityModel != null && cityModel.isUseEnvelope(); + return cityModel.isEnabled(); } - public FeatureEnvelopeMode getFeatureMode() { - return features; + public void setUseEnvelopeOnCityModel(boolean useEnvelope) { + cityModel.setEnabled(useEnvelope); + } + + public boolean isUseTileExtentForCityModel() { + return cityModel.isUseTileExtent(); } - public void setFeatureMode(FeatureEnvelopeMode mode) { - this.features = mode; + public void setUseTileExtentForCityModel(boolean useTileExtent) { + cityModel.setUseTileExtent(useTileExtent); } } diff --git a/impexp-config/src/main/java/org/citydb/config/project/exporter/FeatureEnvelopeMode.java b/impexp-config/src/main/java/org/citydb/config/project/exporter/FeatureEnvelopeMode.java index 44bbf03df..17a078dd7 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/exporter/FeatureEnvelopeMode.java +++ b/impexp-config/src/main/java/org/citydb/config/project/exporter/FeatureEnvelopeMode.java @@ -35,12 +35,12 @@ @XmlType(name = "FeatureEnvelopeModeType") @XmlEnum public enum FeatureEnvelopeMode { - @XmlEnumValue("none") - NONE("none"), @XmlEnumValue("top-level") TOP_LEVEL("top-level"), @XmlEnumValue("all") - ALL("all"); + ALL("all"), + @XmlEnumValue("none") + NONE("none"); private final String value; diff --git a/impexp-config/src/main/java/org/citydb/config/project/exporter/GeneralOptions.java b/impexp-config/src/main/java/org/citydb/config/project/exporter/GeneralOptions.java new file mode 100644 index 000000000..8698030ea --- /dev/null +++ b/impexp-config/src/main/java/org/citydb/config/project/exporter/GeneralOptions.java @@ -0,0 +1,45 @@ +package org.citydb.config.project.exporter; + +import javax.xml.bind.annotation.XmlType; +import java.nio.charset.StandardCharsets; + +@XmlType(name="GeneralExportOptionsType", propOrder={}) +public class GeneralOptions { + private String fileEncoding; + private OutputFormat compressedOutputFormat = OutputFormat.CITYGML; + private ExportEnvelope envelope; + + public GeneralOptions() { + envelope = new ExportEnvelope(); + } + + public boolean isSetFileEncoding() { + return fileEncoding != null; + } + + public String getFileEncoding() { + return fileEncoding != null ? fileEncoding : StandardCharsets.UTF_8.name(); + } + + public void setFileEncoding(String fileEncoding) { + this.fileEncoding = fileEncoding; + } + + public OutputFormat getCompressedOutputFormat() { + return compressedOutputFormat != null ? compressedOutputFormat : OutputFormat.CITYGML; + } + + public void setCompressedOutputFormat(OutputFormat compressedOutputFormat) { + this.compressedOutputFormat = compressedOutputFormat; + } + + public ExportEnvelope getEnvelope() { + return envelope; + } + + public void setEnvelope(ExportEnvelope envelope) { + if (envelope != null) { + this.envelope = envelope; + } + } +} diff --git a/impexp-config/src/main/java/org/citydb/config/project/importer/ImportAddress.java b/impexp-config/src/main/java/org/citydb/config/project/exporter/OutputFormat.java similarity index 67% rename from impexp-config/src/main/java/org/citydb/config/project/importer/ImportAddress.java rename to impexp-config/src/main/java/org/citydb/config/project/exporter/OutputFormat.java index fc3095a4b..4f8ee2a56 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/importer/ImportAddress.java +++ b/impexp-config/src/main/java/org/citydb/config/project/exporter/OutputFormat.java @@ -25,27 +25,32 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.config.project.importer; +package org.citydb.config.project.exporter; -import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; -@XmlType(name = "ImportXALType", propOrder = { - "importXAL" -}) -public class ImportAddress { - @XmlElement(defaultValue = "true") - private Boolean importXAL = true; +@XmlType(name = "OutputFormatType") +@XmlEnum +public enum OutputFormat { + @XmlEnumValue("CityGML") + CITYGML("CityGML"), + @XmlEnumValue("CityJSON") + CITYJSON("CityJSON"); - public boolean isSetImportXAL() { - return importXAL != null? importXAL : false; + private final String value; + + OutputFormat(String v) { + value = v; } - public Boolean getImportXAL() { - return importXAL; + public String value() { + return value; } - public void setImportXAL(Boolean importXAL) { - this.importXAL = importXAL; + @Override + public String toString() { + return value; } } diff --git a/impexp-config/src/main/java/org/citydb/config/project/importer/CityGMLOptions.java b/impexp-config/src/main/java/org/citydb/config/project/importer/CityGMLOptions.java new file mode 100644 index 000000000..5b855d870 --- /dev/null +++ b/impexp-config/src/main/java/org/citydb/config/project/importer/CityGMLOptions.java @@ -0,0 +1,47 @@ +package org.citydb.config.project.importer; + +import org.citydb.config.project.common.XSLTransformation; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlType(name = "CityGMLImportOptionsType", propOrder = {}) +public class CityGMLOptions { + @XmlElement(defaultValue = "true") + private boolean importXalAddress = true; + private XMLValidation xmlValidation; + private XSLTransformation xslTransformation; + + public CityGMLOptions() { + xmlValidation = new XMLValidation(); + xslTransformation = new XSLTransformation(); + } + + public boolean isImportXalAddress() { + return importXalAddress; + } + + public void setImportXalAddress(boolean importXalAddress) { + this.importXalAddress = importXalAddress; + } + + public XMLValidation getXMLValidation() { + return xmlValidation; + } + + public void setXMLValidation(XMLValidation xmlValidation) { + if (xmlValidation != null) { + this.xmlValidation = xmlValidation; + } + } + + public XSLTransformation getXSLTransformation() { + return xslTransformation; + } + + public void setXSLTransformation(XSLTransformation xslTransformation) { + if (xslTransformation != null) { + this.xslTransformation = xslTransformation; + } + } +} diff --git a/impexp-config/src/main/java/org/citydb/config/project/importer/CityJSONOptions.java b/impexp-config/src/main/java/org/citydb/config/project/importer/CityJSONOptions.java new file mode 100644 index 000000000..235e6ea84 --- /dev/null +++ b/impexp-config/src/main/java/org/citydb/config/project/importer/CityJSONOptions.java @@ -0,0 +1,18 @@ +package org.citydb.config.project.importer; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlType(name = "CityJSONImportOptionsType", propOrder = {}) +public class CityJSONOptions { + @XmlElement(defaultValue = "false") + private boolean mapUnknownExtensions; + + public boolean isMapUnknownExtensions() { + return mapUnknownExtensions; + } + + public void setMapUnknownExtensions(boolean mapUnknownExtensions) { + this.mapUnknownExtensions = mapUnknownExtensions; + } +} diff --git a/impexp-config/src/main/java/org/citydb/config/project/importer/GeneralOptions.java b/impexp-config/src/main/java/org/citydb/config/project/importer/GeneralOptions.java new file mode 100644 index 000000000..ab6cdf966 --- /dev/null +++ b/impexp-config/src/main/java/org/citydb/config/project/importer/GeneralOptions.java @@ -0,0 +1,21 @@ +package org.citydb.config.project.importer; + +import javax.xml.bind.annotation.XmlType; +import java.nio.charset.StandardCharsets; + +@XmlType(name="GeneralImportOptionsType", propOrder={}) +public class GeneralOptions { + private String fileEncoding; + + public boolean isSetFileEncoding() { + return fileEncoding != null; + } + + public String getFileEncoding() { + return fileEncoding != null ? fileEncoding : StandardCharsets.UTF_8.name(); + } + + public void setFileEncoding(String fileEncoding) { + this.fileEncoding = fileEncoding; + } +} diff --git a/impexp-config/src/main/java/org/citydb/config/project/importer/ImportConfig.java b/impexp-config/src/main/java/org/citydb/config/project/importer/ImportConfig.java index 765ef78e6..f13078d15 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/importer/ImportConfig.java +++ b/impexp-config/src/main/java/org/citydb/config/project/importer/ImportConfig.java @@ -27,25 +27,25 @@ */ package org.citydb.config.project.importer; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - import org.citydb.config.project.common.AffineTransformation; import org.citydb.config.project.common.Path; -import org.citydb.config.project.common.XSLTransformation; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; @XmlRootElement(name = "import") @XmlType(name = "ImportType", propOrder = { "filter", "continuation", "path", - "gmlId", - "address", + "generalOptions", + "resourceId", "appearances", "affineTransformation", + "cityGMLOptions", + "cityJSONOptions", "indexes", - "xmlValidation", - "xslTransformation", "importLog", "resources" }) @@ -53,27 +53,28 @@ public class ImportConfig { private ImportFilter filter; private Continuation continuation; private Path path; - private ImportGmlId gmlId; - private ImportAddress address; + @XmlElement(name = "general") + private GeneralOptions generalOptions; + private ImportResourceId resourceId; private ImportAppearance appearances; private AffineTransformation affineTransformation; + private CityGMLOptions cityGMLOptions; + private CityJSONOptions cityJSONOptions; private Index indexes; - private XMLValidation xmlValidation; - private XSLTransformation xslTransformation; private ImportLog importLog; private ImportResources resources; public ImportConfig() { continuation = new Continuation(); path = new Path(); - gmlId = new ImportGmlId(); - address = new ImportAddress(); + generalOptions = new GeneralOptions(); + resourceId = new ImportResourceId(); appearances = new ImportAppearance(); filter = new ImportFilter(); affineTransformation = new AffineTransformation(); + cityGMLOptions = new CityGMLOptions(); + cityJSONOptions = new CityJSONOptions(); indexes = new Index(); - xmlValidation = new XMLValidation(); - xslTransformation = new XSLTransformation(); importLog = new ImportLog(); resources = new ImportResources(); } @@ -83,8 +84,9 @@ public Continuation getContinuation() { } public void setContinuation(Continuation continuation) { - if (continuation != null) + if (continuation != null) { this.continuation = continuation; + } } public Path getPath() { @@ -92,26 +94,29 @@ public Path getPath() { } public void setPath(Path path) { - if (path != null) + if (path != null) { this.path = path; + } } - public ImportGmlId getGmlId() { - return gmlId; + public GeneralOptions getGeneralOptions() { + return generalOptions; } - public void setGmlId(ImportGmlId gmlId) { - if (gmlId != null) - this.gmlId = gmlId; + public void setGeneralOptions(GeneralOptions generalOptions) { + if (generalOptions != null) { + this.generalOptions = generalOptions; + } } - public ImportAddress getAddress() { - return address; + public ImportResourceId getResourceId() { + return resourceId; } - public void setAddress(ImportAddress address) { - if (address != null) - this.address = address; + public void setResourceId(ImportResourceId resourceId) { + if (resourceId != null) { + this.resourceId = resourceId; + } } public ImportAppearance getAppearances() { @@ -119,8 +124,9 @@ public ImportAppearance getAppearances() { } public void setAppearances(ImportAppearance appearances) { - if (appearances != null) + if (appearances != null) { this.appearances = appearances; + } } public ImportFilter getFilter() { @@ -128,8 +134,9 @@ public ImportFilter getFilter() { } public void setFilter(ImportFilter filter) { - if (filter != null) + if (filter != null) { this.filter = filter; + } } public Index getIndexes() { @@ -137,35 +144,39 @@ public Index getIndexes() { } public void setIndexes(Index indexes) { - if (indexes != null) + if (indexes != null) { this.indexes = indexes; + } } - public XMLValidation getXMLValidation() { - return xmlValidation; + public AffineTransformation getAffineTransformation() { + return affineTransformation; } - public void setXMLValidation(XMLValidation xmlValidation) { - if (xmlValidation != null) - this.xmlValidation = xmlValidation; + public void setAffineTransformation(AffineTransformation affineTransformation) { + if (affineTransformation != null) { + this.affineTransformation = affineTransformation; + } } - public XSLTransformation getXSLTransformation() { - return xslTransformation; + public CityGMLOptions getCityGMLOptions() { + return cityGMLOptions; } - public void setXSLTransformation(XSLTransformation xslTransformation) { - if (xslTransformation != null) - this.xslTransformation = xslTransformation; + public void setCityGMLOptions(CityGMLOptions cityGMLOptions) { + if (cityGMLOptions != null) { + this.cityGMLOptions = cityGMLOptions; + } } - public AffineTransformation getAffineTransformation() { - return affineTransformation; + public CityJSONOptions getCityJSONOptions() { + return cityJSONOptions; } - public void setAffineTransformation(AffineTransformation affineTransformation) { - if (affineTransformation != null) - this.affineTransformation = affineTransformation; + public void setCityJSONOptions(CityJSONOptions cityJSONOptions) { + if (cityJSONOptions != null) { + this.cityJSONOptions = cityJSONOptions; + } } public ImportLog getImportLog() { @@ -173,8 +184,9 @@ public ImportLog getImportLog() { } public void setImportLog(ImportLog importLog) { - if (importLog != null) + if (importLog != null) { this.importLog = importLog; + } } public ImportResources getResources() { @@ -182,8 +194,9 @@ public ImportResources getResources() { } public void setResources(ImportResources resources) { - if (resources != null) + if (resources != null) { this.resources = resources; + } } } diff --git a/impexp-config/src/main/java/org/citydb/config/project/importer/ImportGmlId.java b/impexp-config/src/main/java/org/citydb/config/project/importer/ImportResourceId.java similarity index 82% rename from impexp-config/src/main/java/org/citydb/config/project/importer/ImportGmlId.java rename to impexp-config/src/main/java/org/citydb/config/project/importer/ImportResourceId.java index a9397b9c1..bfa19ad5f 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/importer/ImportGmlId.java +++ b/impexp-config/src/main/java/org/citydb/config/project/importer/ImportResourceId.java @@ -30,26 +30,26 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; -@XmlType(name = "ImportGmlIdType", propOrder = { +@XmlType(name = "ImportResourceIdType", propOrder = { "uuidMode", "idPrefix", - "keepGmlIdAsExternalReference", + "keepIdAsExternalReference", "codeSpaceMode", "codeSpace" }) -public class ImportGmlId { +public class ImportResourceId { @XmlElement(required = true) private UUIDMode uuidMode = UUIDMode.COMPLEMENT; @XmlElement(defaultValue = "ID_") private String idPrefix = "ID_"; @XmlElement(defaultValue = "true") - private Boolean keepGmlIdAsExternalReference = true; + private Boolean keepIdAsExternalReference = true; @XmlElement(required = true) private CodeSpaceMode codeSpaceMode = CodeSpaceMode.NONE; @XmlElement(defaultValue = "ID") private String codeSpace = "ID"; - public ImportGmlId() { + public ImportResourceId() { } public boolean isUUIDModeReplace() { @@ -76,16 +76,16 @@ public void setIdPrefix(String idPrefix) { this.idPrefix = idPrefix; } - public boolean isSetKeepGmlIdAsExternalReference() { - return keepGmlIdAsExternalReference != null ? keepGmlIdAsExternalReference : false; + public boolean isSetKeepIdAsExternalReference() { + return keepIdAsExternalReference != null ? keepIdAsExternalReference : false; } - public Boolean getKeepGmlIdAsExternalReference() { - return keepGmlIdAsExternalReference; + public Boolean getKeepIdAsExternalReference() { + return keepIdAsExternalReference; } - public void setKeepGmlIdAsExternalReference(Boolean keepGmlIdAsExternalReference) { - this.keepGmlIdAsExternalReference = keepGmlIdAsExternalReference; + public void setKeepIdAsExternalReference(Boolean keepIdAsExternalReference) { + this.keepIdAsExternalReference = keepIdAsExternalReference; } public boolean isSetNoneCodeSpaceMode() { diff --git a/impexp-config/src/main/java/org/citydb/config/project/importer/ImportResources.java b/impexp-config/src/main/java/org/citydb/config/project/importer/ImportResources.java index f73b892b2..b9791427a 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/importer/ImportResources.java +++ b/impexp-config/src/main/java/org/citydb/config/project/importer/ImportResources.java @@ -31,24 +31,24 @@ import javax.xml.bind.annotation.XmlType; import org.citydb.config.project.resources.Resources; -import org.citydb.config.project.resources.UIDCacheConfig; +import org.citydb.config.project.resources.IdCacheConfig; @XmlType(name = "ImportResourcesType", propOrder = { "texImageCache" }) public class ImportResources extends Resources { @XmlElement(required = true) - private UIDCacheConfig texImageCache; + private IdCacheConfig texImageCache; public ImportResources() { - texImageCache = new UIDCacheConfig(); + texImageCache = new IdCacheConfig(); } - public UIDCacheConfig getTexImageCache() { + public IdCacheConfig getTexImageCache() { return texImageCache; } - public void setTexImageCache(UIDCacheConfig texImageCache) { + public void setTexImageCache(IdCacheConfig texImageCache) { this.texImageCache = texImageCache; } } diff --git a/impexp-config/src/main/java/org/citydb/config/project/kmlExporter/SimpleKmlQuery.java b/impexp-config/src/main/java/org/citydb/config/project/kmlExporter/SimpleKmlQuery.java index cbda29944..93eb604f0 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/kmlExporter/SimpleKmlQuery.java +++ b/impexp-config/src/main/java/org/citydb/config/project/kmlExporter/SimpleKmlQuery.java @@ -36,27 +36,27 @@ @XmlType(name = "SimpleKmlExportQueryType", propOrder = { "featureTypeFilter", - "gmlIdFilter", + "resourceIdFilter", "spatialFilter" }) public class SimpleKmlQuery { @XmlAttribute private boolean useTypeNames; @XmlAttribute - private boolean useGmlIdFilter; + private boolean useResourceIdFilter; @XmlAttribute private boolean useBboxFilter; @XmlElement(name = "typeNames") protected FeatureTypeFilter featureTypeFilter; - @XmlElement(name = "gmlIds") - private ResourceIdOperator gmlIdFilter; + @XmlElement(name = "resourceIds") + private ResourceIdOperator resourceIdFilter; @XmlElement(name = "bbox", required = true) private KmlTiling spatialFilter; public SimpleKmlQuery() { featureTypeFilter = new FeatureTypeFilter(); - gmlIdFilter = new ResourceIdOperator(); + resourceIdFilter = new ResourceIdOperator(); spatialFilter = new KmlTiling(); } @@ -80,24 +80,24 @@ public void setFeatureTypeFilter(FeatureTypeFilter featureTypeFilter) { this.featureTypeFilter = featureTypeFilter; } - public boolean isUseGmlIdFilter() { - return useGmlIdFilter; + public boolean isUseResourceIdFilter() { + return useResourceIdFilter; } - public void setUseGmlIdFilter(boolean useGmlIdFilter) { - this.useGmlIdFilter = useGmlIdFilter; + public void setUseResourceIdFilter(boolean useResourceIdFilter) { + this.useResourceIdFilter = useResourceIdFilter; } - public ResourceIdOperator getGmlIdFilter() { - return gmlIdFilter; + public ResourceIdOperator getResourceIdFilter() { + return resourceIdFilter; } - public boolean isSetGmlIdFilter() { - return gmlIdFilter != null; + public boolean isSetResourceIdFilter() { + return resourceIdFilter != null; } - public void setGmlIdFilter(ResourceIdOperator gmlIdFilter) { - this.gmlIdFilter = gmlIdFilter; + public void setResourceIdFilter(ResourceIdOperator resourceIdFilter) { + this.resourceIdFilter = resourceIdFilter; } public boolean isUseBboxFilter() { diff --git a/impexp-config/src/main/java/org/citydb/config/project/query/filter/version/CityGMLVersionType.java b/impexp-config/src/main/java/org/citydb/config/project/query/filter/version/CityGMLVersionType.java index 76d902c7e..7ef7c823d 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/query/filter/version/CityGMLVersionType.java +++ b/impexp-config/src/main/java/org/citydb/config/project/query/filter/version/CityGMLVersionType.java @@ -35,7 +35,7 @@ @XmlEnum public enum CityGMLVersionType { @XmlEnumValue("2.0.0") - v2_0_0("v2.0.0 (OGC Encoding Standard)"), + v2_0_0("v2.0.0"), @XmlEnumValue("1.0.0") v1_0_0("v1.0.0"); diff --git a/impexp-config/src/main/java/org/citydb/config/project/query/simple/SimpleAttributeFilter.java b/impexp-config/src/main/java/org/citydb/config/project/query/simple/SimpleAttributeFilter.java index e76b9387f..4f50a96df 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/query/simple/SimpleAttributeFilter.java +++ b/impexp-config/src/main/java/org/citydb/config/project/query/simple/SimpleAttributeFilter.java @@ -34,46 +34,46 @@ import javax.xml.bind.annotation.XmlType; @XmlType(name = "SimpleAttributeFilterType", propOrder = { - "gmlIdFilter", - "gmlNameFilter", + "resourceIdFilter", + "nameFilter", "lineageFilter" }) public class SimpleAttributeFilter { - @XmlElement(name = "gmlIds") - private ResourceIdOperator gmlIdFilter; - @XmlElement(name = "gmlName") - private LikeOperator gmlNameFilter; + @XmlElement(name = "resourceIds") + private ResourceIdOperator resourceIdFilter; + @XmlElement(name = "name") + private LikeOperator nameFilter; @XmlElement(name = "lineage") private LikeOperator lineageFilter; public SimpleAttributeFilter() { - gmlIdFilter = new ResourceIdOperator(); - gmlNameFilter = new LikeOperator(); + resourceIdFilter = new ResourceIdOperator(); + nameFilter = new LikeOperator(); lineageFilter = new LikeOperator(); } - public ResourceIdOperator getGmlIdFilter() { - return gmlIdFilter; + public ResourceIdOperator getResourceIdFilter() { + return resourceIdFilter; } - public boolean isSetGmlIdFilter() { - return gmlIdFilter != null; + public boolean isSetResourceIdFilter() { + return resourceIdFilter != null; } - public void setGmlIdFilter(ResourceIdOperator gmlIdFilter) { - this.gmlIdFilter = gmlIdFilter; + public void setResourceIdFilter(ResourceIdOperator resourceIdFilter) { + this.resourceIdFilter = resourceIdFilter; } - public LikeOperator getGmlNameFilter() { - return gmlNameFilter; + public LikeOperator getNameFilter() { + return nameFilter; } - public boolean isSetGmlNameFilter() { - return gmlNameFilter != null; + public boolean isSetNameFilter() { + return nameFilter != null; } - public void setGmlNameFilter(LikeOperator gmlNameFilter) { - this.gmlNameFilter = gmlNameFilter; + public void setNameFilter(LikeOperator nameFilter) { + this.nameFilter = nameFilter; } public LikeOperator getLineageFilter() { diff --git a/impexp-config/src/main/java/org/citydb/config/project/resources/UIDCache.java b/impexp-config/src/main/java/org/citydb/config/project/resources/IdCache.java similarity index 77% rename from impexp-config/src/main/java/org/citydb/config/project/resources/UIDCache.java rename to impexp-config/src/main/java/org/citydb/config/project/resources/IdCache.java index aaf944292..85592cb4b 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/resources/UIDCache.java +++ b/impexp-config/src/main/java/org/citydb/config/project/resources/IdCache.java @@ -30,35 +30,35 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; -@XmlType(name = "UIDCacheType", propOrder = { +@XmlType(name = "IdCacheType", propOrder = { "feature", "geometry" }) -public class UIDCache { +public class IdCache { @XmlElement(required = true) - private UIDCacheConfig feature; + private IdCacheConfig feature; @XmlElement(required = true) - private UIDCacheConfig geometry; + private IdCacheConfig geometry; - public UIDCache() { - feature = new UIDCacheConfig(); - geometry = new UIDCacheConfig(); + public IdCache() { + feature = new IdCacheConfig(); + geometry = new IdCacheConfig(); } - public UIDCacheConfig getFeature() { + public IdCacheConfig getFeature() { return feature; } - public void setFeature(UIDCacheConfig feature) { + public void setFeature(IdCacheConfig feature) { if (feature != null) this.feature = feature; } - public UIDCacheConfig getGeometry() { + public IdCacheConfig getGeometry() { return geometry; } - public void setGeometry(UIDCacheConfig geometry) { + public void setGeometry(IdCacheConfig geometry) { if (geometry != null) this.geometry = geometry; } diff --git a/impexp-config/src/main/java/org/citydb/config/project/resources/UIDCacheConfig.java b/impexp-config/src/main/java/org/citydb/config/project/resources/IdCacheConfig.java similarity index 95% rename from impexp-config/src/main/java/org/citydb/config/project/resources/UIDCacheConfig.java rename to impexp-config/src/main/java/org/citydb/config/project/resources/IdCacheConfig.java index 5fd92db35..7bcc721fc 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/resources/UIDCacheConfig.java +++ b/impexp-config/src/main/java/org/citydb/config/project/resources/IdCacheConfig.java @@ -31,12 +31,12 @@ import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; -@XmlType(name = "UIDCacheConfigType", propOrder = { +@XmlType(name = "IdCacheConfigType", propOrder = { "cacheSize", "pageFactor", "partitions" }) -public class UIDCacheConfig { +public class IdCacheConfig { @XmlSchemaType(name = "positiveInteger") @XmlElement(required = true, defaultValue = "200000") private Integer cacheSize = 200000; @@ -45,7 +45,7 @@ public class UIDCacheConfig { @XmlElement(required = true, defaultValue = "10") private Integer partitions = 10; - public UIDCacheConfig() { + public IdCacheConfig() { } public Integer getCacheSize() { diff --git a/impexp-config/src/main/java/org/citydb/config/project/resources/Resources.java b/impexp-config/src/main/java/org/citydb/config/project/resources/Resources.java index 8db48e95d..5adee8176 100644 --- a/impexp-config/src/main/java/org/citydb/config/project/resources/Resources.java +++ b/impexp-config/src/main/java/org/citydb/config/project/resources/Resources.java @@ -31,27 +31,28 @@ import javax.xml.bind.annotation.XmlType; @XmlType(name = "ResourcesType", propOrder = { - "gmlIdCache", + "idCache", "threadPool" }) public class Resources { @XmlElement(required = true) - private UIDCache gmlIdCache; + private IdCache idCache; @XmlElement(required = true) private ThreadPool threadPool; public Resources() { - gmlIdCache = new UIDCache(); + idCache = new IdCache(); threadPool = new ThreadPool(); } - public UIDCache getGmlIdCache() { - return gmlIdCache; + public IdCache getIdCache() { + return idCache; } - public void setGmlIdCache(UIDCache gmlIdCache) { - if (gmlIdCache != null) - this.gmlIdCache = gmlIdCache; + public void setIdCache(IdCache idCache) { + if (idCache != null) { + this.idCache = idCache; + } } public ThreadPool getThreadPool() { @@ -59,8 +60,9 @@ public ThreadPool getThreadPool() { } public void setThreadPool(ThreadPool threadPool) { - if (threadPool != null) + if (threadPool != null) { this.threadPool = threadPool; + } } } diff --git a/impexp-config/src/main/resources/org/citydb/config/i18n/language_de.properties b/impexp-config/src/main/resources/org/citydb/config/i18n/language_de.properties index c28b22791..7c25f89b9 100644 --- a/impexp-config/src/main/resources/org/citydb/config/i18n/language_de.properties +++ b/impexp-config/src/main/resources/org/citydb/config/i18n/language_de.properties @@ -2,7 +2,7 @@ main.window.title=3D City Database Importer/Exporter main.tabbedPane.import=Import main.tabbedPane.export=Export -main.tabbedPane.kmlExport=KML/COLLADA/glTF Export +main.tabbedPane.kmlExport=VIS Export main.tabbedPane.database=Datenbank main.tabbedPane.preferences=Voreinstellungen main.console.label=Konsole @@ -26,7 +26,7 @@ main.status.database.srs.export.label=Schreibe benutzerdefinierte Referenzsystem main.status.import.label=Importiere CityGML Datensatz... main.status.validate.label=Validiere CityGML Datensatz... main.status.export.label=Exportiere CityGML Daten aus Datenbank... -main.status.kmlExport.label=Exportiere KML/COLLADA/glTF Daten aus Datenbank... +main.status.kmlExport.label=Exportiere Visualisierungsdaten aus Datenbank... #Console console.label.detach=Konsole in einem neuen Fenster öffnen... @@ -57,7 +57,7 @@ common.label.passwordCheck=Passwort speichern common.label.datePicker.today=Heute common.border.versioning=Versionierung -common.dialog.error.incorrectData.gmlId=Bitte geben Sie eine gültige gml:id an +common.dialog.error.incorrectData.id=Bitte geben Sie einen gültigen Identifier an common.dialog.error.incorrectData.attributes=Bitte geben Sie mindestes einen Attributfilter an. common.dialog.error.incorrectData.bbox=Bitte geben Sie eine gültige Bounding Box an. common.dialog.error.incorrectData.featureClass=Bitte wählen Sie mindestens eine Feature Klasse aus. @@ -77,7 +77,7 @@ common.pref.menu.expand.label=Erweitern Sie die Baumansicht, um Einstellungen zu common.pref.resources.border.multiCPU=Multiprozessornutzung common.pref.resources.label.minThreads=Minimale Anzahl von Threads common.pref.resources.label.maxThreads=Maximale Anzahl von Threads -common.pref.resources.border.idCache=gml:id-Cache +common.pref.resources.border.idCache=Objekt-Identifier Cache common.pref.resources.label.geometry=Geometrie common.pref.resources.label.feature=Features common.pref.resources.label.cache.entry=Einträge @@ -131,8 +131,8 @@ filter.label.boundingBox.columns=Spalten filter.border.featureClass=Feature Typen filter.label.lod.mode=Filtermodus filter.label.lod.depth=Suchtiefe -filter.label.gmlId=gml:id -filter.label.gmlName=gml:name +filter.label.id=Identifier +filter.label.name=gml:name filter.label.lineage=citydb:lineage filter.label.counter.count=Anzahl filter.label.counter.startIndex=Startindex @@ -183,6 +183,8 @@ export.dialog.error.incorrectData.sql=Bitte geben Sie einen SQL Filter an. export.dialog.error.incorrectData.counter=Bitte geben Sie eine gültige Anzahl und/oder Startindex für die zu exportierenden Feature an. export.dialog.error.lod=Fehlerhafte LoD Filtereinstellungen export.dialog.error.lod.noneSelected=Bitte wählen Sie mindestens eine LoD-Stufe aus. +export.dialog.warn.cityjson.title=CityJSON Export +export.dialog.warn.cityjson.msg=Zur Vermeidung von Speicherproblemen sollte für CityJSON ein
gekachelter Export genutzt werden.

Wollen Sie fortfahren? export.dialog.window=CityGML Export export.dialog.msg=Bereite Datenbankexport vor... export.dialog.cityObj.msg=Exportiere Stadtobjekte... @@ -201,7 +203,7 @@ kmlExport.label.geometry=Geometrie kmlExport.label.collada=COLLADA/glTF kmlExport.label.visibleFrom=sichtbar von kmlExport.label.pixels=Pixeln -kmlExport.dialog.window=KML/COLLADA/glTF Export +kmlExport.dialog.window=VIS Export kmlExport.dialog.writingToFile=Datei wird geschrieben... kmlExport.dialog.error.incompleteData=Exportdaten unvollständig kmlExport.dialog.error.incompleteData.dataset=Bitte geben Sie den zu exportierenden Datensatz an. @@ -328,7 +330,9 @@ pref.tree.export=CityGML Export pref.tree.database=Datenbank pref.tree.general=Allgemein pref.tree.import.continuation=Fortschreibung -pref.tree.import.idHandling=gml:id Behandlung +pref.tree.import.id=Objekt-Identifier +pref.tree.import.cityGMLOptions=CityGML Optionen +pref.tree.import.cityJSONOptions=CityJSON Optionen pref.tree.import.index=Indizes pref.tree.import.address=Adressen pref.tree.import.appearance=Appearance @@ -336,14 +340,17 @@ pref.tree.import.geometry=Geometrie pref.tree.import.log=Import-Log pref.tree.import.xmlValidation=XML-Validierung pref.tree.import.resources=Ressourcen -pref.tree.export.version=CityGML Version +pref.tree.export.general=Allgemein pref.tree.export.group=CityObjectGroup pref.tree.export.address=Adressen pref.tree.export.appearance=Appearance pref.tree.export.tiling=Kachelungsoptionen pref.tree.export.xlink=XLinks +pref.tree.export.cityGMLOptions=CityGML Optionen +pref.tree.export.cityGML.general=Allgemein +pref.tree.export.cityJSONOptions=CityJSON Optionen pref.tree.export.resources=Ressourcen -pref.tree.kmlExport=KML/COLLADA/glTF Export +pref.tree.kmlExport=VIS Export pref.tree.kmlExport.general=Allgemein pref.tree.kmlExport.styling=Styling pref.tree.kmlExport.building.styling=Building @@ -372,8 +379,6 @@ pref.tree.kmlExport.relief.balloon=Relief pref.tree.kmlExport.cityFurniture.balloon=CityFurniture pref.tree.kmlExport.cityObjectGroup.balloon=CityObjectGroup pref.tree.kmlExport.genericCityObject.balloon=GenericCityObject -pref.tree.kmlExport.pointAndCurve.balloon=Punkt und Kurve -pref.tree.kmlExport.surfaceAndSolid.balloon=Surface und Solid pref.tree.general.logging=Log-Protokollierung pref.tree.db.srs=Referenzsysteme pref.tree.general.cache=Cache @@ -397,18 +402,18 @@ pref.import.continuation.label.terminationDate.inherit=Fehlendes terminationDate pref.import.continuation.label.terminationDate.onlyMissing=Fehlendes terminationDate mit null-Wert belegen pref.import.continuation.label.terminationDate.all=Alle terminationDate-Werte mit null-Wert belegen -pref.import.idHandling.border.id=Methode zur Vergabe von gml:ids -pref.import.idHandling.label.id.add=Nur fehlende gml:ids durch UUIDs ersetzen -pref.import.idHandling.label.id.exchange=Alle gml:ids durch UUIDs ersetzen -pref.import.idHandling.label.id.extReference=Original gml:ids als externe Referenzen speichern -pref.import.idHandling.label.id.prefix=gml:id Prefix -pref.import.idHandling.border.idCodeSpace=Codespace für gml:ids -pref.import.idHandling.label.idCodeSpace.none=Keinen Codespace speichern -pref.import.idHandling.label.idCodeSpace.file=Dateiname der CityGML-Datei verwenden -pref.import.idHandling.label.idCodeSpace.filePath=Pfad und Dateiname der CityGML-Datei verwenden -pref.import.idHandling.label.idCodeSpace.user=Benutzerdefinierter Codespace +pref.import.id.border.id=Vergabe von Identifier +pref.import.id.label.id.add=Fehlende Identifier durch UUIDs ersetzen +pref.import.id.label.id.exchange=Alle Identifier durch UUIDs ersetzen +pref.import.id.label.id.extReference=Originalen Identifier als externe Referenz speichern +pref.import.id.label.id.prefix=Präfix +pref.import.id.border.idCodeSpace=Codespace für Identifier +pref.import.id.label.idCodeSpace.none=Keinen Codespace speichern +pref.import.id.label.idCodeSpace.file=Dateiname der Importdatei verwenden +pref.import.id.label.idCodeSpace.filePath=Pfad und Dateiname der Importdatei verwenden +pref.import.id.label.idCodeSpace.user=Benutzerdefinierter Codespace -pref.import.address.label.importXAL=Originales XML Fragment importieren +pref.import.address.label.importXAL=Originales Element importieren pref.import.appearance.border.import=Appearances importieren pref.import.appearance.label.importTexture=Texturdateien importieren @@ -433,19 +438,33 @@ pref.import.xmlValidation.label.oneError=Nur einen Fehler pro Top-Level Feature pref.import.resources.border.commit=Batch Processing pref.import.resources.label.commit=Commit nach pref.import.resources.label.commit.feature=Top-Level Features -pref.import.resources.label.commit.cache=gml:id-Cache Einträgen +pref.import.resources.label.commit.cache=Objekt-Identifier pref.import.resources.label.commit.temp=temporären Informationen -pref.import.resources.border.texImageCache=Texturbild-Cache +pref.import.resources.border.texImageCache=Texturbild Cache pref.import.resources.label.texImageCache=Texturbilder -pref.export.version.border.versions=CityGML Version des Instanzdokuments - -pref.export.group.label.exportMember=Alle Gruppenmitglieder als xlink:href Referenzen exportieren +pref.import.cityjson.label.mapUnknownExtensions=Unbekannte Extensions auf generische Objekte und Attribute mappen + +pref.export.common.label.prettyPrint=Pretty-Print Formatierung +pref.export.general.border.general=Allgemeine Optionen +pref.export.general.label.citygmlv2=CityGML 2.0 verwenden +pref.export.general.label.citygmlv1=CityGML 1.0 verwenden +pref.export.general.label.versionHint=Diese Version wird für CityJSON Exporte empfohlen +pref.export.general.label.compressedFormat=Ausgabeformat für komprimierte Exporte +pref.export.general.border.bbox=Bounding Box Optionen +pref.export.general.label.feature=Bounding Box exportieren +pref.export.general.feature.topLevel=Nur für Top-Level Objekte +pref.export.general.feature.all=Für alle Objekte +pref.export.general.feature.none=Keine Bounding Box für Objekte exportieren +pref.export.general.label.cityModel=Bounding Box für gesamten Datensatz berechnen und exportieren +pref.export.general.label.useTileExtent=Kachelausdehnung bei gekacheltem Export verwenden + +pref.export.group.label.exportMember=Gruppenmitglieder nur als Referenzen exportieren pref.export.group.label.exportMember.description=Filtereinstellungen werden nicht angewandt -pref.export.address.border.export=Generierung von xAL-Adressinformationen -pref.export.address.label.exportDB=xAL Adresse aus den Attributwerten der Tabelle ADDRESS erzeugen -pref.export.address.label.exportXAL=Originales XML Fragment exportieren +pref.export.address.border.export=Generierung von Adressinformationen +pref.export.address.label.exportDB=Adresse aus den Attributwerten der Tabelle ADDRESS erzeugen +pref.export.address.label.exportXAL=Originales Element verwenden pref.export.address.label.exportFallback=Die jeweils andere Methode als Fallback verwenden pref.export.appearance.border.export=Appearances exportieren @@ -478,10 +497,20 @@ pref.export.xlink.label.feature.copy=Feature-Element kopieren (UUID als neue gml pref.export.xlink.border.geometry=Mehrfachausgabe von Geometrie-Elementen pref.export.xlink.label.geometry.export=XLink-Verweis auf vorhandenes Geometrie-Element pref.export.xlink.label.geometry.copy=Geometrie-Element kopieren (UUID als neue gml:id) -pref.export.xlink.label.copy.prefix=gml:id Prefix +pref.export.xlink.label.copy.prefix=gml:id Präfix pref.export.xlink.label.append=Originale gml:id an neue gml:id anhängen pref.export.xlink.label.feature.keepId=Originale gml:id als externe Referenz speichern +pref.export.cityjson.border.general=Allgemeine Optionen +pref.export.cityjson.label.geometryCompression=Geometriekomprimierung anwenden +pref.export.cityjson.label.removeDuplicates=Redundante Geometrien bei Kind-Objekten entfernen +pref.export.cityjson.label.sequenceId=Attribut sequenceId für Top-Level Objekte bei Sortierung erzeugen +pref.export.cityjson.border.precision=Genauigkeit +pref.export.cityjson.label.digits=Koordinaten +pref.export.cityjson.label.digitsUnits=Nachkommastellen +pref.export.cityjson.label.textureDigits=Texturkoordinaten +pref.export.cityjson.label.textureDigitsUnits=Nachkommastellen + pref.export.resources.border.batch=Batch Processing pref.export.resources.label.batch=Ausführen nach pref.export.resources.label.batch.feature=Features diff --git a/impexp-config/src/main/resources/org/citydb/config/i18n/language_en.properties b/impexp-config/src/main/resources/org/citydb/config/i18n/language_en.properties index 1ea201418..31be8dc34 100644 --- a/impexp-config/src/main/resources/org/citydb/config/i18n/language_en.properties +++ b/impexp-config/src/main/resources/org/citydb/config/i18n/language_en.properties @@ -2,7 +2,7 @@ main.window.title=3D City Database Importer/Exporter main.tabbedPane.import=Import main.tabbedPane.export=Export -main.tabbedPane.kmlExport=KML/COLLADA/glTF Export +main.tabbedPane.kmlExport=VIS Export main.tabbedPane.database=Database main.tabbedPane.preferences=Preferences main.console.label=Console @@ -26,7 +26,7 @@ main.status.database.srs.export.label=Writing user-defined reference systems... main.status.import.label=Importing CityGML dataset... main.status.validate.label=Validating CityGML dataset... main.status.export.label=Exporting CityGML data from database... -main.status.kmlExport.label=Exporting KML/COLLADA/glTF data from database... +main.status.kmlExport.label=Exporting visualisation data from database... #Console console.label.detach=Open Console in New Window... @@ -57,7 +57,7 @@ common.label.passwordCheck=Save password common.label.datePicker.today=Today common.border.versioning=Versioning -common.dialog.error.incorrectData.gmlId=Please enter a valid gml:id. +common.dialog.error.incorrectData.id=Please enter a valid identifier. common.dialog.error.incorrectData.attributes=Please provide at least one attribute filter. common.dialog.error.incorrectData.bbox=Please enter a valid bounding box. common.dialog.error.incorrectData.featureClass=Please select at least one feature class. @@ -77,7 +77,7 @@ common.pref.menu.expand.label=Expand the tree to edit preferences. common.pref.resources.border.multiCPU=Multithreaded processing common.pref.resources.label.minThreads=Minimal number of threads common.pref.resources.label.maxThreads=Maximal number of threads -common.pref.resources.border.idCache=gml:id cache +common.pref.resources.border.idCache=Object identifier cache common.pref.resources.label.geometry=Geometry common.pref.resources.label.feature=Features common.pref.resources.label.cache.entry=Entries @@ -131,8 +131,8 @@ filter.label.boundingBox.columns=columns filter.border.featureClass=Feature Types filter.label.lod.mode=Filter mode filter.label.lod.depth=Search depth -filter.label.gmlId=gml:id -filter.label.gmlName=gml:name +filter.label.id=Identifier +filter.label.name=gml:name filter.label.lineage=citydb:lineage filter.label.counter.count=Count filter.label.counter.startIndex=Start index @@ -183,6 +183,8 @@ export.dialog.error.incorrectData.sql=Please enter a SQL filter. export.dialog.error.incorrectData.counter=Please enter a valid count and/or start index for the features to be exported. export.dialog.error.lod=Incorrect LoD filter settings export.dialog.error.lod.noneSelected=Please select at minimum one LoD level. +export.dialog.warn.cityjson.title=CityJSON export +export.dialog.warn.cityjson.msg=To avoid memory issues, a tiled export should be used for CityJSON.

Do you want to continue? export.dialog.window=CityGML export export.dialog.msg=Preparing database export... export.dialog.cityObj.msg=Exporting city objects... @@ -191,7 +193,7 @@ export.dialog.globalApp.msg=Processing global appearance features... export.dialog.finish.msg=Finishing database export... #KmlExportPanel -kmlExport.label.automatic=Fixed side length +kmlExport.label.automatic=Fixed side length kmlExport.label.fromLOD=Export from level of detail kmlExport.label.highestLODAvailable=highest LoD available kmlExport.label.displayAs=Display as @@ -201,7 +203,7 @@ kmlExport.label.geometry=Geometry kmlExport.label.collada=COLLADA/glTF kmlExport.label.visibleFrom=visible from kmlExport.label.pixels=pixels -kmlExport.dialog.window=KML/COLLADA/glTF export +kmlExport.dialog.window=VIS export kmlExport.dialog.writingToFile=Writing to file... kmlExport.dialog.error.incompleteData=Incomplete export information kmlExport.dialog.error.incompleteData.dataset=Please name the KML file to be exported. @@ -328,7 +330,9 @@ pref.tree.export=CityGML Export pref.tree.database=Database pref.tree.general=General pref.tree.import.continuation=Continuation -pref.tree.import.idHandling=gml:id handling +pref.tree.import.id=Object identifier +pref.tree.import.cityGMLOptions=CityGML options +pref.tree.import.cityJSONOptions=CityJSON options pref.tree.import.index=Indexes pref.tree.import.address=Address pref.tree.import.appearance=Appearance @@ -336,14 +340,17 @@ pref.tree.import.geometry=Geometry pref.tree.import.log=Import log pref.tree.import.xmlValidation=XML validation pref.tree.import.resources=Resources -pref.tree.export.version=CityGML version +pref.tree.export.general=General pref.tree.export.group=CityObjectGroup pref.tree.export.address=Address pref.tree.export.appearance=Appearance pref.tree.export.tiling=Tiling options pref.tree.export.xlink=XLinks +pref.tree.export.cityGMLOptions=CityGML options +pref.tree.export.cityGML.general=General +pref.tree.export.cityJSONOptions=CityJSON options pref.tree.export.resources=Resources -pref.tree.kmlExport=KML/COLLADA/glTF Export +pref.tree.kmlExport=VIS Export pref.tree.kmlExport.general=General pref.tree.kmlExport.styling=Styling pref.tree.kmlExport.building.styling=Building @@ -372,8 +379,6 @@ pref.tree.kmlExport.relief.balloon=Relief pref.tree.kmlExport.cityFurniture.balloon=CityFurniture pref.tree.kmlExport.cityObjectGroup.balloon=CityObjectGroup pref.tree.kmlExport.genericCityObject.balloon=GenericCityObject -pref.tree.kmlExport.pointAndCurve.balloon=Point and Curve -pref.tree.kmlExport.surfaceAndSolid.balloon=Surface and Solid pref.tree.general.logging=Logging pref.tree.db.srs=Reference systems pref.tree.general.cache=Cache @@ -397,18 +402,18 @@ pref.import.continuation.label.terminationDate.inherit=Inherit missing terminati pref.import.continuation.label.terminationDate.onlyMissing=Set missing terminationDate values to null pref.import.continuation.label.terminationDate.all=Set all terminationDate values to null -pref.import.idHandling.border.id=Method for gml:id assignment -pref.import.idHandling.label.id.add=Only use UUIDs in case of missing gml:id -pref.import.idHandling.label.id.exchange=Replace all gml:ids by UUIDs -pref.import.idHandling.label.id.extReference=Store original gml:ids as external reference -pref.import.idHandling.label.id.prefix=gml:id prefix -pref.import.idHandling.border.idCodeSpace=Codespace for gml:ids -pref.import.idHandling.label.idCodeSpace.none=Do not store a codespace -pref.import.idHandling.label.idCodeSpace.file=Use file name of CityGML file -pref.import.idHandling.label.idCodeSpace.filePath=Use path and file name of CityGML file -pref.import.idHandling.label.idCodeSpace.user=User-defined codespace +pref.import.id.border.id=Assignment of identifiers +pref.import.id.label.id.add=Replace missing identifiers by UUIDs +pref.import.id.label.id.exchange=Replace all identifiers by UUIDs +pref.import.id.label.id.extReference=Store original identifier as external reference +pref.import.id.label.id.prefix=Prefix +pref.import.id.border.idCodeSpace=Codespace for identifiers +pref.import.id.label.idCodeSpace.none=Do not store a codespace +pref.import.id.label.idCodeSpace.file=Use file name of input file +pref.import.id.label.idCodeSpace.filePath=Use path and file name of input file +pref.import.id.label.idCodeSpace.user=User-defined codespace -pref.import.address.label.importXAL=Import original XML fragment +pref.import.address.label.importXAL=Import original element pref.import.appearance.border.import=Import appearances pref.import.appearance.label.importTexture=Import texture files @@ -433,19 +438,33 @@ pref.import.xmlValidation.label.oneError=Just report one error per top-level fea pref.import.resources.border.commit=Batch processing pref.import.resources.label.commit=Commit after pref.import.resources.label.commit.feature=Top-level features -pref.import.resources.label.commit.cache=gml:id cache entries +pref.import.resources.label.commit.cache=Object identifiers pref.import.resources.label.commit.temp=temporary information pref.import.resources.border.texImageCache=Texture image cache pref.import.resources.label.texImageCache=Texture images -pref.export.version.border.versions=CityGML version of instance document - -pref.export.group.label.exportMember=Export all group members as xlink:href references +pref.import.cityjson.label.mapUnknownExtensions=Map unknown extensions to generic city objects and attribute + +pref.export.common.label.prettyPrint=Pretty print +pref.export.general.border.general=General options +pref.export.general.label.citygmlv2=Use CityGML 2.0 +pref.export.general.label.citygmlv1=Use CityGML 1.0 +pref.export.general.label.versionHint=This version is recommended when exporting to CityJSON +pref.export.general.label.compressedFormat=Output format for compressed exports +pref.export.general.border.bbox=Bounding box options +pref.export.general.label.feature=Export bounding box +pref.export.general.feature.topLevel=Only for top-level objects +pref.export.general.feature.all=For all objects +pref.export.general.feature.none=Do not export object bounding boxes +pref.export.general.label.cityModel=Calculate and export bounding box for entire dataset +pref.export.general.label.useTileExtent=Use tile extent when tiling is enabled + +pref.export.group.label.exportMember=Export group members as references only pref.export.group.label.exportMember.description=Filter settings are not applied -pref.export.address.border.export=Generation of xAL address information -pref.export.address.label.exportDB=Create xAL address from data values in the ADDRESS table -pref.export.address.label.exportXAL=Export original XML fragment +pref.export.address.border.export=Generation of address information +pref.export.address.label.exportDB=Create address from data values in the ADDRESS table +pref.export.address.label.exportXAL=Use original element pref.export.address.label.exportFallback=Use the other method as fallback pref.export.appearance.border.export=Export appearances @@ -482,6 +501,16 @@ pref.export.xlink.label.copy.prefix=gml:id prefix pref.export.xlink.label.append=Append original gml:id to new gml:id pref.export.xlink.label.feature.keepId=Store original gml:id as external reference +pref.export.cityjson.border.general=General options +pref.export.cityjson.label.geometryCompression=Use geometry compression +pref.export.cityjson.label.removeDuplicates=Remove duplicate geometries of child objects +pref.export.cityjson.label.sequenceId=Add sequenceId attribute to top-level objects when sorting +pref.export.cityjson.border.precision=Precision +pref.export.cityjson.label.digits=Coordinates +pref.export.cityjson.label.digitsUnits=decimal places +pref.export.cityjson.label.textureDigits=Texture coordinates +pref.export.cityjson.label.textureDigitsUnits=decimal places + pref.export.resources.border.batch=Batch processing pref.export.resources.label.batch=Execute after pref.export.resources.label.batch.feature=Features diff --git a/impexp-core/build.gradle b/impexp-core/build.gradle index 5c4c011ea..ada15c421 100644 --- a/impexp-core/build.gradle +++ b/impexp-core/build.gradle @@ -7,7 +7,7 @@ dependencies { api project(':impexp-plugin-api') api 'org.citydb:sqlbuilder:2.2.1' api 'org.citydb:3dcitydb-ade-citygml4j:1.1.1' - api 'org.citygml4j:citygml4j:2.11.2' + api 'org.citygml4j:citygml4j:2.11.3-b20210129.0027' api 'org.geotools:gt-epsg-extension:23.1' api 'org.geotools:gt-epsg-hsql:23.1' api 'org.geotools:gt-referencing:23.1' diff --git a/impexp-core/src/main/java/org/citydb/ade/exporter/CityGMLExportHelper.java b/impexp-core/src/main/java/org/citydb/ade/exporter/CityGMLExportHelper.java index e803ff320..3ee8c2c43 100644 --- a/impexp-core/src/main/java/org/citydb/ade/exporter/CityGMLExportHelper.java +++ b/impexp-core/src/main/java/org/citydb/ade/exporter/CityGMLExportHelper.java @@ -89,6 +89,6 @@ public interface CityGMLExportHelper { ObjectType getObjectType(int objectClassId); AbstractObjectType getAbstractObjectType(int objectClassId); - boolean lookupAndPutObjectUID(String gmlId, long id, int objectClassId); - boolean lookupObjectUID(String gmlId); + boolean lookupAndPutObjectId(String gmlId, long id, int objectClassId); + boolean lookupObjectId(String gmlId); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/AbstractCacheTable.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/AbstractCacheTable.java similarity index 92% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/AbstractCacheTable.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/AbstractCacheTable.java index f577f9ad2..62f4e4355 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/AbstractCacheTable.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/AbstractCacheTable.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,12 +25,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache; +package org.citydb.citygml.common.cache; import java.sql.Connection; import java.sql.SQLException; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; +import org.citydb.citygml.common.cache.model.CacheTableModel; import org.citydb.database.adapter.AbstractSQLAdapter; public abstract class AbstractCacheTable { diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/BranchCacheTable.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/BranchCacheTable.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/BranchCacheTable.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/BranchCacheTable.java index 9a9fd85dc..e0350779b 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/BranchCacheTable.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/BranchCacheTable.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache; +package org.citydb.citygml.common.cache; import java.sql.Connection; import java.sql.SQLException; @@ -33,7 +33,7 @@ import java.util.List; import java.util.concurrent.locks.ReentrantLock; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; +import org.citydb.citygml.common.cache.model.CacheTableModel; import org.citydb.database.adapter.AbstractSQLAdapter; public class BranchCacheTable extends AbstractCacheTable { diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/CacheTable.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/CacheTable.java similarity index 81% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/CacheTable.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/CacheTable.java index 2cccbfeb0..cc3bdee84 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/CacheTable.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/CacheTable.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,27 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache; - -import org.citydb.citygml.common.database.cache.model.AbstractCacheTableModel; -import org.citydb.citygml.common.database.cache.model.CacheTableBasic; -import org.citydb.citygml.common.database.cache.model.CacheTableDeprecatedMaterial; -import org.citydb.citygml.common.database.cache.model.CacheTableFeatureGmlId; -import org.citydb.citygml.common.database.cache.model.CacheTableGeometryGmlId; -import org.citydb.citygml.common.database.cache.model.CacheTableGlobalAppearance; -import org.citydb.citygml.common.database.cache.model.CacheTableGroupToCityObject; -import org.citydb.citygml.common.database.cache.model.CacheTableLibraryObject; -import org.citydb.citygml.common.database.cache.model.CacheTableLinearRing; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; -import org.citydb.citygml.common.database.cache.model.CacheTableSolidGeometry; -import org.citydb.citygml.common.database.cache.model.CacheTableSurfaceDataToTexImage; -import org.citydb.citygml.common.database.cache.model.CacheTableSurfaceGeometry; -import org.citydb.citygml.common.database.cache.model.CacheTableTextureAssociation; -import org.citydb.citygml.common.database.cache.model.CacheTableTextureAssociationTarget; -import org.citydb.citygml.common.database.cache.model.CacheTableTextureCoordList; -import org.citydb.citygml.common.database.cache.model.CacheTableTextureFile; -import org.citydb.citygml.common.database.cache.model.CacheTableTextureFileId; -import org.citydb.citygml.common.database.cache.model.CacheTableTextureParam; +package org.citydb.citygml.common.cache; + +import org.citydb.citygml.common.cache.model.AbstractCacheTableModel; +import org.citydb.citygml.common.cache.model.CacheTableBasic; +import org.citydb.citygml.common.cache.model.CacheTableDeprecatedMaterial; +import org.citydb.citygml.common.cache.model.CacheTableObjectGmlId; +import org.citydb.citygml.common.cache.model.CacheTableGeometryGmlId; +import org.citydb.citygml.common.cache.model.CacheTableGlobalAppearance; +import org.citydb.citygml.common.cache.model.CacheTableGroupToCityObject; +import org.citydb.citygml.common.cache.model.CacheTableLibraryObject; +import org.citydb.citygml.common.cache.model.CacheTableLinearRing; +import org.citydb.citygml.common.cache.model.CacheTableModel; +import org.citydb.citygml.common.cache.model.CacheTableSolidGeometry; +import org.citydb.citygml.common.cache.model.CacheTableSurfaceDataToTexImage; +import org.citydb.citygml.common.cache.model.CacheTableSurfaceGeometry; +import org.citydb.citygml.common.cache.model.CacheTableTextureAssociation; +import org.citydb.citygml.common.cache.model.CacheTableTextureAssociationTarget; +import org.citydb.citygml.common.cache.model.CacheTableTextureCoordList; +import org.citydb.citygml.common.cache.model.CacheTableTextureFile; +import org.citydb.citygml.common.cache.model.CacheTableTextureFileId; +import org.citydb.citygml.common.cache.model.CacheTableTextureParam; import org.citydb.database.adapter.AbstractSQLAdapter; import org.citygml4j.util.gmlid.DefaultGMLIdManager; @@ -82,10 +82,10 @@ protected CacheTable(CacheTableModel model, Connection connection, AbstractSQLAd case LIBRARY_OBJECT: this.model = CacheTableLibraryObject.getInstance(); break; - case GMLID_FEATURE: - this.model = CacheTableFeatureGmlId.getInstance(); + case OBJECT_GMLID: + this.model = CacheTableObjectGmlId.getInstance(); break; - case GMLID_GEOMETRY: + case GEOMETRY_GMLID: this.model = CacheTableGeometryGmlId.getInstance(); break; case GROUP_TO_CITYOBJECT: diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/CacheTableManager.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/CacheTableManager.java similarity index 98% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/CacheTableManager.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/CacheTableManager.java index 31598d195..2be36dee1 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/CacheTableManager.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/CacheTableManager.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,9 +25,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache; +package org.citydb.citygml.common.cache; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; +import org.citydb.citygml.common.cache.model.CacheTableModel; import org.citydb.config.Config; import org.citydb.database.adapter.AbstractDatabaseAdapter; import org.citydb.database.adapter.h2.H2Adapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCache.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCache.java similarity index 81% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCache.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCache.java index a7d2f8d82..c3aedddb3 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCache.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCache.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.uid; +package org.citydb.citygml.common.cache; import java.sql.SQLException; import java.util.concurrent.ConcurrentHashMap; @@ -36,11 +36,11 @@ import org.citydb.log.Logger; -public class UIDCache { +public class IdCache { private final Logger log = Logger.getInstance(); - private final ConcurrentHashMap map; - private final UIDCachingModel cacheModel; + private final ConcurrentHashMap map; + private final IdCachingModel cacheModel; private final int capacity; private final float drainFactor; @@ -51,8 +51,8 @@ public class UIDCache { private final AtomicInteger entries = new AtomicInteger(0); private volatile boolean backUp = false; - public UIDCache( - UIDCachingModel cacheModel, + public IdCache( + IdCachingModel cacheModel, int capacity, float drainFactor, int concurrencyLevel) { @@ -60,11 +60,11 @@ public UIDCache( this.capacity = capacity; this.drainFactor = drainFactor; - map = new ConcurrentHashMap(capacity, .75f, concurrencyLevel); + map = new ConcurrentHashMap<>(capacity, .75f, concurrencyLevel); } public void put(String key, long id, long rootId, boolean reverse, String mapping, int objectClassId) { - UIDCacheEntry entry = lookupMap(key); + IdCacheEntry entry = lookupMap(key); if (entry == null) { entry = getOrCreate(key, id, rootId, reverse, mapping, objectClassId); @@ -82,7 +82,7 @@ public boolean lookupAndPut(String key, long id, long rootId, boolean reverse, S lookup = lookupDB(key) != null; if (!lookup) { - UIDCacheEntry entry = getOrCreate(key, id, rootId, reverse, mapping, objectClassId); + IdCacheEntry entry = getOrCreate(key, id, rootId, reverse, mapping, objectClassId); if (!entry.getAndSetRegistered(true)) { if (entries.incrementAndGet() >= capacity && isDraining.compareAndSet(false, true)) drainToDB(); @@ -97,30 +97,30 @@ public boolean lookupAndPut(String key, long id, int objectClassId) { return lookupAndPut(key, id, 0, false, null, objectClassId); } - public UIDCacheEntry get(String key) { - UIDCacheEntry entry = lookupMap(key); + public IdCacheEntry get(String key) { + IdCacheEntry entry = lookupMap(key); if (entry == null && backUp) entry = lookupDB(key); return entry; } - public UIDCacheEntry getFromMemory(String key) { + public IdCacheEntry getFromMemory(String key) { return lookupMap(key); } - private UIDCacheEntry lookupMap(String key) { - UIDCacheEntry entry = map.get(key); + private IdCacheEntry lookupMap(String key) { + IdCacheEntry entry = map.get(key); if (entry != null) entry.getAndSetRequested(true); return entry; } - private UIDCacheEntry getOrCreate(String key, long id, long rootId, boolean reverse, String mapping, int objectClassId) { - UIDCacheEntry entry = map.get(key); + private IdCacheEntry getOrCreate(String key, long id, long rootId, boolean reverse, String mapping, int objectClassId) { + IdCacheEntry entry = map.get(key); if (entry == null) { - UIDCacheEntry newEntry = new UIDCacheEntry(id, rootId, reverse, mapping, objectClassId); + IdCacheEntry newEntry = new IdCacheEntry(id, rootId, reverse, mapping, objectClassId); entry = map.putIfAbsent(key, newEntry); if (entry == null) entry = newEntry; @@ -157,7 +157,7 @@ private void drainToDB() { } } - private UIDCacheEntry lookupDB(String key) { + private IdCacheEntry lookupDB(String key) { if (isDraining.get()) { final ReentrantLock lock = this.mainLock; lock.lock(); diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCacheEntry.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCacheEntry.java similarity index 88% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCacheEntry.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCacheEntry.java index dd088eb84..4310a0bc8 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCacheEntry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCacheEntry.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,11 +25,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.uid; +package org.citydb.citygml.common.cache; import java.util.concurrent.atomic.AtomicBoolean; -public class UIDCacheEntry { +public class IdCacheEntry { private final long id; private final long rootId; private final boolean reverse; @@ -38,7 +38,7 @@ public class UIDCacheEntry { private final AtomicBoolean isRegistered = new AtomicBoolean(false); private final AtomicBoolean isRequested = new AtomicBoolean(false); - public UIDCacheEntry(long id, long rootId, boolean reverse, String mapping, int objectClassId) { + public IdCacheEntry(long id, long rootId, boolean reverse, String mapping, int objectClassId) { this.id = id; this.rootId = rootId; this.reverse = reverse; @@ -46,7 +46,7 @@ public UIDCacheEntry(long id, long rootId, boolean reverse, String mapping, int this.objectClassId = objectClassId; } - public UIDCacheEntry(long id, long rootId, boolean reverse, String mapping) { + public IdCacheEntry(long id, long rootId, boolean reverse, String mapping) { this(id, rootId, reverse, mapping, 0); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCacheManager.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCacheManager.java similarity index 75% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCacheManager.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCacheManager.java index 293ec51c1..46b7e6ece 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCacheManager.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCacheManager.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,26 +25,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.uid; +package org.citydb.citygml.common.cache; import java.sql.SQLException; import java.util.HashMap; +import java.util.Map; -public class UIDCacheManager { - private final HashMap cacheMap; +public class IdCacheManager { + private final Map cacheMap; - public UIDCacheManager() { - cacheMap = new HashMap(); + public IdCacheManager() { + cacheMap = new HashMap<>(); } public void initCache( - UIDCacheType cacheType, - UIDCachingModel model, + IdCacheType cacheType, + IdCachingModel model, int cacheSize, float drainFactor, int concurrencyLevel) { - cacheMap.put(cacheType, new UIDCache( + cacheMap.put(cacheType, new IdCache( model, cacheSize, drainFactor, @@ -52,12 +53,12 @@ public void initCache( )); } - public UIDCache getCache(UIDCacheType cacheType) { + public IdCache getCache(IdCacheType cacheType) { return cacheMap.get(cacheType); } public void shutdownAll() throws SQLException { - for (UIDCache server : cacheMap.values()) + for (IdCache server : cacheMap.values()) server.shutdown(); } } diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCacheType.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCacheType.java similarity index 91% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCacheType.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCacheType.java index 85a765945..941d72b14 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCacheType.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCacheType.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,9 +25,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.uid; +package org.citydb.citygml.common.cache; -public enum UIDCacheType { +public enum IdCacheType { OBJECT, GEOMETRY, TEXTURE_IMAGE diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCachingModel.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCachingModel.java similarity index 75% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCachingModel.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCachingModel.java index 67d39572a..a2a0bfbf7 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/uid/UIDCachingModel.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/IdCachingModel.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,14 +25,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.uid; +package org.citydb.citygml.common.cache; import java.sql.SQLException; import java.util.concurrent.ConcurrentHashMap; -public interface UIDCachingModel { - public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException; - public UIDCacheEntry lookupDB(String key) throws SQLException; - public void close() throws SQLException; - public String getType(); +public interface IdCachingModel { + void drainToDB(ConcurrentHashMap map, int drain) throws SQLException; + IdCacheEntry lookupDB(String key) throws SQLException; + void close() throws SQLException; + String getType(); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/AbstractCacheTableModel.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/AbstractCacheTableModel.java similarity index 97% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/AbstractCacheTableModel.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/AbstractCacheTableModel.java index d6e00ed20..d7240ccb3 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/AbstractCacheTableModel.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/AbstractCacheTableModel.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableBasic.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableBasic.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableBasic.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableBasic.java index 8ed1d0927..9dc3f4a21 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableBasic.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableBasic.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableDeprecatedMaterial.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableDeprecatedMaterial.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableDeprecatedMaterial.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableDeprecatedMaterial.java index 407790ce9..8092c99a0 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableDeprecatedMaterial.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableDeprecatedMaterial.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableGeometryGmlId.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableGeometryGmlId.java similarity index 94% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableGeometryGmlId.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableGeometryGmlId.java index ad2f0d8d0..d3b5073fb 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableGeometryGmlId.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableGeometryGmlId.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; @@ -45,7 +45,7 @@ public synchronized static CacheTableGeometryGmlId getInstance() { @Override public CacheTableModel getType() { - return CacheTableModel.GMLID_GEOMETRY; + return CacheTableModel.GEOMETRY_GMLID; } @Override diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableGlobalAppearance.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableGlobalAppearance.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableGlobalAppearance.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableGlobalAppearance.java index 8edb8702f..33e16eb5b 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableGlobalAppearance.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableGlobalAppearance.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableGroupToCityObject.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableGroupToCityObject.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableGroupToCityObject.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableGroupToCityObject.java index 1c4f56d28..2ff29f304 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableGroupToCityObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableGroupToCityObject.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableLibraryObject.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableLibraryObject.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableLibraryObject.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableLibraryObject.java index dba1c0dcb..51fde1a55 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableLibraryObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableLibraryObject.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableLinearRing.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableLinearRing.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableLinearRing.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableLinearRing.java index afd44c896..28e609685 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableLinearRing.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableLinearRing.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableModel.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableModel.java similarity index 91% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableModel.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableModel.java index 920460ce2..d6d4df85a 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableModel.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableModel.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,13 +25,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; public enum CacheTableModel { // provide a unique id for the tmp table // that does not extend 6 chars! - GMLID_FEATURE("IDF"), - GMLID_GEOMETRY("IDG"), + OBJECT_GMLID("OID"), + GEOMETRY_GMLID("GID"), SURFACE_GEOMETRY("SG"), SOLID_GEOMETRY("SOG"), BASIC("BA"), @@ -40,7 +40,7 @@ public enum CacheTableModel { TEXTUREPARAM("TP"), TEXTUREASSOCIATION("TA"), TEXTUREASSOCIATION_TARGET("TAT"), - TEXTURE_FILE_ID("IDT"), + TEXTURE_FILE_ID("TID"), TEXTURE_FILE("TF"), SURFACE_DATA_TO_TEX_IMAGE("STT"), LIBRARY_OBJECT("LO"), diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableFeatureGmlId.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableObjectGmlId.java similarity index 83% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableFeatureGmlId.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableObjectGmlId.java index 282a3f755..262f1a57f 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableFeatureGmlId.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableObjectGmlId.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; @@ -33,19 +33,19 @@ import java.sql.SQLException; import java.sql.Statement; -public class CacheTableFeatureGmlId extends AbstractCacheTableModel { - private static CacheTableFeatureGmlId instance; +public class CacheTableObjectGmlId extends AbstractCacheTableModel { + private static CacheTableObjectGmlId instance; - public synchronized static CacheTableFeatureGmlId getInstance() { + public synchronized static CacheTableObjectGmlId getInstance() { if (instance == null) - instance = new CacheTableFeatureGmlId(); + instance = new CacheTableObjectGmlId(); return instance; } @Override public CacheTableModel getType() { - return CacheTableModel.GMLID_FEATURE; + return CacheTableModel.OBJECT_GMLID; } @Override diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableSolidGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableSolidGeometry.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableSolidGeometry.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableSolidGeometry.java index 3a2156f0a..e1cff13f5 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableSolidGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableSolidGeometry.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableSurfaceDataToTexImage.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableSurfaceDataToTexImage.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableSurfaceDataToTexImage.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableSurfaceDataToTexImage.java index 3219cdd68..4245f6891 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableSurfaceDataToTexImage.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableSurfaceDataToTexImage.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableSurfaceGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableSurfaceGeometry.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableSurfaceGeometry.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableSurfaceGeometry.java index 4a9b92a4c..44c34bec0 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableSurfaceGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableSurfaceGeometry.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureAssociation.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureAssociation.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureAssociation.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureAssociation.java index 9d15e03a1..4f80903ed 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureAssociation.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureAssociation.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureAssociationTarget.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureAssociationTarget.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureAssociationTarget.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureAssociationTarget.java index 5420fc19d..bd574192b 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureAssociationTarget.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureAssociationTarget.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureCoordList.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureCoordList.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureCoordList.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureCoordList.java index 5eb6b0c34..8762c5034 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureCoordList.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureCoordList.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureFile.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureFile.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureFile.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureFile.java index c361e648a..5b6d69c35 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureFile.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureFile.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureFileId.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureFileId.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureFileId.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureFileId.java index 6eaf9234b..78ded6d35 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureFileId.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureFileId.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureParam.java b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureParam.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureParam.java rename to impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureParam.java index 610137cbb..e6db70f5c 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/cache/model/CacheTableTextureParam.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/cache/model/CacheTableTextureParam.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.cache.model; +package org.citydb.citygml.common.cache.model; import org.citydb.database.adapter.AbstractSQLAdapter; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlink.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlink.java similarity index 85% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlink.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlink.java index 5924d4bda..5693c68b7 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlink.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlink.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,10 +25,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public interface DBXlink { - public DBXlinkEnum getXlinkType(); - public String getGmlId(); - public void setGmlId(String gmlId); + DBXlinkEnum getXlinkType(); + String getGmlId(); + void setGmlId(String gmlId); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkBasic.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkBasic.java similarity index 97% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkBasic.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkBasic.java index c331cda6f..34d0c3e5f 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkBasic.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkBasic.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkBasic implements DBXlink { private long id; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkDeprecatedMaterial.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkDeprecatedMaterial.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkDeprecatedMaterial.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkDeprecatedMaterial.java index d00dd85b1..ce772d4f3 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkDeprecatedMaterial.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkDeprecatedMaterial.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkDeprecatedMaterial implements DBXlink { private long id; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkEnum.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkEnum.java similarity index 94% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkEnum.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkEnum.java index 9d74b5c43..960189408 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkEnum.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkEnum.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public enum DBXlinkEnum { SURFACE_GEOMETRY, diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkGroupToCityObject.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkGroupToCityObject.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkGroupToCityObject.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkGroupToCityObject.java index b420f0092..1ec72a5cb 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkGroupToCityObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkGroupToCityObject.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkGroupToCityObject implements DBXlink { private long groupId; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkLibraryObject.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkLibraryObject.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkLibraryObject.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkLibraryObject.java index 7fcd325f7..e6fae89a6 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkLibraryObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkLibraryObject.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkLibraryObject implements DBXlink { long id; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkLinearRing.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkLinearRing.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkLinearRing.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkLinearRing.java index 042d86da3..c101463cb 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkLinearRing.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkLinearRing.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkLinearRing implements DBXlink { private String gmlId; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkSolidGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkSolidGeometry.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkSolidGeometry.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkSolidGeometry.java index 385308d8a..65a26a4fb 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkSolidGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkSolidGeometry.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkSolidGeometry implements DBXlink { private long id; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkSurfaceDataToTexImage.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkSurfaceDataToTexImage.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkSurfaceDataToTexImage.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkSurfaceDataToTexImage.java index 589a8339b..79af1b686 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkSurfaceDataToTexImage.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkSurfaceDataToTexImage.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkSurfaceDataToTexImage implements DBXlink { private long fromId; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkSurfaceGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkSurfaceGeometry.java similarity index 97% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkSurfaceGeometry.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkSurfaceGeometry.java index 754889308..d4dc0b73b 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkSurfaceGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkSurfaceGeometry.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkSurfaceGeometry implements DBXlink { private long id; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureAssociation.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureAssociation.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureAssociation.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureAssociation.java index 2709e0f6c..1d3e7587a 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureAssociation.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureAssociation.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkTextureAssociation implements DBXlink { private long id; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureAssociationTarget.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureAssociationTarget.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureAssociationTarget.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureAssociationTarget.java index 60dea16a7..c25bb8975 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureAssociationTarget.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureAssociationTarget.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkTextureAssociationTarget implements DBXlink { private long surfaceDataId; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureCoordList.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureCoordList.java similarity index 97% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureCoordList.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureCoordList.java index 4ded1e598..70d9db778 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureCoordList.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureCoordList.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; import org.citydb.config.geometry.GeometryObject; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureFile.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureFile.java similarity index 95% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureFile.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureFile.java index 5c21fcb29..872136ee0 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureFile.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureFile.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkTextureFile implements DBXlink { private final long id; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureParam.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureParam.java similarity index 96% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureParam.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureParam.java index 5bb03b586..0e12e11bb 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureParam.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureParam.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public class DBXlinkTextureParam implements DBXlink { private long id; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureParamEnum.java b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureParamEnum.java similarity index 94% rename from impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureParamEnum.java rename to impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureParamEnum.java index e7e165943..2605010de 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/database/xlink/DBXlinkTextureParamEnum.java +++ b/impexp-core/src/main/java/org/citydb/citygml/common/xlink/DBXlinkTextureParamEnum.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.database.xlink; +package org.citydb.citygml.common.xlink; public enum DBXlinkTextureParamEnum { UNDEFINED, diff --git a/impexp-core/src/main/java/org/citydb/citygml/deleter/util/DeleteListParser.java b/impexp-core/src/main/java/org/citydb/citygml/deleter/util/DeleteListParser.java index e8712134e..889ed4024 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/deleter/util/DeleteListParser.java +++ b/impexp-core/src/main/java/org/citydb/citygml/deleter/util/DeleteListParser.java @@ -46,7 +46,7 @@ public class DeleteListParser implements AutoCloseable { private String name; private int index = 1; - private IdType idType = IdType.GML_ID; + private IdType idType = IdType.RESOURCE_ID; private String delimiter = ","; private String commentStart = "#"; private char quoteChar = '"'; @@ -58,7 +58,7 @@ public class DeleteListParser implements AutoCloseable { private String id; public enum IdType { - GML_ID, + RESOURCE_ID, DATABASE_ID } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/uid/GeometryGmlIdCache.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/cache/GeometryGmlIdCache.java similarity index 81% rename from impexp-core/src/main/java/org/citydb/citygml/exporter/database/uid/GeometryGmlIdCache.java rename to impexp-core/src/main/java/org/citydb/citygml/exporter/cache/GeometryGmlIdCache.java index 8d7dc5d87..099980a4b 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/uid/GeometryGmlIdCache.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/cache/GeometryGmlIdCache.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,14 +25,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.exporter.database.uid; +package org.citydb.citygml.exporter.cache; -import org.citydb.citygml.common.database.cache.BranchCacheTable; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.uid.UIDCachingModel; +import org.citydb.citygml.common.cache.BranchCacheTable; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.model.CacheTableModel; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.cache.IdCachingModel; import java.sql.Connection; import java.sql.PreparedStatement; @@ -43,7 +43,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReentrantLock; -public class GeometryGmlIdCache implements UIDCachingModel { +public class GeometryGmlIdCache implements IdCachingModel { private final ReentrantLock mainLock = new ReentrantLock(); private final int partitions; private final CacheTableModel cacheTableModel; @@ -63,25 +63,26 @@ public GeometryGmlIdCache(CacheTableManager cacheTableManager, int partitions, i this.partitions = partitions; this.batchSize = batchSize; - cacheTableModel = CacheTableModel.GMLID_GEOMETRY; + cacheTableModel = CacheTableModel.GEOMETRY_GMLID; backUpTables = new CacheTable[partitions]; psLookupGmlIds = new PreparedStatement[partitions]; psDrains = new PreparedStatement[partitions]; locks = new ReentrantLock[partitions]; batchCounters = new int[partitions]; - for (int i = 0; i < partitions; i++) + for (int i = 0; i < partitions; i++) { locks[i] = new ReentrantLock(); + } } @Override - public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException { + public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException { int drainCounter = 0; // firstly, try and write those entries which have already been requested - Iterator> iter = map.entrySet().iterator(); + Iterator> iter = map.entrySet().iterator(); while (drainCounter <= drain && iter.hasNext()) { - Map.Entry entry = iter.next(); + Map.Entry entry = iter.next(); if (entry.getValue().isRequested()) { String gmlId = entry.getKey(); @@ -112,7 +113,7 @@ public void drainToDB(ConcurrentHashMap map, int drain) t // secondly, drain remaining entries until drain limit iter = map.entrySet().iterator(); while (drainCounter <= drain && iter.hasNext()) { - Map.Entry entry = iter.next(); + Map.Entry entry = iter.next(); String gmlId = entry.getKey(); // determine partition for gml:id @@ -139,13 +140,15 @@ public void drainToDB(ConcurrentHashMap map, int drain) t } // finally execute batches - for (int i = 0; i < psDrains.length; i++) - if (psDrains[i] != null && batchCounters[i] > 0) + for (int i = 0; i < psDrains.length; i++) { + if (psDrains[i] != null && batchCounters[i] > 0) { psDrains[i].executeBatch(); + } + } } @Override - public UIDCacheEntry lookupDB(String key) throws SQLException { + public IdCacheEntry lookupDB(String key) throws SQLException { // determine partition for gml:id int partition = Math.abs(key.hashCode() % partitions); initializePartition(partition); @@ -163,7 +166,7 @@ public UIDCacheEntry lookupDB(String key) throws SQLException { boolean reverse = rs.getBoolean(3); String mapping = rs.getString(4); - return new UIDCacheEntry(id, rootId, reverse, mapping); + return new IdCacheEntry(id, rootId, reverse, mapping); } return null; @@ -175,13 +178,17 @@ public UIDCacheEntry lookupDB(String key) throws SQLException { @Override public void close() throws SQLException { - for (PreparedStatement ps : psDrains) - if (ps != null) + for (PreparedStatement ps : psDrains) { + if (ps != null) { ps.close(); + } + } - for (PreparedStatement ps : psLookupGmlIds) - if (ps != null) + for (PreparedStatement ps : psLookupGmlIds) { + if (ps != null) { ps.close(); + } + } } @Override @@ -194,8 +201,9 @@ private void initializePartition(int partition) throws SQLException { mainLock.lock(); try { - if (branchTable == null) + if (branchTable == null) { branchTable = cacheTableManager.createAndIndexBranchCacheTable(cacheTableModel); + } } finally { mainLock.unlock(); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/uid/FeatureGmlIdCache.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/cache/ObjectGmlIdCache.java similarity index 79% rename from impexp-core/src/main/java/org/citydb/citygml/exporter/database/uid/FeatureGmlIdCache.java rename to impexp-core/src/main/java/org/citydb/citygml/exporter/cache/ObjectGmlIdCache.java index 1d625ae19..9a1a66bee 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/uid/FeatureGmlIdCache.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/cache/ObjectGmlIdCache.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,14 +25,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.exporter.database.uid; +package org.citydb.citygml.exporter.cache; -import org.citydb.citygml.common.database.cache.BranchCacheTable; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.uid.UIDCachingModel; +import org.citydb.citygml.common.cache.BranchCacheTable; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.cache.IdCachingModel; +import org.citydb.citygml.common.cache.model.CacheTableModel; import java.sql.Connection; import java.sql.PreparedStatement; @@ -43,7 +43,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReentrantLock; -public class FeatureGmlIdCache implements UIDCachingModel { +public class ObjectGmlIdCache implements IdCachingModel { private final ReentrantLock mainLock = new ReentrantLock(); private final int partitions; private final CacheTableModel cacheTableModel; @@ -58,30 +58,31 @@ public class FeatureGmlIdCache implements UIDCachingModel { private BranchCacheTable branchTable; - public FeatureGmlIdCache(CacheTableManager cacheTableManager, int partitions, int batchSize) throws SQLException { + public ObjectGmlIdCache(CacheTableManager cacheTableManager, int partitions, int batchSize) throws SQLException { this.cacheTableManager = cacheTableManager; this.partitions = partitions; this.batchSize = batchSize; - cacheTableModel = CacheTableModel.GMLID_FEATURE; + cacheTableModel = CacheTableModel.OBJECT_GMLID; backUpTables = new CacheTable[partitions]; psLookupGmlIds = new PreparedStatement[partitions]; psDrains = new PreparedStatement[partitions]; locks = new ReentrantLock[partitions]; batchCounters = new int[partitions]; - for (int i = 0; i < partitions; i++) + for (int i = 0; i < partitions; i++) { locks[i] = new ReentrantLock(); + } } @Override - public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException { + public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException { int drainCounter = 0; // firstly, try and write those entries which have already been requested - Iterator> iter = map.entrySet().iterator(); + Iterator> iter = map.entrySet().iterator(); while (drainCounter <= drain && iter.hasNext()) { - Map.Entry entry = iter.next(); + Map.Entry entry = iter.next(); if (entry.getValue().isRequested()) { String gmlId = entry.getKey(); @@ -111,7 +112,7 @@ public void drainToDB(ConcurrentHashMap map, int drain) t // secondly, drain remaining entries until drain limit iter = map.entrySet().iterator(); while (drainCounter <= drain && iter.hasNext()) { - Map.Entry entry = iter.next(); + Map.Entry entry = iter.next(); String gmlId = entry.getKey(); // determine partition for gml:id @@ -137,13 +138,15 @@ public void drainToDB(ConcurrentHashMap map, int drain) t } // finally execute batches - for (int i = 0; i < psDrains.length; i++) - if (psDrains[i] != null && batchCounters[i] > 0) + for (int i = 0; i < psDrains.length; i++) { + if (psDrains[i] != null && batchCounters[i] > 0) { psDrains[i].executeBatch(); + } + } } @Override - public UIDCacheEntry lookupDB(String key) throws SQLException { + public IdCacheEntry lookupDB(String key) throws SQLException { // determine partition for gml:id int partition = Math.abs(key.hashCode() % partitions); initializePartition(partition); @@ -160,7 +163,7 @@ public UIDCacheEntry lookupDB(String key) throws SQLException { String mapping = rs.getString(2); int objectClassId = rs.getInt(3); - return new UIDCacheEntry(id, 0, false, mapping, objectClassId); + return new IdCacheEntry(id, 0, false, mapping, objectClassId); } return null; @@ -172,18 +175,22 @@ public UIDCacheEntry lookupDB(String key) throws SQLException { @Override public void close() throws SQLException { - for (PreparedStatement ps : psDrains) - if (ps != null) + for (PreparedStatement ps : psDrains) { + if (ps != null) { ps.close(); + } + } - for (PreparedStatement ps : psLookupGmlIds) - if (ps != null) + for (PreparedStatement ps : psLookupGmlIds) { + if (ps != null) { ps.close(); + } + } } @Override public String getType() { - return "feature"; + return "object"; } private void initializePartition(int partition) throws SQLException { @@ -191,8 +198,9 @@ private void initializePartition(int partition) throws SQLException { mainLock.lock(); try { - if (branchTable == null) + if (branchTable == null) { branchTable = cacheTableManager.createAndIndexBranchCacheTable(cacheTableModel); + } } finally { mainLock.unlock(); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportWorker.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportWorker.java index a0936f822..7b74cb0a0 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportWorker.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportWorker.java @@ -27,9 +27,9 @@ */ package org.citydb.citygml.exporter.concurrent; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.citygml.exporter.CityGMLExportException; import org.citydb.citygml.exporter.database.content.CityGMLExportManager; import org.citydb.citygml.exporter.database.content.DBSplittingResult; @@ -90,7 +90,7 @@ public DBExportWorker(Connection connection, CityGMLBuilder cityGMLBuilder, FeatureWriter featureWriter, WorkerPool xlinkPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CacheTableManager cacheTableManager, Query query, InternalConfig internalConfig, @@ -115,7 +115,7 @@ public DBExportWorker(Connection connection, cityGMLBuilder, featureWriter, xlinkPool, - uidCacheManager, + idCacheManager, cacheTableManager, internalConfig, config); @@ -203,7 +203,7 @@ private void doWork(DBSplittingResult work) { // register gml:id in cache if (internalConfig.isRegisterGmlIdInCache() && feature.isSetId()) - exporter.putObjectUID(feature.getId(), work.getId(), work.getObjectType().getObjectClassId()); + exporter.putObjectId(feature.getId(), work.getId(), work.getObjectType().getObjectClassId()); // update export counter exporter.updateExportCounter(feature); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportWorkerFactory.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportWorkerFactory.java index 0695df793..3d983de03 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportWorkerFactory.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportWorkerFactory.java @@ -27,9 +27,9 @@ */ package org.citydb.citygml.exporter.concurrent; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.citygml.exporter.CityGMLExportException; import org.citydb.citygml.exporter.database.content.DBSplittingResult; import org.citydb.citygml.exporter.util.InternalConfig; @@ -56,7 +56,7 @@ public class DBExportWorkerFactory implements WorkerFactory { private final CityGMLBuilder cityGMLBuilder; private final FeatureWriter featureWriter; private final WorkerPool xlinkExporterPool; - private final UIDCacheManager uidCacheManager; + private final IdCacheManager idCacheManager; private final CacheTableManager cacheTableManager; private final Query query; private final InternalConfig internalConfig; @@ -67,7 +67,7 @@ public DBExportWorkerFactory(SchemaMapping schemaMapping, CityGMLBuilder cityGMLBuilder, FeatureWriter featureWriter, WorkerPool xlinkExporterPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CacheTableManager cacheTableManager, Query query, InternalConfig internalConfig, @@ -77,7 +77,7 @@ public DBExportWorkerFactory(SchemaMapping schemaMapping, this.cityGMLBuilder = cityGMLBuilder; this.featureWriter = featureWriter; this.xlinkExporterPool = xlinkExporterPool; - this.uidCacheManager = uidCacheManager; + this.idCacheManager = idCacheManager; this.cacheTableManager = cacheTableManager; this.query = query; this.internalConfig = internalConfig; @@ -95,7 +95,7 @@ public Worker createWorker() { connection.setAutoCommit(false); dbWorker = new DBExportWorker(connection, databaseAdapter, schemaMapping, cityGMLBuilder, featureWriter, - xlinkExporterPool, uidCacheManager, cacheTableManager, query, internalConfig, config, eventDispatcher); + xlinkExporterPool, idCacheManager, cacheTableManager, query, internalConfig, config, eventDispatcher); } catch (CityGMLExportException | SQLException e) { log.error("Failed to create export worker.", e); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportXlinkWorker.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportXlinkWorker.java index c4f1ab7a4..3abad1311 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportXlinkWorker.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportXlinkWorker.java @@ -27,10 +27,10 @@ */ package org.citydb.citygml.exporter.concurrent; -import org.citydb.citygml.common.database.xlink.DBXlink; -import org.citydb.citygml.common.database.xlink.DBXlinkEnum; -import org.citydb.citygml.common.database.xlink.DBXlinkLibraryObject; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureFile; +import org.citydb.citygml.common.xlink.DBXlink; +import org.citydb.citygml.common.xlink.DBXlinkEnum; +import org.citydb.citygml.common.xlink.DBXlinkLibraryObject; +import org.citydb.citygml.common.xlink.DBXlinkTextureFile; import org.citydb.citygml.exporter.database.xlink.DBXlinkExporterEnum; import org.citydb.citygml.exporter.database.xlink.DBXlinkExporterLibraryObject; import org.citydb.citygml.exporter.database.xlink.DBXlinkExporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportXlinkWorkerFactory.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportXlinkWorkerFactory.java index 3b5ba6b6d..55ad2f6eb 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportXlinkWorkerFactory.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/concurrent/DBExportXlinkWorkerFactory.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.exporter.concurrent; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.citygml.exporter.util.InternalConfig; import org.citydb.concurrent.Worker; import org.citydb.concurrent.WorkerFactory; diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/controller/Exporter.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/controller/Exporter.java index 08c4a52a9..4019432d9 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/controller/Exporter.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/controller/Exporter.java @@ -27,17 +27,17 @@ */ package org.citydb.citygml.exporter.controller; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.uid.UIDCacheType; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.cache.IdCacheType; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.citygml.exporter.CityGMLExportException; +import org.citydb.citygml.exporter.cache.GeometryGmlIdCache; +import org.citydb.citygml.exporter.cache.ObjectGmlIdCache; import org.citydb.citygml.exporter.concurrent.DBExportWorkerFactory; import org.citydb.citygml.exporter.concurrent.DBExportXlinkWorkerFactory; import org.citydb.citygml.exporter.database.content.DBSplitter; import org.citydb.citygml.exporter.database.content.DBSplittingResult; -import org.citydb.citygml.exporter.database.uid.FeatureGmlIdCache; -import org.citydb.citygml.exporter.database.uid.GeometryGmlIdCache; import org.citydb.citygml.exporter.util.InternalConfig; import org.citydb.citygml.exporter.writer.FeatureWriteException; import org.citydb.citygml.exporter.writer.FeatureWriter; @@ -50,9 +50,11 @@ import org.citydb.config.i18n.Language; import org.citydb.config.project.database.DatabaseSrs; import org.citydb.config.project.database.Workspace; +import org.citydb.config.project.exporter.OutputFormat; import org.citydb.config.project.exporter.SimpleTilingOptions; import org.citydb.config.project.exporter.TileNameSuffixMode; import org.citydb.config.project.exporter.TileSuffixMode; +import org.citydb.config.project.exporter.XLink; import org.citydb.database.adapter.AbstractDatabaseAdapter; import org.citydb.database.adapter.IndexStatusInfo.IndexType; import org.citydb.database.connection.DatabaseConnectionPool; @@ -95,7 +97,6 @@ import java.io.File; import java.io.IOException; -import java.io.OutputStreamWriter; import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; @@ -161,6 +162,10 @@ public boolean doExport(Path outputFile) throws CityGMLExportException { private boolean process(Path outputFile) throws CityGMLExportException { InternalConfig internalConfig = new InternalConfig(); + // set output format and format-specific options + OutputFormat outputFormat = OutputFileFactory.getOutputFormat(outputFile, config); + setOutputFormatOptions(outputFormat, internalConfig); + // log workspace if (databaseAdapter.hasVersioningSupport() && databaseAdapter.getConnectionDetails().isSetWorkspace()) { Workspace workspace = databaseAdapter.getConnectionDetails().getWorkspace(); @@ -183,7 +188,7 @@ private boolean process(Path outputFile) throws CityGMLExportException { // create feature writer factory FeatureWriterFactory writerFactory; try { - writerFactory = FeatureWriterFactoryBuilder.buildFactory(query, schemaMapping, config); + writerFactory = FeatureWriterFactoryBuilder.buildFactory(outputFormat, query, schemaMapping, config); } catch (FeatureWriteException e) { throw new CityGMLExportException("Failed to build the feature writer factory.", e); } @@ -264,6 +269,9 @@ private boolean process(Path outputFile) throws CityGMLExportException { } catch (FilterException e) { throw new CityGMLExportException("Failed to transform tiling extent.", e); } + } else if (outputFormat == OutputFormat.CITYJSON) { + // log warning if CityJSON is used without tiling + log.warn("To avoid memory issues, a tiled export should be used for CityJSON."); } // create output file factory @@ -300,9 +308,9 @@ private boolean process(Path outputFile) throws CityGMLExportException { internalConfig.setExportTextureURI(textureFolder); - // check for unique texture filenames when exporting an archiv + // check for unique texture filenames when exporting as archive if (!config.getExportConfig().getAppearances().isSetUniqueTextureFileNames() - && fileFactory.getFileType(outputFile.getFileName()) == FileType.ARCHIVE) { + && OutputFileFactory.getFileType(outputFile.getFileName()) == FileType.ARCHIVE) { log.warn("Using unique texture filenames because of writing to an archive file."); config.getExportConfig().getAppearances().setUniqueTextureFileNames(true); } @@ -370,7 +378,7 @@ private boolean process(Path outputFile) throws CityGMLExportException { } CacheTableManager cacheTableManager = null; - UIDCacheManager uidCacheManager = null; + IdCacheManager idCacheManager = null; FeatureWriter writer = null; OutputFile file = null; @@ -380,7 +388,7 @@ private boolean process(Path outputFile) throws CityGMLExportException { eventDispatcher.triggerEvent(new CounterEvent(CounterType.REMAINING_TILES, --remainingTiles, this)); try { - file = fileFactory.createOutputFile(folder.resolve(fileName)); + file = fileFactory.createOutputFile(folder.resolve(fileName), outputFormat); internalConfig.setOutputFile(file); } catch (IOException e) { throw new CityGMLExportException("Failed to create output file '" + folder.resolve(fileName) + "'.", e); @@ -399,9 +407,7 @@ private boolean process(Path outputFile) throws CityGMLExportException { // create output writer try { - writer = writerFactory.createFeatureWriter(new OutputStreamWriter(file.openStream(), - config.getExportConfig().getCityGMLOptions().getFileEncoding())); - writer.useIndentation(file.getType() == FileType.REGULAR); + writer = writerFactory.createFeatureWriter(file.openStream()); } catch (FeatureWriteException | IOException e) { throw new CityGMLExportException("Failed to open file '" + file.getFile() + "' for writing.", e); } @@ -416,26 +422,26 @@ private boolean process(Path outputFile) throws CityGMLExportException { } // create instance of gml:id lookup server manager... - uidCacheManager = new UIDCacheManager(); + idCacheManager = new IdCacheManager(); // ...and start servers try { - uidCacheManager.initCache( - UIDCacheType.GEOMETRY, + idCacheManager.initCache( + IdCacheType.GEOMETRY, new GeometryGmlIdCache(cacheTableManager, - config.getExportConfig().getResources().getGmlIdCache().getGeometry().getPartitions(), + config.getExportConfig().getResources().getIdCache().getGeometry().getPartitions(), config.getDatabaseConfig().getImportBatching().getGmlIdCacheBatchSize()), - config.getExportConfig().getResources().getGmlIdCache().getGeometry().getCacheSize(), - config.getExportConfig().getResources().getGmlIdCache().getGeometry().getPageFactor(), + config.getExportConfig().getResources().getIdCache().getGeometry().getCacheSize(), + config.getExportConfig().getResources().getIdCache().getGeometry().getPageFactor(), config.getExportConfig().getResources().getThreadPool().getMaxThreads()); - uidCacheManager.initCache( - UIDCacheType.OBJECT, - new FeatureGmlIdCache(cacheTableManager, - config.getExportConfig().getResources().getGmlIdCache().getFeature().getPartitions(), + idCacheManager.initCache( + IdCacheType.OBJECT, + new ObjectGmlIdCache(cacheTableManager, + config.getExportConfig().getResources().getIdCache().getFeature().getPartitions(), config.getDatabaseConfig().getImportBatching().getGmlIdCacheBatchSize()), - config.getExportConfig().getResources().getGmlIdCache().getFeature().getCacheSize(), - config.getExportConfig().getResources().getGmlIdCache().getFeature().getPageFactor(), + config.getExportConfig().getResources().getIdCache().getFeature().getCacheSize(), + config.getExportConfig().getResources().getIdCache().getFeature().getPageFactor(), config.getExportConfig().getResources().getThreadPool().getMaxThreads()); } catch (SQLException e) { throw new CityGMLExportException("Failed to initialize internal gml:id caches.", e); @@ -462,7 +468,7 @@ private boolean process(Path outputFile) throws CityGMLExportException { cityGMLBuilder, writer, xlinkExporterPool, - uidCacheManager, + idCacheManager, cacheTableManager, query, internalConfig, @@ -489,7 +495,7 @@ private boolean process(Path outputFile) throws CityGMLExportException { schemaMapping, dbWorkerPool, query, - uidCacheManager.getCache(UIDCacheType.OBJECT), + idCacheManager.getCache(IdCacheType.OBJECT), cacheTableManager, eventDispatcher, internalConfig, @@ -554,9 +560,9 @@ private boolean process(Path outputFile) throws CityGMLExportException { // } - if (uidCacheManager != null) { + if (idCacheManager != null) { try { - uidCacheManager.shutdownAll(); + idCacheManager.shutdownAll(); } catch (SQLException e) { setException("Failed to clean the gml:id caches.", e); shouldRun = false; @@ -613,6 +619,19 @@ private boolean process(Path outputFile) throws CityGMLExportException { return shouldRun; } + private void setOutputFormatOptions(OutputFormat outputFormat, InternalConfig internalConfig) { + internalConfig.setOutputFormat(outputFormat); + + if (outputFormat == OutputFormat.CITYJSON) { + internalConfig.setExportFeatureReferences(false); + internalConfig.setExportGeometryReferences(true); + } else { + XLink xlinkOptions = config.getExportConfig().getCityGMLOptions().getXlink(); + internalConfig.setExportFeatureReferences(xlinkOptions.getFeature().isModeXLink()); + internalConfig.setExportGeometryReferences(xlinkOptions.getGeometry().isModeXLink()); + } + } + private void setException(String message, Throwable cause) { if (exception == null) { exception = new CityGMLExportException(message, cause); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/AbstractAppearanceExporter.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/AbstractAppearanceExporter.java index de713295f..2443c88cb 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/AbstractAppearanceExporter.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/AbstractAppearanceExporter.java @@ -27,9 +27,9 @@ */ package org.citydb.citygml.exporter.database.content; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlink; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureFile; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlink; +import org.citydb.citygml.common.xlink.DBXlinkTextureFile; import org.citydb.citygml.exporter.CityGMLExportException; import org.citydb.citygml.exporter.util.AttributeValueSplitter; import org.citydb.citygml.exporter.util.AttributeValueSplitter.SplitValue; @@ -72,7 +72,6 @@ import org.citygml4j.model.gml.geometry.primitives.DirectPosition; import org.citygml4j.model.gml.geometry.primitives.Point; import org.citygml4j.model.gml.geometry.primitives.PointProperty; -import org.citygml4j.util.gmlid.DefaultGMLIdManager; import org.citygml4j.util.walker.FeatureWalker; import java.io.File; @@ -99,8 +98,6 @@ public abstract class AbstractAppearanceExporter extends AbstractTypeExporter { private final List appearanceADEHookTables; private final List
surfaceDataADEHookTables; - private boolean appendOldGmlId; - private String gmlIdPrefix; protected AbstractAppearanceExporter(boolean isGlobal, CacheTable cacheTable, CityGMLExportManager exporter, Config config) throws CityGMLExportException, SQLException { super(exporter); @@ -116,12 +113,7 @@ protected AbstractAppearanceExporter(boolean isGlobal, CacheTable cacheTable, Ci separator = new File(textureURI).isAbsolute() ? File.separator : "/"; String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); String getLength = exporter.getDatabaseAdapter().getSQLAdapter().resolveDatabaseOperationName("blob.get_length"); - - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); - if (!useXLink) { - appendOldGmlId = exporter.getExportConfig().getXlink().getFeature().isSetAppendId(); - gmlIdPrefix = exporter.getExportConfig().getXlink().getFeature().getIdPrefix(); - } + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); table = new Table(TableEnum.APPEARANCE.getName(), schema); Table appearToSurfaceData = new Table(TableEnum.APPEAR_TO_SURFACE_DATA.getName(), schema); @@ -258,17 +250,14 @@ private SurfaceDataProperty getSurfaceData(long surfaceDataId, ResultSet rs, Sur int objectClassId = rs.getInt(8); String gmlId = rs.getString(9); + boolean generateNewGmlId = false; if (gmlId != null) { // process xlink - if (exporter.lookupAndPutObjectUID(gmlId, surfaceDataId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, surfaceDataId, objectClassId)) { if (useXLink) return new SurfaceDataProperty("#" + gmlId); else { - String newGmlId = DefaultGMLIdManager.getInstance().generateUUID(gmlIdPrefix); - if (appendOldGmlId) - newGmlId = newGmlId + "-" + gmlId; - - gmlId = newGmlId; + generateNewGmlId = true; } } } @@ -279,6 +268,10 @@ private SurfaceDataProperty getSurfaceData(long surfaceDataId, ResultSet rs, Sur return empty; } + if (generateNewGmlId) { + gmlId = exporter.generateFeatureGmlId(surfaceData, gmlId); + } + surfaceData.setId(gmlId); for (SplitValue splitValue : valueSplitter.split(rs.getString(10), rs.getString(11))) { diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/CityGMLExportManager.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/CityGMLExportManager.java index f72c4c7fc..c1767b013 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/CityGMLExportManager.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/CityGMLExportManager.java @@ -31,13 +31,13 @@ import org.citydb.ade.ADEExtensionManager; import org.citydb.ade.exporter.ADEExportManager; import org.citydb.ade.exporter.CityGMLExportHelper; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; -import org.citydb.citygml.common.database.uid.UIDCache; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.uid.UIDCacheType; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCache; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.cache.IdCacheType; +import org.citydb.citygml.common.cache.model.CacheTableModel; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.citygml.exporter.CityGMLExportException; import org.citydb.citygml.exporter.util.AppearanceRemover; import org.citydb.citygml.exporter.util.AttributeValueSplitter; @@ -50,6 +50,9 @@ import org.citydb.config.Config; import org.citydb.config.geometry.GeometryObject; import org.citydb.config.project.exporter.ExportConfig; +import org.citydb.config.project.exporter.OutputFormat; +import org.citydb.config.project.exporter.XLinkConfig; +import org.citydb.config.project.exporter.XLinkFeatureConfig; import org.citydb.database.adapter.AbstractDatabaseAdapter; import org.citydb.database.schema.TableEnum; import org.citydb.database.schema.mapping.AbstractObjectType; @@ -155,7 +158,7 @@ public class CityGMLExportManager implements CityGMLExportHelper { private final List plugins; private final FeatureWriter featureWriter; private final WorkerPool xlinkPool; - private final UIDCacheManager uidCacheManager; + private final IdCacheManager idCacheManager; private final CacheTableManager cacheTableManager; private final InternalConfig internalConfig; private final Config config; @@ -179,7 +182,7 @@ public CityGMLExportManager(Connection connection, CityGMLBuilder cityGMLBuilder, FeatureWriter featureWriter, WorkerPool xlinkPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CacheTableManager cacheTableManager, InternalConfig internalConfig, Config config) throws CityGMLExportException { @@ -190,7 +193,7 @@ public CityGMLExportManager(Connection connection, this.cityGMLBuilder = cityGMLBuilder; this.featureWriter = featureWriter; this.xlinkPool = xlinkPool; - this.uidCacheManager = uidCacheManager; + this.idCacheManager = idCacheManager; this.cacheTableManager = cacheTableManager; this.internalConfig = internalConfig; this.config = config; @@ -702,29 +705,46 @@ public AbstractObjectType getAbstractObjectType(int objectClassId) { return schemaMapping.getAbstractObjectType(objectClassId); } - public String generateNewGmlId(AbstractFeature feature) { - return generateNewGmlId(feature, feature.getId()); + public String generateFeatureGmlId(AbstractFeature feature) { + return generateFeatureGmlId(feature, feature.getId()); } - public String generateNewGmlId(AbstractFeature feature, String oldGmlId) { - String gmlId = DefaultGMLIdManager.getInstance().generateUUID(config.getExportConfig().getXlink().getFeature().getIdPrefix()); + public String generateFeatureGmlId(AbstractFeature feature, String oldGmlId) { + if (internalConfig.getOutputFormat() == OutputFormat.CITYJSON) { + return DefaultGMLIdManager.getInstance().generateUUID(); + } else { + XLinkFeatureConfig xlinkOptions = config.getExportConfig().getCityGMLOptions().getXlink().getFeature(); + String gmlId = DefaultGMLIdManager.getInstance().generateUUID(xlinkOptions.getIdPrefix()); + if (oldGmlId != null) { + if (xlinkOptions.isSetAppendId()) + gmlId = gmlId + "-" + oldGmlId; - if (oldGmlId != null) { - if (config.getExportConfig().getXlink().getFeature().isSetAppendId()) - gmlId = gmlId + "-" + oldGmlId; + if (xlinkOptions.isSetKeepGmlIdAsExternalReference() && feature instanceof AbstractCityObject) { + ExternalReference externalReference = new ExternalReference(); + if (internalConfig.getOutputFile() != null) + externalReference.setInformationSystem(internalConfig.getOutputFile().getFile().toString()); - if (config.getExportConfig().getXlink().getFeature().isSetKeepGmlIdAsExternalReference() - && feature instanceof AbstractCityObject) { - ExternalReference externalReference = new ExternalReference(); - if (internalConfig.getOutputFile() != null) - externalReference.setInformationSystem(internalConfig.getOutputFile().getFile().toString()); + ExternalObject externalObject = new ExternalObject(); + externalObject.setName(oldGmlId); + externalReference.setExternalObject(externalObject); - ExternalObject externalObject = new ExternalObject(); - externalObject.setName(oldGmlId); - externalReference.setExternalObject(externalObject); - - ((AbstractCityObject)feature).addExternalReference(externalReference); + ((AbstractCityObject) feature).addExternalReference(externalReference); + } } + + return gmlId; + } + } + + public String generateGeometryGmlId(AbstractGeometry geometry) { + return generateGeometryGmlId(geometry.getId()); + } + + public String generateGeometryGmlId(String oldGmlId) { + XLinkConfig xlinkOptions = config.getExportConfig().getCityGMLOptions().getXlink().getGeometry(); + String gmlId = DefaultGMLIdManager.getInstance().generateUUID(xlinkOptions.getIdPrefix()); + if (xlinkOptions.isSetAppendId() && oldGmlId != null) { + gmlId = gmlId + "-" + oldGmlId; } return gmlId; @@ -735,28 +755,28 @@ public void propagateXlink(DBXlink xlink) { } @Override - public boolean lookupAndPutObjectUID(String gmlId, long id, int objectClassId) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.OBJECT); + public boolean lookupAndPutObjectId(String gmlId, long id, int objectClassId) { + IdCache cache = idCacheManager.getCache(IdCacheType.OBJECT); return cache != null && cache.lookupAndPut(gmlId, id, objectClassId); } @Override - public boolean lookupObjectUID(String gmlId) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.OBJECT); + public boolean lookupObjectId(String gmlId) { + IdCache cache = idCacheManager.getCache(IdCacheType.OBJECT); return cache != null && cache.get(gmlId) != null; } - public void putObjectUID(String gmlId, long id, int objectClassId) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.OBJECT); + public void putObjectId(String gmlId, long id, int objectClassId) { + IdCache cache = idCacheManager.getCache(IdCacheType.OBJECT); if (cache != null) cache.put(gmlId, id, -1, false, null, objectClassId); } - public boolean lookupAndPutGeometryUID(String gmlId, long id, boolean useLocalScope) { + public boolean lookupAndPutGeometryId(String gmlId, long id, boolean useLocalScope) { boolean isCached = !localGeometryCache.add(gmlId); if (!useLocalScope) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.GEOMETRY); + IdCache cache = idCacheManager.getCache(IdCacheType.GEOMETRY); if (cache != null) { if (isCached) { cache.put(gmlId, id, 0, false, null, MappingConstants.SURFACE_GEOMETRY_OBJECTCLASS_ID); @@ -769,10 +789,10 @@ public boolean lookupAndPutGeometryUID(String gmlId, long id, boolean useLocalSc return isCached; } - public boolean lookupGeometryUID(String gmlId) { + public boolean lookupGeometryId(String gmlId) { boolean isCached = localGeometryCache.contains(gmlId); if (!isCached) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.GEOMETRY); + IdCache cache = idCacheManager.getCache(IdCacheType.GEOMETRY); isCached = cache != null && cache.get(gmlId) != null; } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBAddress.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBAddress.java index 378b4be10..f06481fe7 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBAddress.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBAddress.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.exporter.database.content; -import org.citydb.citygml.common.xal.AddressExportFactory; -import org.citydb.citygml.common.xal.AddressObject; +import org.citydb.citygml.exporter.util.AddressExportFactory; +import org.citydb.citygml.exporter.util.AddressObject; import org.citydb.citygml.exporter.CityGMLExportException; import org.citydb.config.geometry.GeometryObject; import org.citydb.config.project.exporter.AddressMode; diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridge.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridge.java index 048f28e1d..d4158fbe8 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridge.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridge.java @@ -111,7 +111,7 @@ public DBBridge(Connection connection, CityGMLExportManager exporter) throws Cit bridgeModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.BRIDGE).getNamespaceURI(); lodFilter = exporter.getLodFilter(); hasObjectClassIdColumn = exporter.getDatabaseAdapter().getConnectionMetaData().getCityDBVersion().compareTo(4, 0, 0) >= 0; - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.BRIDGE.getName(), schema); @@ -537,7 +537,7 @@ protected Collection doExport(long id, AbstractBridge root, Feat String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -558,7 +558,7 @@ protected Collection doExport(long id, AbstractBridge root, Feat } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); // get projection filter openingProjectionFilter = exporter.getProjectionFilter(featureType); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeConstrElement.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeConstrElement.java index 90176caed..ebba8ba33 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeConstrElement.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeConstrElement.java @@ -110,7 +110,7 @@ public DBBridgeConstrElement(Connection connection, CityGMLExportManager exporte bridgeModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.BRIDGE).getNamespaceURI(); lodFilter = exporter.getLodFilter(); hasObjectClassIdColumn = exporter.getDatabaseAdapter().getConnectionMetaData().getCityDBVersion().compareTo(4, 0, 0) >= 0; - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.BRIDGE_CONSTR_ELEMENT.getName(), schema); @@ -478,7 +478,7 @@ private Map doExport(long id, BridgeConstructio String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { OpeningProperty openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -498,7 +498,7 @@ private Map doExport(long id, BridgeConstructio } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); // get projection filter ProjectionFilter openingProjectionFilter = exporter.getProjectionFilter(featureType); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeInstallation.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeInstallation.java index 7eb416947..aa41e84d0 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeInstallation.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeInstallation.java @@ -112,7 +112,7 @@ public DBBridgeInstallation(Connection connection, CityGMLExportManager exporter CombinedProjectionFilter projectionFilter = exporter.getCombinedProjectionFilter(TableEnum.BRIDGE_INSTALLATION.getName()); bridgeModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.BRIDGE).getNamespaceURI(); lodFilter = exporter.getLodFilter(); - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.BRIDGE_INSTALLATION.getName(), schema); @@ -493,7 +493,7 @@ private Map doExport(long id, AbstractCityObject root, String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { OpeningProperty openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -513,7 +513,7 @@ private Map doExport(long id, AbstractCityObject root, } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); // get projection filter ProjectionFilter openingProjectionFilter = exporter.getProjectionFilter(featureType); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeRoom.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeRoom.java index 6b183d197..049f639f5 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeRoom.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeRoom.java @@ -107,7 +107,7 @@ public DBBridgeRoom(Connection connection, CityGMLExportManager exporter) throws bridgeModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.BRIDGE).getNamespaceURI(); lodFilter = exporter.getLodFilter(); hasObjectClassIdColumn = exporter.getDatabaseAdapter().getConnectionMetaData().getCityDBVersion().compareTo(4, 0, 0) >= 0; - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.BRIDGE_ROOM.getName(), schema); @@ -403,7 +403,7 @@ private Map doExport(long id, BridgeRoom root, FeatureType roo String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -424,7 +424,7 @@ private Map doExport(long id, BridgeRoom root, FeatureType roo } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); // get projection filter openingProjectionFilter = exporter.getProjectionFilter(featureType); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeThematicSurface.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeThematicSurface.java index b419bd563..9f4371970 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeThematicSurface.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBridgeThematicSurface.java @@ -83,7 +83,7 @@ public DBBridgeThematicSurface(Connection connection, CityGMLExportManager expor CombinedProjectionFilter projectionFilter = exporter.getCombinedProjectionFilter(TableEnum.BRIDGE_THEMATIC_SURFACE.getName()); bridgeModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.BRIDGE).getNamespaceURI(); lodFilter = exporter.getLodFilter(); - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.BRIDGE_THEMATIC_SURFACE.getName(), schema); @@ -201,7 +201,7 @@ protected Collection doExport(long id, AbstractBoundary String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { OpeningProperty openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -221,7 +221,7 @@ protected Collection doExport(long id, AbstractBoundary } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); // get projection filter ProjectionFilter openingProjectionFilter = exporter.getProjectionFilter(featureType); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBuilding.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBuilding.java index efccd368e..9fba1ed1d 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBuilding.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBuilding.java @@ -112,7 +112,7 @@ public DBBuilding(Connection connection, CityGMLExportManager exporter) throws C buildingModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.BUILDING).getNamespaceURI(); lodFilter = exporter.getLodFilter(); hasObjectClassIdColumn = exporter.getDatabaseAdapter().getConnectionMetaData().getCityDBVersion().compareTo(4, 0, 0) >= 0; - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.BUILDING.getName(), schema); @@ -610,7 +610,7 @@ else if (i == 1 && !projectionFilter.containsProperty("lod0RoofEdge", buildingMo String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -631,7 +631,7 @@ else if (i == 1 && !projectionFilter.containsProperty("lod0RoofEdge", buildingMo } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); // get projection filter openingProjectionFilter = exporter.getProjectionFilter(featureType); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBuildingInstallation.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBuildingInstallation.java index 4dd8a03e3..dc6b888f6 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBuildingInstallation.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBBuildingInstallation.java @@ -112,7 +112,7 @@ public DBBuildingInstallation(Connection connection, CityGMLExportManager export CombinedProjectionFilter projectionFilter = exporter.getCombinedProjectionFilter(TableEnum.BUILDING_INSTALLATION.getName()); buildingModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.BUILDING).getNamespaceURI(); lodFilter = exporter.getLodFilter(); - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.BUILDING_INSTALLATION.getName(), schema); @@ -493,7 +493,7 @@ private Map doExport(long id, AbstractCityObject root, String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { OpeningProperty openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -513,7 +513,7 @@ private Map doExport(long id, AbstractCityObject root, } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); // get projection filter ProjectionFilter openingProjectionFilter = exporter.getProjectionFilter(featureType); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBCityObject.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBCityObject.java index a14095884..80d3accb8 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBCityObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBCityObject.java @@ -270,8 +270,8 @@ private boolean doExport(long objectId, ObjectContext context) throws CityGMLExp protected boolean initializeObject(ObjectContext context, ResultSet rs) throws CityGMLExportException, SQLException { boolean setEnvelope = !context.isCityObject || (context.projectionFilter.containsProperty("boundedBy", gmlModule) - && (exporter.getExportConfig().getCityGMLOptions().getGMLEnvelope().getFeatureMode() == FeatureEnvelopeMode.ALL - || (exporter.getExportConfig().getCityGMLOptions().getGMLEnvelope().getFeatureMode() == FeatureEnvelopeMode.TOP_LEVEL && context.isTopLevel))); + && (exporter.getExportConfig().getGeneralOptions().getEnvelope().getFeatureMode() == FeatureEnvelopeMode.ALL + || (exporter.getExportConfig().getGeneralOptions().getEnvelope().getFeatureMode() == FeatureEnvelopeMode.TOP_LEVEL && context.isTopLevel))); // gml:id if (!context.object.isSetId()) diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBCityObjectGroup.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBCityObjectGroup.java index 111a0d4a8..f45faff1c 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBCityObjectGroup.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBCityObjectGroup.java @@ -165,7 +165,7 @@ protected boolean doExport(CityObjectGroup cityObjectGroup, long id, FeatureType String gmlId = rs.getString("parent_gmlid"); if (!exporter.getExportConfig().getCityObjectGroup().isExportMemberAsXLinks() - && !exporter.lookupObjectUID(gmlId)) + && !exporter.lookupObjectId(gmlId)) continue; if (gmlId != null) { @@ -191,7 +191,7 @@ protected boolean doExport(CityObjectGroup cityObjectGroup, long id, FeatureType String gmlId = rs.getString("member_gmlid"); if (!exporter.getExportConfig().getCityObjectGroup().isExportMemberAsXLinks() - && !exporter.lookupObjectUID(gmlId)) + && !exporter.lookupObjectId(gmlId)) continue; if (gmlId != null) { diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBGlobalAppearance.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBGlobalAppearance.java index 83353ac4b..4ba05a565 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBGlobalAppearance.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBGlobalAppearance.java @@ -27,11 +27,10 @@ */ package org.citydb.citygml.exporter.database.content; -import org.citydb.citygml.common.database.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTable; import org.citydb.citygml.exporter.CityGMLExportException; import org.citydb.config.Config; import org.citydb.database.schema.TableEnum; -import org.citydb.query.Query; import org.citydb.sqlbuilder.expression.PlaceHolder; import org.citydb.sqlbuilder.schema.Table; import org.citydb.sqlbuilder.select.Select; @@ -42,7 +41,6 @@ import org.citygml4j.model.gml.geometry.AbstractGeometry; import org.citygml4j.util.walker.GMLWalker; -import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBImplicitGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBImplicitGeometry.java index 9237e4d75..9db95144b 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBImplicitGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBImplicitGeometry.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.exporter.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkLibraryObject; +import org.citydb.citygml.common.xlink.DBXlinkLibraryObject; import org.citydb.citygml.exporter.CityGMLExportException; import org.citydb.citygml.exporter.util.AttributeValueSplitter; import org.citydb.config.geometry.GeometryObject; @@ -124,7 +124,7 @@ protected ImplicitGeometry doExport(long id, GeometryObject referencePoint, Stri isValid = true; String gmlId = rs.getString(7); - if (exporter.lookupGeometryUID(gmlId)) { + if (exporter.lookupGeometryId(gmlId)) { implicit.setRelativeGeometry(new GeometryProperty<>("#" + gmlId)); } else { geometryExporter.addImplicitGeometryBatch(geometryId, implicit); @@ -136,7 +136,7 @@ protected ImplicitGeometry doExport(long id, GeometryObject referencePoint, Stri long implicitId = rs.getLong(1); String uuid = toHexString(md5.digest(String.valueOf(implicitId).getBytes())); - if (exporter.lookupAndPutObjectUID(uuid, implicitId, MappingConstants.IMPLICIT_GEOMETRY_OBJECTCLASS_ID)) { + if (exporter.lookupAndPutObjectId(uuid, implicitId, MappingConstants.IMPLICIT_GEOMETRY_OBJECTCLASS_ID)) { implicit.setRelativeGeometry(new GeometryProperty<>("#UUID_" + uuid)); } else { GeometryObject otherGeom = exporter.getDatabaseAdapter().getGeometryConverter().getGeometry(otherGeomObj); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBReliefFeature.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBReliefFeature.java index 3e711b201..4cd35af46 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBReliefFeature.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBReliefFeature.java @@ -74,7 +74,7 @@ public DBReliefFeature(Connection connection, CityGMLExportManager exporter) thr reliefModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.RELIEF).getNamespaceURI(); lodFilter = exporter.getLodFilter(); hasObjectClassIdColumn = exporter.getDatabaseAdapter().getConnectionMetaData().getCityDBVersion().compareTo(4, 0, 0) >= 0; - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.RELIEF_FEATURE.getName(), schema); @@ -170,7 +170,7 @@ protected Collection doExport(long id, ReliefFeature root, Featur String gmlId = rs.getString("rcgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, componentId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, componentId, objectClassId)) { if (useXLink) { ReliefComponentProperty property = new ReliefComponentProperty(); property.setHref("#" + gmlId); @@ -190,7 +190,7 @@ protected Collection doExport(long id, ReliefFeature root, Featur } if (generateNewGmlId) - component.setId(exporter.generateNewGmlId(component, gmlId)); + component.setId(exporter.generateFeatureGmlId(component, gmlId)); reliefFeature.addReliefComponent(new ReliefComponentProperty(component)); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBRoom.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBRoom.java index deb8f1032..3b0b1a10f 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBRoom.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBRoom.java @@ -107,7 +107,7 @@ public DBRoom(Connection connection, CityGMLExportManager exporter) throws CityG buildingModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.BUILDING).getNamespaceURI(); lodFilter = exporter.getLodFilter(); hasObjectClassIdColumn = exporter.getDatabaseAdapter().getConnectionMetaData().getCityDBVersion().compareTo(4, 0, 0) >= 0; - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.ROOM.getName(), schema); @@ -403,7 +403,7 @@ private Map doExport(long id, Room root, FeatureType rootType, Resul String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -424,7 +424,7 @@ private Map doExport(long id, Room root, FeatureType rootType, Resul } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); // get projection filter openingProjectionFilter = exporter.getProjectionFilter(featureType); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBSplitter.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBSplitter.java index 3868727a8..b9253ce2f 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBSplitter.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBSplitter.java @@ -27,10 +27,10 @@ */ package org.citydb.citygml.exporter.database.content; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; -import org.citydb.citygml.common.database.uid.UIDCache; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCache; +import org.citydb.citygml.common.cache.model.CacheTableModel; import org.citydb.citygml.exporter.util.InternalConfig; import org.citydb.citygml.exporter.writer.FeatureWriteException; import org.citydb.citygml.exporter.writer.FeatureWriter; @@ -93,7 +93,7 @@ public class DBSplitter { private final WorkerPool dbWorkerPool; private final Query query; private final FeatureWriter writer; - private final UIDCache featureGmlIdCache; + private final IdCache featureGmlIdCache; private final CacheTableManager cacheTableManager; private final InternalConfig internalConfig; private final Config config; @@ -115,7 +115,7 @@ public DBSplitter(FeatureWriter writer, SchemaMapping schemaMapping, WorkerPool dbWorkerPool, Query query, - UIDCache featureGmlIdCache, + IdCache featureGmlIdCache, CacheTableManager cacheTableManager, EventDispatcher eventDispatcher, InternalConfig internalConfig, @@ -134,7 +134,7 @@ public DBSplitter(FeatureWriter writer, connection = DatabaseConnectionPool.getInstance().getConnection(); connection.setAutoCommit(false); schema = databaseAdapter.getConnectionDetails().getSchema(); - calculateExtent = config.getExportConfig().getCityGMLOptions().getGMLEnvelope().isUseEnvelopeOnCityModel(); + calculateExtent = config.getExportConfig().getGeneralOptions().getEnvelope().isUseEnvelopeOnCityModel(); // create temporary table for global appearances if needed if (internalConfig.isExportGlobalAppearances()) { @@ -271,7 +271,7 @@ private void queryCityObject(FeatureType cityObjectGroupType, Map(); batchSize = exporter.getGeometryBatchSize(); exportAppearance = exporter.getInternalConfig().isExportGlobalAppearances(); - useXLink = exporter.getExportConfig().getXlink().getGeometry().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportGeometryReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); - if (!useXLink) { - appendOldGmlId = exporter.getExportConfig().getXlink().getGeometry().isSetAppendId(); - gmlIdPrefix = exporter.getExportConfig().getXlink().getGeometry().getIdPrefix(); - } - Table table = new Table(TableEnum.SURFACE_GEOMETRY.getName(), schema); Select select = new Select().addProjection(table.getColumn("id"), table.getColumn("gmlid"), table.getColumn("parent_id"), table.getColumn("is_solid"), table.getColumn("is_composite"), table.getColumn("is_triangulated"), @@ -318,7 +309,7 @@ else if (geomNode.isSolid) // check for xlinks if (geomNode.gmlId != null && geomNode.isXlink > 0 - && exporter.lookupAndPutGeometryUID(geomNode.gmlId, geomNode.id, geomNode.isXlink == XlinkType.LOCAL.value())) { + && exporter.lookupAndPutGeometryId(geomNode.gmlId, geomNode.id, geomNode.isXlink == XlinkType.LOCAL.value())) { if (useXLink) { // check whether we have to embrace the geometry with an orientableSurface return geomNode.isReverse != isSetOrientableSurface ? @@ -326,11 +317,7 @@ else if (geomNode.isSolid) new SurfaceGeometry("#" + geomNode.gmlId, surfaceGeometryType); } else { geomNode.isXlink = XlinkType.NONE.value(); - String gmlId = DefaultGMLIdManager.getInstance().generateUUID(gmlIdPrefix); - if (appendOldGmlId) - gmlId = gmlId + "-" + geomNode.gmlId; - - geomNode.gmlId = gmlId; + geomNode.gmlId = exporter.generateGeometryGmlId(geomNode.gmlId); return rebuildGeometry(geomNode, isSetOrientableSurface, true); } } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBThematicSurface.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBThematicSurface.java index fdfd6ae6b..d2d727c6e 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBThematicSurface.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBThematicSurface.java @@ -82,7 +82,7 @@ public DBThematicSurface(Connection connection, CityGMLExportManager exporter) t CombinedProjectionFilter projectionFilter = exporter.getCombinedProjectionFilter(TableEnum.THEMATIC_SURFACE.getName()); buildingModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.BUILDING).getNamespaceURI(); lodFilter = exporter.getLodFilter(); - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.THEMATIC_SURFACE.getName(), schema); @@ -196,7 +196,7 @@ protected Collection doExport(long id, AbstractBoundary String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { OpeningProperty openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -216,7 +216,7 @@ protected Collection doExport(long id, AbstractBoundary } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); // get projection filter ProjectionFilter openingProjectionFilter = exporter.getProjectionFilter(featureType); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnel.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnel.java index 1d129abef..b521ef20d 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnel.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnel.java @@ -103,7 +103,7 @@ public DBTunnel(Connection connection, CityGMLExportManager exporter) throws Cit tunnelModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.TUNNEL).getNamespaceURI(); lodFilter = exporter.getLodFilter(); hasObjectClassIdColumn = exporter.getDatabaseAdapter().getConnectionMetaData().getCityDBVersion().compareTo(4, 0, 0) >= 0; - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.TUNNEL.getName(), schema); @@ -480,7 +480,7 @@ protected Collection doExport(long id, AbstractTunnel root, Feat String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -501,7 +501,7 @@ protected Collection doExport(long id, AbstractTunnel root, Feat } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); openingProperty = new OpeningProperty(opening); boundarySurface.getOpening().add(openingProperty); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelHollowSpace.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelHollowSpace.java index 802d5ed8b..4cb492495 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelHollowSpace.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelHollowSpace.java @@ -102,7 +102,7 @@ public DBTunnelHollowSpace(Connection connection, CityGMLExportManager exporter) tunnelModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.TUNNEL).getNamespaceURI(); lodFilter = exporter.getLodFilter(); hasObjectClassIdColumn = exporter.getDatabaseAdapter().getConnectionMetaData().getCityDBVersion().compareTo(4, 0, 0) >= 0; - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.TUNNEL_HOLLOW_SPACE.getName(), schema); @@ -391,7 +391,7 @@ private Map doExport(long id, HollowSpace root, FeatureType r String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -412,7 +412,7 @@ private Map doExport(long id, HollowSpace root, FeatureType r } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); openingProperty = new OpeningProperty(opening); boundarySurface.getOpening().add(openingProperty); diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelInstallation.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelInstallation.java index 1f7ac4ef2..d70342983 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelInstallation.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelInstallation.java @@ -107,7 +107,7 @@ public DBTunnelInstallation(Connection connection, CityGMLExportManager exporter CombinedProjectionFilter projectionFilter = exporter.getCombinedProjectionFilter(TableEnum.TUNNEL_INSTALLATION.getName()); tunnelModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.TUNNEL).getNamespaceURI(); lodFilter = exporter.getLodFilter(); - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.TUNNEL_INSTALLATION.getName(), schema); @@ -482,7 +482,7 @@ private Map doExport(long id, AbstractCityObject root, String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { OpeningProperty openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -502,7 +502,7 @@ private Map doExport(long id, AbstractCityObject root, } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); boundarySurface.getOpening().add(new OpeningProperty(opening)); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelThematicSurface.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelThematicSurface.java index f7176267c..b02fe335a 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelThematicSurface.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBTunnelThematicSurface.java @@ -77,7 +77,7 @@ public DBTunnelThematicSurface(Connection connection, CityGMLExportManager expor CombinedProjectionFilter projectionFilter = exporter.getCombinedProjectionFilter(TableEnum.TUNNEL_THEMATIC_SURFACE.getName()); tunnelModule = exporter.getTargetCityGMLVersion().getCityGMLModule(CityGMLModuleType.TUNNEL).getNamespaceURI(); lodFilter = exporter.getLodFilter(); - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.TUNNEL_THEMATIC_SURFACE.getName(), schema); @@ -185,7 +185,7 @@ protected Collection doExport(long id, AbstractBoundary String gmlId = rs.getString("opgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, openingId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, openingId, objectClassId)) { if (useXLink) { OpeningProperty openingProperty = new OpeningProperty(); openingProperty.setHref("#" + gmlId); @@ -205,7 +205,7 @@ protected Collection doExport(long id, AbstractBoundary } if (generateNewGmlId) - opening.setId(exporter.generateNewGmlId(opening, gmlId)); + opening.setId(exporter.generateFeatureGmlId(opening, gmlId)); boundarySurface.addOpening(new OpeningProperty(opening)); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBWaterBody.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBWaterBody.java index 1af88b4ca..124836882 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBWaterBody.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/content/DBWaterBody.java @@ -90,7 +90,7 @@ public DBWaterBody(Connection connection, CityGMLExportManager exporter) throws waterBodyModule = targetVersion.getCityGMLModule(CityGMLModuleType.WATER_BODY).getNamespaceURI(); lodFilter = exporter.getLodFilter(); hasObjectClassIdColumn = exporter.getDatabaseAdapter().getConnectionMetaData().getCityDBVersion().compareTo(4, 0, 0) >= 0; - useXLink = exporter.getExportConfig().getXlink().getFeature().isModeXLink(); + useXLink = exporter.getInternalConfig().isExportFeatureReferences(); String schema = exporter.getDatabaseAdapter().getConnectionDetails().getSchema(); table = new Table(TableEnum.WATERBODY.getName(), schema); @@ -315,7 +315,7 @@ protected Collection doExport(long id, WaterBody root, FeatureType ro String gmlId = rs.getString("wsgmlid"); boolean generateNewGmlId = false; if (!rs.wasNull()) { - if (exporter.lookupAndPutObjectUID(gmlId, waterBoundarySurfaceId, objectClassId)) { + if (exporter.lookupAndPutObjectId(gmlId, waterBoundarySurfaceId, objectClassId)) { if (useXLink) { BoundedByWaterSurfaceProperty boundedByProperty = new BoundedByWaterSurfaceProperty(); boundedByProperty.setHref("#" + gmlId); @@ -335,7 +335,7 @@ protected Collection doExport(long id, WaterBody root, FeatureType ro } if (generateNewGmlId) - waterBoundarySurface.setId(exporter.generateNewGmlId(waterBoundarySurface, gmlId)); + waterBoundarySurface.setId(exporter.generateFeatureGmlId(waterBoundarySurface, gmlId)); waterBody.addBoundedBySurface(new BoundedByWaterSurfaceProperty(waterBoundarySurface)); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/xlink/DBXlinkExporterLibraryObject.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/xlink/DBXlinkExporterLibraryObject.java index 1bf5318b1..df5f18749 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/xlink/DBXlinkExporterLibraryObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/xlink/DBXlinkExporterLibraryObject.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.exporter.database.xlink; -import org.citydb.citygml.common.database.xlink.DBXlinkLibraryObject; +import org.citydb.citygml.common.xlink.DBXlinkLibraryObject; import org.citydb.database.adapter.BlobExportAdapter; import org.citydb.database.adapter.BlobType; import org.citydb.file.FileType; diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/xlink/DBXlinkExporterTextureImage.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/xlink/DBXlinkExporterTextureImage.java index 40139f908..984f7bf44 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/database/xlink/DBXlinkExporterTextureImage.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/database/xlink/DBXlinkExporterTextureImage.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.exporter.database.xlink; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureFile; +import org.citydb.citygml.common.xlink.DBXlinkTextureFile; import org.citydb.config.Config; import org.citydb.database.adapter.BlobExportAdapter; import org.citydb.database.adapter.BlobType; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/xal/AddressExportFactory.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/util/AddressExportFactory.java similarity index 98% rename from impexp-core/src/main/java/org/citydb/citygml/common/xal/AddressExportFactory.java rename to impexp-core/src/main/java/org/citydb/citygml/exporter/util/AddressExportFactory.java index 89cb404f9..e6afb4112 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/xal/AddressExportFactory.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/util/AddressExportFactory.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.xal; +package org.citydb.citygml.exporter.util; import org.citydb.config.project.exporter.AddressMode; import org.citydb.config.project.exporter.ExportConfig; diff --git a/impexp-core/src/main/java/org/citydb/citygml/common/xal/AddressObject.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/util/AddressObject.java similarity index 98% rename from impexp-core/src/main/java/org/citydb/citygml/common/xal/AddressObject.java rename to impexp-core/src/main/java/org/citydb/citygml/exporter/util/AddressObject.java index 20bceb6a4..c16776ebe 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/common/xal/AddressObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/util/AddressObject.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.common.xal; +package org.citydb.citygml.exporter.util; import org.citydb.config.project.exporter.AddressMode; import org.citygml4j.model.gml.geometry.aggregates.MultiPointProperty; diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/util/InternalConfig.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/util/InternalConfig.java index dcf24dc03..ab202eabb 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/util/InternalConfig.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/util/InternalConfig.java @@ -28,14 +28,18 @@ package org.citydb.citygml.exporter.util; +import org.citydb.config.project.exporter.OutputFormat; import org.citydb.file.OutputFile; public class InternalConfig { private OutputFile outputFile; + private OutputFormat outputFormat; private String exportTextureURI; private boolean transformCoordinates = false; private boolean exportGlobalAppearances = false; private boolean registerGmlIdInCache = false; + private boolean exportFeatureReferences = true; + private boolean exportGeometryReferences = true; public OutputFile getOutputFile() { return outputFile; @@ -45,6 +49,14 @@ public void setOutputFile(OutputFile outputFile) { this.outputFile = outputFile; } + public OutputFormat getOutputFormat() { + return outputFormat != null ? outputFormat : OutputFormat.CITYGML; + } + + public void setOutputFormat(OutputFormat outputFormat) { + this.outputFormat = outputFormat; + } + public String getExportTextureURI() { return exportTextureURI; } @@ -76,4 +88,20 @@ public boolean isRegisterGmlIdInCache() { public void setRegisterGmlIdInCache(boolean registerGmlIdInCache) { this.registerGmlIdInCache = registerGmlIdInCache; } + + public boolean isExportFeatureReferences() { + return exportFeatureReferences; + } + + public void setExportFeatureReferences(boolean exportFeatureReferences) { + this.exportFeatureReferences = exportFeatureReferences; + } + + public boolean isExportGeometryReferences() { + return exportGeometryReferences; + } + + public void setExportGeometryReferences(boolean exportGeometryReferences) { + this.exportGeometryReferences = exportGeometryReferences; + } } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/FeatureWriterFactory.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/FeatureWriterFactory.java index 6c0e9af91..702791e39 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/FeatureWriterFactory.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/FeatureWriterFactory.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.exporter.writer; -import java.io.Writer; +import java.io.OutputStream; public interface FeatureWriterFactory { - FeatureWriter createFeatureWriter(Writer writer) throws FeatureWriteException; + FeatureWriter createFeatureWriter(OutputStream outputStream) throws FeatureWriteException; } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/FeatureWriterFactoryBuilder.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/FeatureWriterFactoryBuilder.java index 31bc84411..6bbebaab7 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/FeatureWriterFactoryBuilder.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/FeatureWriterFactoryBuilder.java @@ -27,14 +27,18 @@ */ package org.citydb.citygml.exporter.writer; +import org.citydb.citygml.exporter.writer.citygml.CityGMLWriterFactory; +import org.citydb.citygml.exporter.writer.cityjson.CityJSONWriterFactory; import org.citydb.config.Config; +import org.citydb.config.project.exporter.OutputFormat; import org.citydb.database.schema.mapping.SchemaMapping; import org.citydb.query.Query; public class FeatureWriterFactoryBuilder { - public static FeatureWriterFactory buildFactory(Query query, SchemaMapping schemaMapping, Config config) throws FeatureWriteException { - return new CityGMLWriterFactory(query, schemaMapping, config); + public static FeatureWriterFactory buildFactory(OutputFormat outputFormat, Query query, SchemaMapping schemaMapping, Config config) throws FeatureWriteException { + return outputFormat == OutputFormat.CITYJSON ? + new CityJSONWriterFactory(query, config) : + new CityGMLWriterFactory(query, schemaMapping, config); } - } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/CityGMLWriter.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/citygml/CityGMLWriter.java similarity index 98% rename from impexp-core/src/main/java/org/citydb/citygml/exporter/writer/CityGMLWriter.java rename to impexp-core/src/main/java/org/citydb/citygml/exporter/writer/citygml/CityGMLWriter.java index f9667cc95..78b752efa 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/CityGMLWriter.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/citygml/CityGMLWriter.java @@ -25,9 +25,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.exporter.writer; +package org.citydb.citygml.exporter.writer.citygml; import org.citydb.citygml.exporter.util.Metadata; +import org.citydb.citygml.exporter.writer.FeatureWriteException; +import org.citydb.citygml.exporter.writer.FeatureWriter; import org.citydb.concurrent.SingleWorkerPool; import org.citydb.config.geometry.BoundingBox; import org.citydb.event.Event; diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/CityGMLWriterFactory.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/citygml/CityGMLWriterFactory.java similarity index 88% rename from impexp-core/src/main/java/org/citydb/citygml/exporter/writer/CityGMLWriterFactory.java rename to impexp-core/src/main/java/org/citydb/citygml/exporter/writer/citygml/CityGMLWriterFactory.java index 26f4b3198..fb17033d9 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/CityGMLWriterFactory.java +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/citygml/CityGMLWriterFactory.java @@ -25,10 +25,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.exporter.writer; +package org.citydb.citygml.exporter.writer.citygml; import org.citydb.ade.model.module.CityDBADE100Module; import org.citydb.ade.model.module.CityDBADE200Module; +import org.citydb.citygml.exporter.writer.FeatureWriteException; +import org.citydb.citygml.exporter.writer.FeatureWriter; +import org.citydb.citygml.exporter.writer.FeatureWriterFactory; import org.citydb.config.Config; import org.citydb.config.project.exporter.CityGMLOptions; import org.citydb.config.project.exporter.Namespace; @@ -56,7 +59,8 @@ import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.stream.StreamSource; import java.io.File; -import java.io.Writer; +import java.io.IOException; +import java.io.OutputStream; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -67,11 +71,11 @@ public class CityGMLWriterFactory implements FeatureWriterFactory { private final Config config; private final CityGMLVersion version; private final FeatureTypeFilter featureTypeFilter; + private final CityGMLOptions cityGMLOptions; + private final boolean useSequentialWriting; private TransformerChainFactory transformerChainFactory; - private CityGMLOptions cityGMLOptions; private boolean setAllCityGMLPrefixes; - private boolean useSequentialWriting; public CityGMLWriterFactory(Query query, SchemaMapping schemaMapping, Config config) throws FeatureWriteException { this.config = config; @@ -84,12 +88,12 @@ public CityGMLWriterFactory(Query query, SchemaMapping schemaMapping, Config con useSequentialWriting = query.isSetSorting(); // build XSLT transformer chain - if (config.getExportConfig().getXSLTransformation().isEnabled() - && config.getExportConfig().getXSLTransformation().isSetStylesheets()) { + if (cityGMLOptions.getXSLTransformation().isEnabled() + && cityGMLOptions.getXSLTransformation().isSetStylesheets()) { try { log.info("Applying XSL transformations on export data."); - List stylesheets = config.getExportConfig().getXSLTransformation().getStylesheets(); + List stylesheets = cityGMLOptions.getXSLTransformation().getStylesheets(); SAXTransformerFactory factory = (SAXTransformerFactory) TransformerFactory.newInstance(); Templates[] templates = new Templates[stylesheets.size()]; @@ -113,12 +117,16 @@ public CityGMLWriterFactory(Query query, SchemaMapping schemaMapping, Config con } @Override - public FeatureWriter createFeatureWriter(Writer writer) { - SAXWriter saxWriter = new SAXWriter(); - + public FeatureWriter createFeatureWriter(OutputStream outputStream) throws FeatureWriteException { // prepare SAX writer - saxWriter.setWriteEncoding(true); - saxWriter.setIndentString(" "); + SAXWriter saxWriter; + try { + saxWriter = new SAXWriter(outputStream, config.getExportConfig().getGeneralOptions().getFileEncoding()); + saxWriter.setWriteEncoding(true); + saxWriter.setIndentString(config.getExportConfig().getCityGMLOptions().isPrettyPrint() ? " " : ""); + } catch (IOException e) { + throw new FeatureWriteException("Failed to create CityGML writer.", e); + } if (cityGMLOptions.isWriteProductHeader()) { saxWriter.setHeaderComment("Written by " + this.getClass().getPackage().getImplementationTitle() + ", version \"" + @@ -197,9 +205,6 @@ public FeatureWriter createFeatureWriter(Writer writer) { } } - // set writer as output for SAXWriter - saxWriter.setOutput(writer); - // create CityGML writer return new CityGMLWriter(saxWriter, version, transformerChainFactory, useSequentialWriting); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/cityjson/CityJSONWriter.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/cityjson/CityJSONWriter.java new file mode 100644 index 000000000..9ea444b49 --- /dev/null +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/cityjson/CityJSONWriter.java @@ -0,0 +1,184 @@ +package org.citydb.citygml.exporter.writer.cityjson; + +import org.citydb.citygml.exporter.util.Metadata; +import org.citydb.citygml.exporter.writer.FeatureWriteException; +import org.citydb.citygml.exporter.writer.FeatureWriter; +import org.citydb.concurrent.SingleWorkerPool; +import org.citydb.config.Config; +import org.citydb.config.geometry.BoundingBox; +import org.citydb.config.project.database.DatabaseSrs; +import org.citydb.event.Event; +import org.citydb.event.EventDispatcher; +import org.citydb.event.EventHandler; +import org.citydb.event.global.EventType; +import org.citydb.registry.ObjectRegistry; +import org.citydb.writer.CityJSONWriterWorkerFactory; +import org.citydb.writer.SequentialWriter; +import org.citygml4j.builder.cityjson.json.io.writer.CityJSONChunkWriter; +import org.citygml4j.builder.cityjson.json.io.writer.CityJSONWriteException; +import org.citygml4j.builder.cityjson.marshal.CityJSONMarshaller; +import org.citygml4j.cityjson.CityJSON; +import org.citygml4j.cityjson.feature.AbstractCityObjectType; +import org.citygml4j.cityjson.metadata.MetadataType; +import org.citygml4j.model.citygml.core.AbstractCityObject; +import org.citygml4j.model.gml.feature.AbstractFeature; + +import java.util.Arrays; + +public class CityJSONWriter implements FeatureWriter, EventHandler { + private final CityJSONChunkWriter writer; + private final DatabaseSrs targetSrs; + private final boolean useSequentialWriting; + private final boolean addSequenceId; + private final CityJSONMarshaller marshaller; + private final SingleWorkerPool writerPool; + private final EventDispatcher eventDispatcher; + + private Metadata metadata; + private SequentialWriter sequentialWriter; + private boolean hasContent; + + CityJSONWriter(CityJSONChunkWriter writer, Config config, DatabaseSrs targetSrs, boolean useSequentialWriting) { + this.writer = writer; + this.targetSrs = targetSrs; + this.useSequentialWriting = useSequentialWriting; + + addSequenceId = config.getExportConfig().getCityJSONOptions().isAddSequenceIdWhenSorting(); + marshaller = writer.getCityJSONMarshaller(); + eventDispatcher = ObjectRegistry.getInstance().getEventDispatcher(); + eventDispatcher.addEventHandler(EventType.INTERRUPT, this); + + writerPool = new SingleWorkerPool<>( + "cityjson_writer_pool", + new CityJSONWriterWorkerFactory(writer, ObjectRegistry.getInstance().getEventDispatcher()), + config.getExportConfig().getResources().getThreadPool().getMaxThreads() * 2, + false); + + writerPool.prestartCoreWorkers(); + + if (useSequentialWriting) { + sequentialWriter = new SequentialWriter<>(writerPool); + } + } + + @Override + public void writeHeader() throws FeatureWriteException { + // nothing to do + } + + @Override + public void write(AbstractFeature feature, long sequenceId) throws FeatureWriteException { + if (feature instanceof AbstractCityObject) { + CityJSON cityJSON = new CityJSON(); + + AbstractCityObjectType cityObject = marshaller.marshal((AbstractCityObject) feature, cityJSON); + for (AbstractCityObjectType child : cityJSON.getCityObjects()) { + writerPool.addWork(child); + } + + if (cityJSON.isSetExtensionProperties()) { + cityJSON.getExtensionProperties().forEach(writer::addRootExtensionProperty); + } + + if (cityObject != null) { + if (!useSequentialWriting) { + writerPool.addWork(cityObject); + } else { + try { + if (addSequenceId && sequenceId >= 0) { + cityObject.getAttributes().addExtensionAttribute("sequenceId", sequenceId); + } + + sequentialWriter.write(cityObject, sequenceId); + } catch (InterruptedException e) { + throw new FeatureWriteException("Failed to write city object with gml:id '" + feature.getId() + "'.", e); + } + } + } + + hasContent = cityObject != null || cityJSON.hasCityObjects(); + } + } + + @Override + public void updateSequenceId(long sequenceId) throws FeatureWriteException { + if (useSequentialWriting) { + try { + sequentialWriter.updateSequenceId(sequenceId); + } catch (InterruptedException e) { + throw new FeatureWriteException("Failed to update sequence id.", e); + } + } + } + + @Override + public void useIndentation(boolean useIndentation) { + writer.setIndent(useIndentation ? " " : ""); + } + + @Override + public Metadata getMetadata() { + if (metadata == null) { + metadata = new Metadata(); + } + + return metadata; + } + + @Override + public void close() throws FeatureWriteException { + try { + writerPool.shutdownAndWait(); + + // add metadata + if (hasContent) { + setMetadata(); + } + + writer.writeEndDocument(); + writer.close(); + } catch (InterruptedException | CityJSONWriteException e) { + throw new FeatureWriteException("Failed to close CityJSON writer.", e); + } finally { + if (!writerPool.isTerminated()) { + writerPool.shutdownNow(); + } + + eventDispatcher.removeEventHandler(this); + } + } + + private void setMetadata() { + MetadataType metadata = new MetadataType(); + if (targetSrs != null) { + metadata.setReferenceSystem(targetSrs.getSrid()); + } + + if (this.metadata != null) { + if (this.metadata.isSetDatasetName()) { + metadata.setDatasetTitle(this.metadata.getDatasetName()); + } + + if (this.metadata.isSetDatasetDescription()) { + metadata.setAbstract(this.metadata.getDatasetDescription()); + } + + if (this.metadata.isSetSpatialExtent() + && this.metadata.getSpatialExtent().is3D()) { + BoundingBox bbox = this.metadata.getSpatialExtent(); + metadata.setGeographicalExtent(Arrays.asList( + bbox.getLowerCorner().getX(), bbox.getLowerCorner().getY(), bbox.getLowerCorner().getZ(), + bbox.getUpperCorner().getX(), bbox.getUpperCorner().getY(), bbox.getUpperCorner().getZ())); + } + } + + writer.setMetadata(metadata); + } + + @Override + public void handleEvent(Event event) throws Exception { + if (useSequentialWriting) { + sequentialWriter.interrupt(); + } + } +} diff --git a/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/cityjson/CityJSONWriterFactory.java b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/cityjson/CityJSONWriterFactory.java new file mode 100644 index 000000000..5c2e4a69b --- /dev/null +++ b/impexp-core/src/main/java/org/citydb/citygml/exporter/writer/cityjson/CityJSONWriterFactory.java @@ -0,0 +1,67 @@ +package org.citydb.citygml.exporter.writer.cityjson; + +import org.citydb.citygml.exporter.writer.FeatureWriteException; +import org.citydb.citygml.exporter.writer.FeatureWriter; +import org.citydb.citygml.exporter.writer.FeatureWriterFactory; +import org.citydb.config.Config; +import org.citydb.config.project.database.DatabaseSrs; +import org.citydb.config.project.exporter.CityJSONOptions; +import org.citydb.query.Query; +import org.citygml4j.CityGMLContext; +import org.citygml4j.builder.cityjson.CityJSONBuilder; +import org.citygml4j.builder.cityjson.CityJSONBuilderException; +import org.citygml4j.builder.cityjson.json.io.writer.CityJSONChunkWriter; +import org.citygml4j.builder.cityjson.json.io.writer.CityJSONOutputFactory; +import org.citygml4j.builder.cityjson.json.io.writer.CityJSONWriteException; +import org.citygml4j.builder.cityjson.marshal.util.DefaultTextureVerticesBuilder; +import org.citygml4j.builder.cityjson.marshal.util.DefaultVerticesBuilder; +import org.citygml4j.builder.cityjson.marshal.util.DefaultVerticesTransformer; + +import java.io.OutputStream; + +public class CityJSONWriterFactory implements FeatureWriterFactory { + private final CityJSONOutputFactory factory; + private final Config config; + private final DatabaseSrs targetSrs; + private final boolean useSequentialWriting; + + public CityJSONWriterFactory(Query query, Config config) throws FeatureWriteException { + this.config = config; + + try { + CityJSONBuilder builder = CityGMLContext.getInstance().createCityJSONBuilder(); + factory = builder.createCityJSONOutputFactory(); + factory.setRemoveDuplicateChildGeometries(config.getExportConfig().getCityJSONOptions().isRemoveDuplicateChildGeometries()); + } catch (CityJSONBuilderException e) { + throw new FeatureWriteException("Failed to initialize CityJSON output factory.", e); + } + + targetSrs = query.getTargetSrs(); + useSequentialWriting = query.isSetSorting(); + } + + @Override + public FeatureWriter createFeatureWriter(OutputStream outputStream) throws FeatureWriteException { + CityJSONChunkWriter chunkWriter; + try { + chunkWriter = factory.createCityJSONChunkWriter(outputStream, config.getExportConfig().getGeneralOptions().getFileEncoding()); + } catch (CityJSONWriteException e) { + throw new FeatureWriteException("Failed to create CityJSON writer.", e); + } + + chunkWriter.setCalcBoundingBox(config.getExportConfig().getGeneralOptions().getEnvelope().isUseEnvelopeOnCityModel()); + + CityJSONOptions cityJSONOptions = config.getExportConfig().getCityJSONOptions(); + chunkWriter.setIndent(cityJSONOptions.isPrettyPrint() ? " " : ""); + chunkWriter.setVerticesBuilder(new DefaultVerticesBuilder() + .withSignificantDigits(cityJSONOptions.getSignificantDigits())); + chunkWriter.setTextureVerticesBuilder(new DefaultTextureVerticesBuilder() + .withSignificantDigits(cityJSONOptions.getSignificantTextureDigits())); + + if (cityJSONOptions.isUseGeometryCompression()) { + chunkWriter.setVerticesTransformer(new DefaultVerticesTransformer()); + } + + return new CityJSONWriter(chunkWriter, config, targetSrs, useSequentialWriting); + } +} diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/uid/GeometryGmlIdCache.java b/impexp-core/src/main/java/org/citydb/citygml/importer/cache/GeometryGmlIdCache.java similarity index 77% rename from impexp-core/src/main/java/org/citydb/citygml/importer/database/uid/GeometryGmlIdCache.java rename to impexp-core/src/main/java/org/citydb/citygml/importer/cache/GeometryGmlIdCache.java index 5c008579c..6cc7de95d 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/uid/GeometryGmlIdCache.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/cache/GeometryGmlIdCache.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.importer.database.uid; +package org.citydb.citygml.importer.cache; + +import org.citydb.citygml.common.cache.BranchCacheTable; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.cache.IdCachingModel; +import org.citydb.citygml.common.cache.model.CacheTableModel; import java.sql.Connection; import java.sql.PreparedStatement; @@ -36,36 +43,28 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReentrantLock; -import org.citydb.citygml.common.database.cache.BranchCacheTable; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.uid.UIDCachingModel; - -public class GeometryGmlIdCache implements UIDCachingModel { +public class GeometryGmlIdCache implements IdCachingModel { + private final ReentrantLock mainLock = new ReentrantLock(); private final int partitions; private final CacheTableModel cacheTableModel; private final CacheTableManager cacheTableManager; - private final ReentrantLock mainLock = new ReentrantLock(); - private BranchCacheTable branchTable; - - private CacheTable[] backUpTables; - private PreparedStatement[] psLookupIds; - private PreparedStatement[] psDrains; - private ReentrantLock[] locks; - private boolean[] isIndexed; - private int[] batchCounters; + private final CacheTable[] backUpTables; + private final PreparedStatement[] psLookupIds; + private final PreparedStatement[] psDrains; + private final ReentrantLock[] locks; + private final boolean[] isIndexed; + private final int[] batchCounters; + private final int batchSize; - private int batchSize; + private BranchCacheTable branchTable; public GeometryGmlIdCache(CacheTableManager cacheTableManager, int partitions, int batchSize) throws SQLException { this.cacheTableManager = cacheTableManager; this.partitions = partitions; this.batchSize = batchSize; - cacheTableModel = CacheTableModel.GMLID_GEOMETRY; + cacheTableModel = CacheTableModel.GEOMETRY_GMLID; backUpTables = new CacheTable[partitions]; psLookupIds = new PreparedStatement[partitions]; psDrains = new PreparedStatement[partitions]; @@ -73,18 +72,19 @@ public GeometryGmlIdCache(CacheTableManager cacheTableManager, int partitions, i isIndexed = new boolean[partitions]; batchCounters = new int[partitions]; - for (int i = 0; i < partitions; i++) + for (int i = 0; i < partitions; i++) { locks[i] = new ReentrantLock(); + } } @Override - public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException { + public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException { int drainCounter = 0; // firstly, try and write those entries which have not been requested so far - Iterator> iter = map.entrySet().iterator(); + Iterator> iter = map.entrySet().iterator(); while (drainCounter <= drain && iter.hasNext()) { - Map.Entry entry = iter.next(); + Map.Entry entry = iter.next(); if (!entry.getValue().isRequested()) { String gmlId = entry.getKey(); @@ -115,7 +115,7 @@ public void drainToDB(ConcurrentHashMap map, int drain) t // secondly, drain remaining entries until drain limit iter = map.entrySet().iterator(); while (drainCounter <= drain && iter.hasNext()) { - Map.Entry entry = iter.next(); + Map.Entry entry = iter.next(); String gmlId = entry.getKey(); // determine partition for gml:id @@ -142,52 +142,41 @@ public void drainToDB(ConcurrentHashMap map, int drain) t } // finally execute batches - for (int i = 0; i < psDrains.length; i++) - if (psDrains[i] != null && batchCounters[i] > 0) + for (int i = 0; i < psDrains.length; i++) { + if (psDrains[i] != null && batchCounters[i] > 0) { psDrains[i].executeBatch(); + } + } } @Override - public UIDCacheEntry lookupDB(String key) throws SQLException { + public IdCacheEntry lookupDB(String key) throws SQLException { // determine partition for gml:id int partition = Math.abs(key.hashCode() % partitions); initializePartition(partition); // enable indexes upon first lookup - if (!isIndexed[partition]) + if (!isIndexed[partition]) { enableIndexesOnCacheTable(partition); + } // lock partition final ReentrantLock tableLock = this.locks[partition]; tableLock.lock(); try { - ResultSet rs = null; - - try { - psLookupIds[partition].setString(1, key); - rs = psLookupIds[partition].executeQuery(); - + psLookupIds[partition].setString(1, key); + try (ResultSet rs = psLookupIds[partition].executeQuery()) { if (rs.next()) { long id = rs.getLong(1); long rootId = rs.getLong(2); boolean reverse = rs.getBoolean(3); String mapping = rs.getString(4); - return new UIDCacheEntry(id, rootId, reverse, mapping); + return new IdCacheEntry(id, rootId, reverse, mapping); } return null; - } finally { - if (rs != null) { - try { - rs.close(); - } catch (SQLException sqlEx) { - // - } - - rs = null; - } } } finally { tableLock.unlock(); @@ -196,9 +185,17 @@ public UIDCacheEntry lookupDB(String key) throws SQLException { @Override public void close() throws SQLException { - for (PreparedStatement ps : psDrains) - if (ps != null) + for (PreparedStatement ps : psDrains) { + if (ps != null) { ps.close(); + } + } + + for (PreparedStatement ps : psLookupIds) { + if (ps != null) { + ps.close(); + } + } } @Override @@ -225,8 +222,9 @@ private void initializePartition(int partition) throws SQLException { mainLock.lock(); try { - if (branchTable == null) + if (branchTable == null) { branchTable = cacheTableManager.createBranchCacheTable(cacheTableModel); + } } finally { mainLock.unlock(); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/uid/FeatureGmlIdCache.java b/impexp-core/src/main/java/org/citydb/citygml/importer/cache/ObjectGmlIdCache.java similarity index 74% rename from impexp-core/src/main/java/org/citydb/citygml/importer/database/uid/FeatureGmlIdCache.java rename to impexp-core/src/main/java/org/citydb/citygml/importer/cache/ObjectGmlIdCache.java index 525b307c1..3dd73289b 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/uid/FeatureGmlIdCache.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/cache/ObjectGmlIdCache.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.importer.database.uid; +package org.citydb.citygml.importer.cache; + +import org.citydb.citygml.common.cache.BranchCacheTable; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.cache.IdCachingModel; +import org.citydb.citygml.common.cache.model.CacheTableModel; import java.sql.Connection; import java.sql.PreparedStatement; @@ -36,36 +43,28 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReentrantLock; -import org.citydb.citygml.common.database.cache.BranchCacheTable; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.uid.UIDCachingModel; - -public class FeatureGmlIdCache implements UIDCachingModel { +public class ObjectGmlIdCache implements IdCachingModel { + private final ReentrantLock mainLock = new ReentrantLock(); private final int partitions; private final CacheTableModel cacheTableModel; private final CacheTableManager cacheTableManager; - private final ReentrantLock mainLock = new ReentrantLock(); - private BranchCacheTable branchTable; - - private CacheTable[] backUpTables; - private PreparedStatement[] psLookupIds; - private PreparedStatement[] psDrains; - private ReentrantLock[] locks; - private boolean[] isIndexed; - private int[] batchCounters; + private final CacheTable[] backUpTables; + private final PreparedStatement[] psLookupIds; + private final PreparedStatement[] psDrains; + private final ReentrantLock[] locks; + private final boolean[] isIndexed; + private final int[] batchCounters; + private final int batchSize; - private int batchSize; + private BranchCacheTable branchTable; - public FeatureGmlIdCache(CacheTableManager cacheTableManager, int partitions, int batchSize) throws SQLException { + public ObjectGmlIdCache(CacheTableManager cacheTableManager, int partitions, int batchSize) throws SQLException { this.cacheTableManager = cacheTableManager; this.partitions = partitions; this.batchSize = batchSize; - cacheTableModel = CacheTableModel.GMLID_FEATURE; + cacheTableModel = CacheTableModel.OBJECT_GMLID; backUpTables = new CacheTable[partitions]; psLookupIds = new PreparedStatement[partitions]; psDrains = new PreparedStatement[partitions]; @@ -73,18 +72,19 @@ public FeatureGmlIdCache(CacheTableManager cacheTableManager, int partitions, in isIndexed = new boolean[partitions]; batchCounters = new int[partitions]; - for (int i = 0; i < partitions; i++) + for (int i = 0; i < partitions; i++) { locks[i] = new ReentrantLock(); + } } @Override - public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException { + public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException { int drainCounter = 0; // firstly, try and write those entries which have not been requested so far - Iterator> iter = map.entrySet().iterator(); + Iterator> iter = map.entrySet().iterator(); while (drainCounter <= drain && iter.hasNext()) { - Map.Entry entry = iter.next(); + Map.Entry entry = iter.next(); if (!entry.getValue().isRequested()) { String gmlId = entry.getKey(); @@ -114,7 +114,7 @@ public void drainToDB(ConcurrentHashMap map, int drain) t // secondly, drain remaining entries until drain limit iter = map.entrySet().iterator(); while (drainCounter <= drain && iter.hasNext()) { - Map.Entry entry = iter.next(); + Map.Entry entry = iter.next(); String gmlId = entry.getKey(); // determine partition for gml:id @@ -140,51 +140,40 @@ public void drainToDB(ConcurrentHashMap map, int drain) t } // finally execute batches - for (int i = 0; i < psDrains.length; i++) - if (psDrains[i] != null && batchCounters[i] > 0) + for (int i = 0; i < psDrains.length; i++) { + if (psDrains[i] != null && batchCounters[i] > 0) { psDrains[i].executeBatch(); + } + } } @Override - public UIDCacheEntry lookupDB(String key) throws SQLException { + public IdCacheEntry lookupDB(String key) throws SQLException { // determine partition for gml:id int partition = Math.abs(key.hashCode() % partitions); initializePartition(partition); // enable indexes upon first lookup - if (!isIndexed[partition]) + if (!isIndexed[partition]) { enableIndexesOnCacheTable(partition); + } // lock partition final ReentrantLock tableLock = this.locks[partition]; tableLock.lock(); try { - ResultSet rs = null; - - try { - psLookupIds[partition].setString(1, key); - rs = psLookupIds[partition].executeQuery(); - + psLookupIds[partition].setString(1, key); + try (ResultSet rs = psLookupIds[partition].executeQuery()) { if (rs.next()) { long id = rs.getLong(1); String mapping = rs.getString(2); int objectClassId = rs.getInt(3); - return new UIDCacheEntry(id, 0, false, mapping, objectClassId); + return new IdCacheEntry(id, 0, false, mapping, objectClassId); } return null; - } finally { - if (rs != null) { - try { - rs.close(); - } catch (SQLException sqlEx) { - // - } - - rs = null; - } } } finally { tableLock.unlock(); @@ -193,14 +182,22 @@ public UIDCacheEntry lookupDB(String key) throws SQLException { @Override public void close() throws SQLException { - for (PreparedStatement ps : psDrains) - if (ps != null) + for (PreparedStatement ps : psDrains) { + if (ps != null) { ps.close(); + } + } + + for (PreparedStatement ps : psLookupIds) { + if (ps != null) { + ps.close(); + } + } } @Override public String getType() { - return "feature"; + return "object"; } private void enableIndexesOnCacheTable(int partition) throws SQLException { @@ -222,8 +219,9 @@ private void initializePartition(int partition) throws SQLException { mainLock.lock(); try { - if (branchTable == null) + if (branchTable == null) { branchTable = cacheTableManager.createBranchCacheTable(cacheTableModel); + } } finally { mainLock.unlock(); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/uid/TextureImageCache.java b/impexp-core/src/main/java/org/citydb/citygml/importer/cache/TextureImageCache.java similarity index 77% rename from impexp-core/src/main/java/org/citydb/citygml/importer/database/uid/TextureImageCache.java rename to impexp-core/src/main/java/org/citydb/citygml/importer/cache/TextureImageCache.java index bfc335d49..b7c517210 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/uid/TextureImageCache.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/cache/TextureImageCache.java @@ -2,7 +2,7 @@ * 3D City Database - The Open Source CityGML Database * http://www.3dcitydb.org/ * - * Copyright 2013 - 2019 + * Copyright 2013 - 2021 * Chair of Geoinformatics * Technical University of Munich, Germany * https://www.gis.bgu.tum.de/ @@ -25,7 +25,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.citydb.citygml.importer.database.uid; +package org.citydb.citygml.importer.cache; + +import org.citydb.citygml.common.cache.BranchCacheTable; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.cache.IdCachingModel; +import org.citydb.citygml.common.cache.model.CacheTableModel; import java.sql.Connection; import java.sql.PreparedStatement; @@ -36,31 +43,23 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReentrantLock; -import org.citydb.citygml.common.database.cache.BranchCacheTable; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.uid.UIDCachingModel; - public class TextureImageCache -implements UIDCachingModel { +implements IdCachingModel { + private final ReentrantLock mainLock = new ReentrantLock(); private final int partitions; private final CacheTableModel cacheTableModel; private final CacheTableManager cacheTableManager; - private final ReentrantLock mainLock = new ReentrantLock(); - private BranchCacheTable branchTable; - - private CacheTable[] backUpTables; - private PreparedStatement[] psLookupIds; - private PreparedStatement[] psDrains; - private ReentrantLock[] locks; - private boolean[] isIndexed; - private int[] batchCounters; + private final CacheTable[] backUpTables; + private final PreparedStatement[] psLookupIds; + private final PreparedStatement[] psDrains; + private final ReentrantLock[] locks; + private final boolean[] isIndexed; + private final int[] batchCounters; + private final int batchSize; - private int batchSize; + private BranchCacheTable branchTable; public TextureImageCache(CacheTableManager cacheTableManager, int partitions, int batchSize) throws SQLException { this.cacheTableManager = cacheTableManager; @@ -80,13 +79,13 @@ public TextureImageCache(CacheTableManager cacheTableManager, int partitions, in } @Override - public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException { + public void drainToDB(ConcurrentHashMap map, int drain) throws SQLException { int drainCounter = 0; // firstly, try and write those entries which have been requested so far - Iterator> iter = map.entrySet().iterator(); + Iterator> iter = map.entrySet().iterator(); while (drainCounter <= drain && iter.hasNext()) { - Map.Entry entry = iter.next(); + Map.Entry entry = iter.next(); if (entry.getValue().isRequested()) { String fileURI = entry.getKey(); @@ -114,7 +113,7 @@ public void drainToDB(ConcurrentHashMap map, int drain) t // secondly, drain remaining entries until drain limit iter = map.entrySet().iterator(); while (drainCounter <= drain && iter.hasNext()) { - Map.Entry entry = iter.next(); + Map.Entry entry = iter.next(); String fileURI = entry.getKey(); // determine partition for gml:id @@ -138,49 +137,38 @@ public void drainToDB(ConcurrentHashMap map, int drain) t } // finally execute batches - for (int i = 0; i < psDrains.length; i++) - if (psDrains[i] != null && batchCounters[i] > 0) + for (int i = 0; i < psDrains.length; i++) { + if (psDrains[i] != null && batchCounters[i] > 0) { psDrains[i].executeBatch(); + } + } } @Override - public UIDCacheEntry lookupDB(String key) throws SQLException { + public IdCacheEntry lookupDB(String key) throws SQLException { // determine partition for texture image int partition = Math.abs(key.hashCode() % partitions); initializePartition(partition); // enable indexes upon first lookup - if (!isIndexed[partition]) + if (!isIndexed[partition]) { enableIndexesOnCacheTable(partition); + } // lock partition final ReentrantLock tableLock = this.locks[partition]; tableLock.lock(); try { - ResultSet rs = null; - - try { - psLookupIds[partition].setString(1, key); - rs = psLookupIds[partition].executeQuery(); - + psLookupIds[partition].setString(1, key); + try (ResultSet rs = psLookupIds[partition].executeQuery()) { if (rs.next()) { long id = rs.getLong(1); - return new UIDCacheEntry(id, 0, false, null); + return new IdCacheEntry(id, 0, false, null); } return null; - } finally { - if (rs != null) { - try { - rs.close(); - } catch (SQLException sqlEx) { - // - } - - rs = null; - } - } + } } finally { tableLock.unlock(); } @@ -188,9 +176,17 @@ public UIDCacheEntry lookupDB(String key) throws SQLException { @Override public void close() throws SQLException { - for (PreparedStatement ps : psDrains) - if (ps != null) + for (PreparedStatement ps : psDrains) { + if (ps != null) { ps.close(); + } + } + + for (PreparedStatement ps : psLookupIds) { + if (ps != null) { + ps.close(); + } + } } @Override @@ -217,8 +213,9 @@ private void initializePartition(int partition) throws SQLException { mainLock.lock(); try { - if (branchTable == null) + if (branchTable == null) { branchTable = cacheTableManager.createBranchCacheTable(cacheTableModel); + } } finally { mainLock.unlock(); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportWorker.java b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportWorker.java index 2f0850960..5b1e2ddc4 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportWorker.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportWorker.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.concurrent; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.database.content.CityGMLImportManager; import org.citydb.citygml.importer.filter.CityGMLFilter; @@ -88,7 +88,7 @@ public DBImportWorker(Connection connection, SchemaMapping schemaMapping, CityGMLBuilder cityGMLBuilder, WorkerPool xlinkPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CityGMLFilter filter, AffineTransformer affineTransformer, ImportLogger importLogger, @@ -106,7 +106,7 @@ public DBImportWorker(Connection connection, schemaMapping, cityGMLBuilder, xlinkPool, - uidCacheManager, + idCacheManager, affineTransformer, internalConfig, config); diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportWorkerFactory.java b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportWorkerFactory.java index 2ca42b90c..423a888ab 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportWorkerFactory.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportWorkerFactory.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.concurrent; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.citygml.importer.filter.CityGMLFilter; import org.citydb.citygml.importer.util.AffineTransformer; import org.citydb.citygml.importer.util.ImportLogger; @@ -58,7 +58,7 @@ public class DBImportWorkerFactory implements WorkerFactory { private final SchemaMapping schemaMapping; private final CityGMLBuilder cityGMLBuilder; private final WorkerPool xlinkWorkerPool; - private final UIDCacheManager uidCacheManager; + private final IdCacheManager idCacheManager; private final CityGMLFilter filter; private final AffineTransformer affineTransformer; private final ImportLogger importLogger; @@ -72,7 +72,7 @@ public DBImportWorkerFactory(ConnectionManager connectionManager, SchemaMapping schemaMapping, CityGMLBuilder cityGMLBuilder, WorkerPool xlinkWorkerPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CityGMLFilter filter, AffineTransformer affineTransformer, ImportLogger importLogger, @@ -85,7 +85,7 @@ public DBImportWorkerFactory(ConnectionManager connectionManager, this.schemaMapping = schemaMapping; this.cityGMLBuilder = cityGMLBuilder; this.xlinkWorkerPool = xlinkWorkerPool; - this.uidCacheManager = uidCacheManager; + this.idCacheManager = idCacheManager; this.filter = filter; this.affineTransformer = affineTransformer; this.importLogger = importLogger; @@ -97,7 +97,7 @@ public DBImportWorkerFactory(ConnectionManager connectionManager, public DBImportWorkerFactory(SchemaMapping schemaMapping, CityGMLBuilder cityGMLBuilder, WorkerPool xlinkWorkerPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CityGMLFilter filter, AffineTransformer affineTransformer, ImportLogger importLogger, @@ -105,7 +105,7 @@ public DBImportWorkerFactory(SchemaMapping schemaMapping, Config config, EventDispatcher eventDispatcher) { this(DatabaseConnectionPool.getInstance(), false, DatabaseConnectionPool.getInstance().getActiveDatabaseAdapter(), - schemaMapping, cityGMLBuilder, xlinkWorkerPool, uidCacheManager, filter, affineTransformer, importLogger, + schemaMapping, cityGMLBuilder, xlinkWorkerPool, idCacheManager, filter, affineTransformer, importLogger, internalConfig, config, eventDispatcher); } @@ -114,14 +114,14 @@ public DBImportWorkerFactory(ConnectionManager connectionManager, SchemaMapping schemaMapping, CityGMLBuilder cityGMLBuilder, WorkerPool xlinkWorkerPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CityGMLFilter filter, AffineTransformer affineTransformer, ImportLogger importLogger, InternalConfig internalConfig, Config config, EventDispatcher eventDispatcher) { - this(connectionManager, true, databaseAdapter, schemaMapping, cityGMLBuilder, xlinkWorkerPool, uidCacheManager, + this(connectionManager, true, databaseAdapter, schemaMapping, cityGMLBuilder, xlinkWorkerPool, idCacheManager, filter, affineTransformer, importLogger, internalConfig, config, eventDispatcher); } @@ -136,7 +136,7 @@ public Worker createWorker() { } dbWorker = new DBImportWorker(connection, isManagedTransaction, databaseAdapter, schemaMapping, cityGMLBuilder, - xlinkWorkerPool, uidCacheManager, filter, affineTransformer, importLogger, internalConfig, config, eventDispatcher); + xlinkWorkerPool, idCacheManager, filter, affineTransformer, importLogger, internalConfig, config, eventDispatcher); } catch (SQLException e) { log.error("Failed to create import worker.", e); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkResolverWorker.java b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkResolverWorker.java index 7c06ee101..aa62b8aef 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkResolverWorker.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkResolverWorker.java @@ -27,22 +27,22 @@ */ package org.citydb.citygml.importer.concurrent; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.xlink.DBXlink; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkDeprecatedMaterial; -import org.citydb.citygml.common.database.xlink.DBXlinkEnum; -import org.citydb.citygml.common.database.xlink.DBXlinkGroupToCityObject; -import org.citydb.citygml.common.database.xlink.DBXlinkLibraryObject; -import org.citydb.citygml.common.database.xlink.DBXlinkSolidGeometry; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceDataToTexImage; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociation; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureCoordList; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureFile; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureParam; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureParamEnum; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.xlink.DBXlink; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkDeprecatedMaterial; +import org.citydb.citygml.common.xlink.DBXlinkEnum; +import org.citydb.citygml.common.xlink.DBXlinkGroupToCityObject; +import org.citydb.citygml.common.xlink.DBXlinkLibraryObject; +import org.citydb.citygml.common.xlink.DBXlinkSolidGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceDataToTexImage; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociation; +import org.citydb.citygml.common.xlink.DBXlinkTextureCoordList; +import org.citydb.citygml.common.xlink.DBXlinkTextureFile; +import org.citydb.citygml.common.xlink.DBXlinkTextureParam; +import org.citydb.citygml.common.xlink.DBXlinkTextureParamEnum; import org.citydb.citygml.importer.database.xlink.resolver.DBXlinkResolverEnum; import org.citydb.citygml.importer.database.xlink.resolver.DBXlinkResolverManager; import org.citydb.citygml.importer.database.xlink.resolver.XlinkBasic; @@ -92,7 +92,7 @@ public DBImportXlinkResolverWorker(InputFile inputFile, boolean isManagedTransaction, AbstractDatabaseAdapter databaseAdapter, WorkerPool tmpXlinkPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CacheTableManager cacheTableManager, Config config, EventDispatcher eventDispatcher) throws SQLException { @@ -109,7 +109,7 @@ public DBImportXlinkResolverWorker(InputFile inputFile, connection, databaseAdapter, tmpXlinkPool, - uidCacheManager, + idCacheManager, cacheTableManager, config, eventDispatcher); diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkResolverWorkerFactory.java b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkResolverWorkerFactory.java index ffa0f411a..32d62a061 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkResolverWorkerFactory.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkResolverWorkerFactory.java @@ -27,9 +27,9 @@ */ package org.citydb.citygml.importer.concurrent; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.concurrent.Worker; import org.citydb.concurrent.WorkerFactory; import org.citydb.concurrent.WorkerPool; @@ -52,7 +52,7 @@ public class DBImportXlinkResolverWorkerFactory implements WorkerFactory tmpXlinkPool; - private final UIDCacheManager uidCacheManager; + private final IdCacheManager idCacheManager; private final CacheTableManager cacheTableManager; private final Config config; private final EventDispatcher eventDispatcher; @@ -62,7 +62,7 @@ public DBImportXlinkResolverWorkerFactory(InputFile inputFile, boolean isManagedTransaction, AbstractDatabaseAdapter databaseAdapter, WorkerPool tmpXlinkPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CacheTableManager cacheTableManager, Config config, EventDispatcher eventDispatcher) { @@ -71,7 +71,7 @@ public DBImportXlinkResolverWorkerFactory(InputFile inputFile, this.isManagedTransaction = isManagedTransaction; this.databaseAdapter = databaseAdapter; this.tmpXlinkPool = tmpXlinkPool; - this.uidCacheManager = uidCacheManager; + this.idCacheManager = idCacheManager; this.cacheTableManager = cacheTableManager; this.config = config; this.eventDispatcher = eventDispatcher; @@ -79,23 +79,23 @@ public DBImportXlinkResolverWorkerFactory(InputFile inputFile, public DBImportXlinkResolverWorkerFactory(InputFile inputFile, WorkerPool tmpXlinkPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CacheTableManager cacheTableManager, Config config, EventDispatcher eventDispatcher) { this(inputFile, DatabaseConnectionPool.getInstance(), false, DatabaseConnectionPool.getInstance().getActiveDatabaseAdapter(), - tmpXlinkPool, uidCacheManager, cacheTableManager, config, eventDispatcher); + tmpXlinkPool, idCacheManager, cacheTableManager, config, eventDispatcher); } public DBImportXlinkResolverWorkerFactory(InputFile inputFile, ConnectionManager connectionManager, AbstractDatabaseAdapter databaseAdapter, WorkerPool tmpXlinkPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CacheTableManager cacheTableManager, Config config, EventDispatcher eventDispatcher) { - this(inputFile, connectionManager, true, databaseAdapter, tmpXlinkPool, uidCacheManager, cacheTableManager, config, eventDispatcher); + this(inputFile, connectionManager, true, databaseAdapter, tmpXlinkPool, idCacheManager, cacheTableManager, config, eventDispatcher); } @Override @@ -109,7 +109,7 @@ public Worker createWorker() { } dbWorker = new DBImportXlinkResolverWorker(inputFile, connection, isManagedTransaction, databaseAdapter, - tmpXlinkPool, uidCacheManager, cacheTableManager, config, eventDispatcher); + tmpXlinkPool, idCacheManager, cacheTableManager, config, eventDispatcher); } catch (SQLException e) { log.error("Failed to create XLink resolver worker.", e); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkWorker.java b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkWorker.java index ec8d67840..a69027a5c 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkWorker.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkWorker.java @@ -27,21 +27,21 @@ */ package org.citydb.citygml.importer.concurrent; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.xlink.DBXlink; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkDeprecatedMaterial; -import org.citydb.citygml.common.database.xlink.DBXlinkGroupToCityObject; -import org.citydb.citygml.common.database.xlink.DBXlinkLibraryObject; -import org.citydb.citygml.common.database.xlink.DBXlinkLinearRing; -import org.citydb.citygml.common.database.xlink.DBXlinkSolidGeometry; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceDataToTexImage; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociation; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociationTarget; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureCoordList; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureFile; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureParam; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.xlink.DBXlink; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkDeprecatedMaterial; +import org.citydb.citygml.common.xlink.DBXlinkGroupToCityObject; +import org.citydb.citygml.common.xlink.DBXlinkLibraryObject; +import org.citydb.citygml.common.xlink.DBXlinkLinearRing; +import org.citydb.citygml.common.xlink.DBXlinkSolidGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceDataToTexImage; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociation; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociationTarget; +import org.citydb.citygml.common.xlink.DBXlinkTextureCoordList; +import org.citydb.citygml.common.xlink.DBXlinkTextureFile; +import org.citydb.citygml.common.xlink.DBXlinkTextureParam; import org.citydb.citygml.importer.database.xlink.importer.DBXlinkImporterBasic; import org.citydb.citygml.importer.database.xlink.importer.DBXlinkImporterDeprecatedMaterial; import org.citydb.citygml.importer.database.xlink.importer.DBXlinkImporterEnum; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkWorkerFactory.java b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkWorkerFactory.java index cefb4e00f..8bad96de4 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkWorkerFactory.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/DBImportXlinkWorkerFactory.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.concurrent; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.concurrent.Worker; import org.citydb.concurrent.WorkerFactory; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/FeatureReaderWorker.java b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/FeatureReaderWorker.java index c9784e894..29b3fa8da 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/FeatureReaderWorker.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/concurrent/FeatureReaderWorker.java @@ -56,7 +56,7 @@ public FeatureReaderWorker(WorkerPool dbWorkerPool, this.dbWorkerPool = dbWorkerPool; this.eventDispatcher = eventDispatcher; - useValidation = config.getImportConfig().getXMLValidation().isSetUseXMLValidation(); + useValidation = config.getImportConfig().getCityGMLOptions().getXMLValidation().isSetUseXMLValidation(); } @Override diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/controller/Importer.java b/impexp-core/src/main/java/org/citydb/citygml/importer/controller/Importer.java index 83c4c711d..b25230531 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/controller/Importer.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/controller/Importer.java @@ -28,17 +28,17 @@ package org.citydb.citygml.importer.controller; import org.apache.tika.exception.TikaException; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.uid.UIDCacheType; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.cache.IdCacheType; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.concurrent.DBImportWorkerFactory; import org.citydb.citygml.importer.concurrent.DBImportXlinkResolverWorkerFactory; import org.citydb.citygml.importer.concurrent.DBImportXlinkWorkerFactory; -import org.citydb.citygml.importer.database.uid.FeatureGmlIdCache; -import org.citydb.citygml.importer.database.uid.GeometryGmlIdCache; -import org.citydb.citygml.importer.database.uid.TextureImageCache; +import org.citydb.citygml.importer.cache.ObjectGmlIdCache; +import org.citydb.citygml.importer.cache.GeometryGmlIdCache; +import org.citydb.citygml.importer.cache.TextureImageCache; import org.citydb.citygml.importer.database.xlink.resolver.DBXlinkSplitter; import org.citydb.citygml.importer.filter.CityGMLFilter; import org.citydb.citygml.importer.filter.CityGMLFilterBuilder; @@ -235,7 +235,7 @@ private boolean process(List inputFiles) throws CityGMLImportException { FeatureReaderFactoryBuilder builder = new FeatureReaderFactoryBuilder(); CacheTableManager cacheTableManager = null; - UIDCacheManager uidCacheManager = null; + IdCacheManager idCacheManager = null; WorkerPool dbWorkerPool = null; WorkerPool tmpXlinkPool = null; WorkerPool xlinkResolverPool = null; @@ -268,14 +268,14 @@ private boolean process(List inputFiles) throws CityGMLImportException { // set gml:id codespace starting from version 3.1 if (databaseAdapter.getConnectionMetaData().getCityDBVersion().compareTo(3, 1, 0) >= 0) { - if (config.getImportConfig().getGmlId().isSetNoneCodeSpaceMode()) { + if (config.getImportConfig().getResourceId().isSetNoneCodeSpaceMode()) { internalConfig.setCurrentGmlIdCodespace(null); - } else if (config.getImportConfig().getGmlId().isSetRelativeCodeSpaceMode()) { + } else if (config.getImportConfig().getResourceId().isSetRelativeCodeSpaceMode()) { internalConfig.setCurrentGmlIdCodespace(file.getFile().getFileName().toString()); - } else if (config.getImportConfig().getGmlId().isSetAbsoluteCodeSpaceMode()) { + } else if (config.getImportConfig().getResourceId().isSetAbsoluteCodeSpaceMode()) { internalConfig.setCurrentGmlIdCodespace(file.getFile().toString()); - } else if (config.getImportConfig().getGmlId().isSetUserCodeSpaceMode()) { - String codespace = config.getImportConfig().getGmlId().getCodeSpace(); + } else if (config.getImportConfig().getResourceId().isSetUserCodeSpaceMode()) { + String codespace = config.getImportConfig().getResourceId().getCodeSpace(); if (codespace != null && !codespace.isEmpty()) { internalConfig.setCurrentGmlIdCodespace(codespace); } @@ -303,32 +303,32 @@ private boolean process(List inputFiles) throws CityGMLImportException { } // create instance of gml:id lookup server manager... - uidCacheManager = new UIDCacheManager(); + idCacheManager = new IdCacheManager(); // ...and start servers try { - uidCacheManager.initCache( - UIDCacheType.GEOMETRY, + idCacheManager.initCache( + IdCacheType.GEOMETRY, new GeometryGmlIdCache(cacheTableManager, - config.getImportConfig().getResources().getGmlIdCache().getGeometry().getPartitions(), + config.getImportConfig().getResources().getIdCache().getGeometry().getPartitions(), lookupCacheBatchSize), - config.getImportConfig().getResources().getGmlIdCache().getGeometry().getCacheSize(), - config.getImportConfig().getResources().getGmlIdCache().getGeometry().getPageFactor(), + config.getImportConfig().getResources().getIdCache().getGeometry().getCacheSize(), + config.getImportConfig().getResources().getIdCache().getGeometry().getPageFactor(), maxThreads); - uidCacheManager.initCache( - UIDCacheType.OBJECT, - new FeatureGmlIdCache(cacheTableManager, - config.getImportConfig().getResources().getGmlIdCache().getFeature().getPartitions(), + idCacheManager.initCache( + IdCacheType.OBJECT, + new ObjectGmlIdCache(cacheTableManager, + config.getImportConfig().getResources().getIdCache().getFeature().getPartitions(), lookupCacheBatchSize), - config.getImportConfig().getResources().getGmlIdCache().getFeature().getCacheSize(), - config.getImportConfig().getResources().getGmlIdCache().getFeature().getPageFactor(), + config.getImportConfig().getResources().getIdCache().getFeature().getCacheSize(), + config.getImportConfig().getResources().getIdCache().getFeature().getPageFactor(), maxThreads); if (config.getImportConfig().getAppearances().isSetImportAppearance() && config.getImportConfig().getAppearances().isSetImportTextureFiles()) { - uidCacheManager.initCache( - UIDCacheType.TEXTURE_IMAGE, + idCacheManager.initCache( + IdCacheType.TEXTURE_IMAGE, new TextureImageCache(cacheTableManager, config.getImportConfig().getResources().getTexImageCache().getPartitions(), lookupCacheBatchSize), @@ -360,7 +360,7 @@ private boolean process(List inputFiles) throws CityGMLImportException { new DBImportWorkerFactory(schemaMapping, cityGMLBuilder, tmpXlinkPool, - uidCacheManager, + idCacheManager, filter, affineTransformer, importLogger, @@ -418,7 +418,7 @@ private boolean process(List inputFiles) throws CityGMLImportException { PoolSizeAdaptationStrategy.AGGRESSIVE, new DBImportXlinkResolverWorkerFactory(file, tmpXlinkPool, - uidCacheManager, + idCacheManager, cacheTableManager, config, eventDispatcher), @@ -481,9 +481,9 @@ private boolean process(List inputFiles) throws CityGMLImportException { // } - if (uidCacheManager != null) { + if (idCacheManager != null) { try { - uidCacheManager.shutdownAll(); + idCacheManager.shutdownAll(); } catch (SQLException e) { setException("Failed to clean the gml:id caches.", e); shouldRun = false; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/CityGMLImportManager.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/CityGMLImportManager.java index e7a1c6bb7..1d85d8a66 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/CityGMLImportManager.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/CityGMLImportManager.java @@ -33,13 +33,13 @@ import org.citydb.ade.importer.ADEPropertyCollection; import org.citydb.ade.importer.CityGMLImportHelper; import org.citydb.ade.importer.ForeignKeys; -import org.citydb.citygml.common.database.uid.UIDCache; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.uid.UIDCacheType; -import org.citydb.citygml.common.database.xlink.DBXlink; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.cache.IdCache; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.cache.IdCacheType; +import org.citydb.citygml.common.xlink.DBXlink; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.database.SequenceHelper; import org.citydb.citygml.importer.database.TableHelper; @@ -142,7 +142,7 @@ public class CityGMLImportManager implements CityGMLImportHelper { private final ADEExtensionManager adeManager; private final CityGMLBuilder cityGMLBuilder; private final WorkerPool xlinkPool; - private final UIDCacheManager uidCacheManager; + private final IdCacheManager idCacheManager; private final InternalConfig internalConfig; private final Config config; @@ -169,7 +169,7 @@ public CityGMLImportManager(Connection connection, SchemaMapping schemaMapping, CityGMLBuilder cityGMLBuilder, WorkerPool xlinkPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, AffineTransformer affineTransformer, InternalConfig internalConfig, Config config) throws SQLException { @@ -178,7 +178,7 @@ public CityGMLImportManager(Connection connection, this.schemaMapping = schemaMapping; this.cityGMLBuilder = cityGMLBuilder; this.xlinkPool = xlinkPool; - this.uidCacheManager = uidCacheManager; + this.idCacheManager = idCacheManager; this.internalConfig = internalConfig; this.config = config; @@ -202,7 +202,7 @@ public CityGMLImportManager(Connection connection, if (config.getImportConfig().getAffineTransformation().isEnabled()) this.affineTransformer = affineTransformer; - if (config.getImportConfig().getAddress().isSetImportXAL()) { + if (config.getImportConfig().getCityGMLOptions().isImportXalAddress()) { cityGMLVersion = CityGMLVersion.DEFAULT; jaxbMarshaller = cityGMLBuilder.createJAXBMarshaller(cityGMLVersion); saxWriter = new SAXWriter(); @@ -540,7 +540,7 @@ protected boolean hasADESupport() { } public String generateNewGmlId() { - return DefaultGMLIdManager.getInstance().generateUUID(config.getImportConfig().getGmlId().getIdPrefix()); + return DefaultGMLIdManager.getInstance().generateUUID(config.getImportConfig().getResourceId().getIdPrefix()); } public LocalAppearanceHandler getLocalAppearanceHandler() { @@ -609,18 +609,18 @@ public List getAndResetImportLogEntries() { return tmp; } - public void putObjectUID(String gmlId, long id, String mapping, int objectClassId) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.OBJECT); + public void putObjectId(String gmlId, long id, String mapping, int objectClassId) { + IdCache cache = idCacheManager.getCache(IdCacheType.OBJECT); if (cache != null) cache.put(gmlId, id, -1, false, mapping, objectClassId); } - public void putObjectUID(String gmlId, long id, int objectClassId) { - putObjectUID(gmlId, id, null, objectClassId); + public void putObjectId(String gmlId, long id, int objectClassId) { + putObjectId(gmlId, id, null, objectClassId); } - protected boolean lookupAndPutObjectUID(String gmlId, long id, int objectClassId) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.OBJECT); + protected boolean lookupAndPutObjectId(String gmlId, long id, int objectClassId) { + IdCache cache = idCacheManager.getCache(IdCacheType.OBJECT); if (cache != null) return cache.lookupAndPut(gmlId, id, objectClassId); else @@ -628,9 +628,9 @@ protected boolean lookupAndPutObjectUID(String gmlId, long id, int objectClassId } public long getObjectId(String gmlId) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.OBJECT); + IdCache cache = idCacheManager.getCache(IdCacheType.OBJECT); if (cache != null) { - UIDCacheEntry entry = cache.get(gmlId); + IdCacheEntry entry = cache.get(gmlId); if (entry != null) return entry.getId(); } @@ -638,17 +638,17 @@ public long getObjectId(String gmlId) { return -1; } - public void putTextureImageUID(String gmlId, long id) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.TEXTURE_IMAGE); + public void putTextureImageId(String resourceId, long id) { + IdCache cache = idCacheManager.getCache(IdCacheType.TEXTURE_IMAGE); if (cache != null) - cache.put(gmlId, id, -1, false, null, 0); + cache.put(resourceId, id, -1, false, null, 0); } - public long getTextureImageId(String gmlId) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.TEXTURE_IMAGE); + public long getTextureImageId(String resourceId) { + IdCache cache = idCacheManager.getCache(IdCacheType.TEXTURE_IMAGE); if (cache != null) { - UIDCacheEntry entry = cache.get(gmlId); + IdCacheEntry entry = cache.get(resourceId); if (entry != null) return entry.getId(); } @@ -656,17 +656,17 @@ public long getTextureImageId(String gmlId) { return -1; } - public void putGeometryUID(String gmlId, long id, long rootId, boolean reverse, String mapping) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.GEOMETRY); + public void putGeometryId(String gmlId, long id, long rootId, boolean reverse, String mapping) { + IdCache cache = idCacheManager.getCache(IdCacheType.GEOMETRY); if (cache != null) cache.put(gmlId, id, rootId, reverse, mapping, 0); } public long getGeometryIdFromMemory(String gmlId) { - UIDCache cache = uidCacheManager.getCache(UIDCacheType.GEOMETRY); + IdCache cache = idCacheManager.getCache(IdCacheType.GEOMETRY); if (cache != null) { - UIDCacheEntry entry = cache.getFromMemory(gmlId); + IdCacheEntry entry = cache.getFromMemory(gmlId); if (entry != null) return entry.getId(); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBAddress.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBAddress.java index 0387c6718..1cbd205e8 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBAddress.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBAddress.java @@ -68,10 +68,10 @@ public DBAddress(Connection batchConn, Config config, CityGMLImportManager impor this.batchConn = batchConn; this.importer = importer; - importXALSource = config.getImportConfig().getAddress().isSetImportXAL(); + importXALSource = config.getImportConfig().getCityGMLOptions().isImportXalAddress(); String schema = importer.getDatabaseAdapter().getConnectionDetails().getSchema(); hasGmlIdColumn = importer.getDatabaseAdapter().getConnectionMetaData().getCityDBVersion().compareTo(3, 1, 0) >= 0; - replaceGmlId = config.getImportConfig().getGmlId().isUUIDModeReplace(); + replaceGmlId = config.getImportConfig().getResourceId().isUUIDModeReplace(); String gmlIdCodespace = null; if (hasGmlIdColumn) { @@ -112,13 +112,13 @@ protected long doImport(Address address) throws CityGMLImportException, SQLExcep // mapping entry if (address.isSetId()) - importer.putObjectUID(address.getId(), addressId, gmlId, featureType.getObjectClassId()); + importer.putObjectId(address.getId(), addressId, gmlId, featureType.getObjectClassId()); address.setId(gmlId); } else { if (address.isSetId()) - importer.putObjectUID(address.getId(), addressId, featureType.getObjectClassId()); + importer.putObjectId(address.getId(), addressId, featureType.getObjectClassId()); else address.setId(importer.generateNewGmlId()); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBAppearance.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBAppearance.java index 6b3b40b33..b3e05c4d5 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBAppearance.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBAppearance.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.importer.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkBasic; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.citygml.importer.util.LocalAppearanceHandler; @@ -64,7 +64,7 @@ public class DBAppearance implements DBImporter { public DBAppearance(Connection batchConn, Config config, CityGMLImportManager importer) throws CityGMLImportException, SQLException { this.importer = importer; - replaceGmlId = config.getImportConfig().getGmlId().isUUIDModeReplace(); + replaceGmlId = config.getImportConfig().getResourceId().isUUIDModeReplace(); String schema = importer.getDatabaseAdapter().getConnectionDetails().getSchema(); String gmlIdCodespace = importer.getInternalConfig().getCurrentGmlIdCodespace(); @@ -101,13 +101,13 @@ public long doImport(Appearance appearance, long parentId, boolean isLocalAppear // mapping entry if (appearance.isSetId()) - importer.putObjectUID(appearance.getId(), appearanceId, gmlId, featureType.getObjectClassId()); + importer.putObjectId(appearance.getId(), appearanceId, gmlId, featureType.getObjectClassId()); appearance.setId(gmlId); } else { if (appearance.isSetId()) - importer.putObjectUID(appearance.getId(), appearanceId, featureType.getObjectClassId()); + importer.putObjectId(appearance.getId(), appearanceId, featureType.getObjectClassId()); else appearance.setId(importer.generateNewGmlId()); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridge.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridge.java index 6f8ca6519..139fa422c 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridge.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridge.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeConstrElement.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeConstrElement.java index 533456306..a3679c27b 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeConstrElement.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeConstrElement.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeFurniture.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeFurniture.java index 631e7e8f0..1e5f1bf35 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeFurniture.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeFurniture.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeInstallation.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeInstallation.java index b9f3f92f8..8b1eafc2e 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeInstallation.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeInstallation.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeOpening.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeOpening.java index 843f5e0a2..ec49b25f2 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeOpening.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeOpening.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeRoom.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeRoom.java index 78419225f..53aaafa77 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeRoom.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeRoom.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeThematicSurface.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeThematicSurface.java index 6524eef07..dba2067cd 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeThematicSurface.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBridgeThematicSurface.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.config.Config; import org.citydb.database.schema.TableEnum; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuilding.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuilding.java index da214bf55..1bbe293bf 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuilding.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuilding.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuildingFurniture.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuildingFurniture.java index 90590cf7e..7ded7e78e 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuildingFurniture.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuildingFurniture.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuildingInstallation.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuildingInstallation.java index 3f32e501d..b433d251f 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuildingInstallation.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBBuildingInstallation.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityFurniture.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityFurniture.java index 19aa0d23d..9140b929e 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityFurniture.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityFurniture.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityObject.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityObject.java index 4aff4b0de..5a1b0a392 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityObject.java @@ -30,7 +30,7 @@ import org.citydb.ade.model.LineageProperty; import org.citydb.ade.model.ReasonForUpdateProperty; import org.citydb.ade.model.UpdatingPersonProperty; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkBasic; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.citygml.importer.util.LocalAppearanceHandler; @@ -115,8 +115,8 @@ public DBCityObject(Connection batchConn, Config config, CityGMLImportManager im if (gmlIdCodespace != null) gmlIdCodespace = "'" + gmlIdCodespace + "', "; - replaceGmlId = config.getImportConfig().getGmlId().isUUIDModeReplace(); - rememberGmlId = config.getImportConfig().getGmlId().isSetKeepGmlIdAsExternalReference(); + replaceGmlId = config.getImportConfig().getResourceId().isUUIDModeReplace(); + rememberGmlId = config.getImportConfig().getResourceId().isSetKeepIdAsExternalReference(); if (replaceGmlId && rememberGmlId && importer.getInternalConfig().getInputFile() != null) importFileName = importer.getInternalConfig().getInputFile().getFile().toString(); @@ -175,7 +175,7 @@ protected long doImport(AbstractGML object, AbstractObjectType objectType) th // mapping entry if (object.isSetId()) { - importer.putObjectUID(object.getId(), objectId, gmlId, objectType.getObjectClassId()); + importer.putObjectId(object.getId(), objectId, gmlId, objectType.getObjectClassId()); if (rememberGmlId && isCityObject) { ExternalReference externalReference = new ExternalReference(); @@ -192,7 +192,7 @@ protected long doImport(AbstractGML object, AbstractObjectType objectType) th object.setId(gmlId); } else { if (object.isSetId()) - importer.putObjectUID(object.getId(), objectId, objectType.getObjectClassId()); + importer.putObjectId(object.getId(), objectId, objectType.getObjectClassId()); else object.setId(importer.generateNewGmlId()); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityObjectGroup.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityObjectGroup.java index 5098f8841..d0e673d77 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityObjectGroup.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBCityObjectGroup.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkGroupToCityObject; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkGroupToCityObject; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBGenericCityObject.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBGenericCityObject.java index 31163263e..e7219c1e8 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBGenericCityObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBGenericCityObject.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBImplicitGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBImplicitGeometry.java index dbea1a1c8..8c3e32d63 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBImplicitGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBImplicitGeometry.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkLibraryObject; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkLibraryObject; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.ConcurrentLockManager; import org.citydb.citygml.importer.util.ExternalFileChecker; @@ -141,7 +141,7 @@ protected long doImport(ImplicitGeometry implicitGeometry) throws CityGMLImportE // check relative geometry reference else if (gmlId != null) - implicitGeometryId = importer.getObjectId(gmlId); + implicitGeometryId = importer.getObjectId(gmlId); if (implicitGeometryId <= 0) { implicitGeometryId = importer.getNextSequenceValue(SequenceEnum.IMPLICIT_GEOMETRY_ID_SEQ.getName()); @@ -151,7 +151,7 @@ else if (gmlId != null) ++batchCounter; if (gmlId != null) - importer.putObjectUID(gmlId, implicitGeometryId, MappingConstants.IMPLICIT_GEOMETRY_OBJECTCLASS_ID); + importer.putObjectId(gmlId, implicitGeometryId, MappingConstants.IMPLICIT_GEOMETRY_OBJECTCLASS_ID); importer.updateObjectCounter(implicitGeometry, MappingConstants.IMPLICIT_GEOMETRY_OBJECTCLASS_ID, implicitGeometryId); } @@ -228,7 +228,7 @@ else if (importer.isPointOrLineGeometry(relativeGeometry)) lock.unlock(); } - if (isXLink && !importer.lookupAndPutObjectUID("#xlink#" + gmlId, 1, MappingConstants.IMPLICIT_GEOMETRY_OBJECTCLASS_ID)) { + if (isXLink && !importer.lookupAndPutObjectId("#xlink#" + gmlId, 1, MappingConstants.IMPLICIT_GEOMETRY_OBJECTCLASS_ID)) { importer.propagateXlink(new DBXlinkSurfaceGeometry( MappingConstants.IMPLICIT_GEOMETRY_TABLE, implicitGeometryId, diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBLandUse.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBLandUse.java index ccd66eccb..3b94cd558 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBLandUse.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBLandUse.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBOpening.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBOpening.java index 3a547a7a2..f80f066d9 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBOpening.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBOpening.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBPlantCover.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBPlantCover.java index 1151cd145..9ea9bd55d 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBPlantCover.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBPlantCover.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBReliefFeature.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBReliefFeature.java index 7e730d512..321cacda8 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBReliefFeature.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBReliefFeature.java @@ -31,7 +31,7 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkBasic; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.config.Config; import org.citydb.database.schema.TableEnum; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBRoom.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBRoom.java index 2be6af497..c921530e7 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBRoom.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBRoom.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSolitaryVegetatObject.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSolitaryVegetatObject.java index f77328a8a..c10145d63 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSolitaryVegetatObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSolitaryVegetatObject.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSurfaceData.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSurfaceData.java index b5ba1ee81..ef8867323 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSurfaceData.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSurfaceData.java @@ -27,12 +27,12 @@ */ package org.citydb.citygml.importer.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceDataToTexImage; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociation; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociationTarget; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureCoordList; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureParam; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureParamEnum; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceDataToTexImage; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociation; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociationTarget; +import org.citydb.citygml.common.xlink.DBXlinkTextureCoordList; +import org.citydb.citygml.common.xlink.DBXlinkTextureParam; +import org.citydb.citygml.common.xlink.DBXlinkTextureParamEnum; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.citygml.importer.util.ExternalFileChecker; @@ -108,7 +108,7 @@ public DBSurfaceData(Connection batchConn, Config config, CityGMLImportManager i this.importer = importer; affineTransformation = config.getImportConfig().getAffineTransformation().isEnabled(); - replaceGmlId = config.getImportConfig().getGmlId().isUUIDModeReplace(); + replaceGmlId = config.getImportConfig().getResourceId().isUUIDModeReplace(); dbSrid = DatabaseConnectionPool.getInstance().getActiveDatabaseAdapter().getConnectionMetaData().getReferenceSystem().getSrid(); affineTransformation = config.getImportConfig().getAffineTransformation().isEnabled(); nullGeometryType = importer.getDatabaseAdapter().getGeometryConverter().getNullGeometryType(); @@ -175,13 +175,13 @@ else if (surfaceData instanceof GeoreferencedTexture) // mapping entry if (surfaceData.isSetId()) - importer.putObjectUID(surfaceData.getId(), surfaceDataId, gmlId, featureType.getObjectClassId()); + importer.putObjectId(surfaceData.getId(), surfaceDataId, gmlId, featureType.getObjectClassId()); surfaceData.setId(gmlId); } else { if (surfaceData.isSetId()) - importer.putObjectUID(surfaceData.getId(), surfaceDataId, featureType.getObjectClassId()); + importer.putObjectId(surfaceData.getId(), surfaceDataId, featureType.getObjectClassId()); else surfaceData.setId(importer.generateNewGmlId()); } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSurfaceGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSurfaceGeometry.java index 591c65d2a..89ccf90be 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSurfaceGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBSurfaceGeometry.java @@ -27,9 +27,9 @@ */ package org.citydb.citygml.importer.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkLinearRing; -import org.citydb.citygml.common.database.xlink.DBXlinkSolidGeometry; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkLinearRing; +import org.citydb.citygml.common.xlink.DBXlinkSolidGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.LocalAppearanceHandler; import org.citydb.citygml.importer.util.RingValidator; @@ -110,7 +110,7 @@ public DBSurfaceGeometry(Connection batchConn, Config config, CityGMLImportManag this.batchConn = batchConn; this.importer = importer; - replaceGmlId = config.getImportConfig().getGmlId().isUUIDModeReplace(); + replaceGmlId = config.getImportConfig().getResourceId().isUUIDModeReplace(); dbSrid = DatabaseConnectionPool.getInstance().getActiveDatabaseAdapter().getConnectionMetaData().getReferenceSystem().getSrid(); importAppearance = config.getImportConfig().getAppearances().isSetImportAppearance(); applyTransformation = config.getImportConfig().getAffineTransformation().isEnabled(); @@ -293,7 +293,7 @@ private long doImport(AbstractGeometry geometry, long id, long parentId, long ro Object object = importer.getDatabaseAdapter().getGeometryConverter().getDatabaseObject(geometryObject, batchConn); if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, id, rootId, reverse, gmlId); + importer.putGeometryId(origGmlId, id, rootId, reverse, gmlId); psGeomElem.setLong(1, id); psGeomElem.setString(2, gmlId); @@ -354,7 +354,7 @@ else if (geometry instanceof _TexturedSurface) { // do mapping if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, -1, -1, negativeOrientation, targetURI); + importer.putGeometryId(origGmlId, -1, -1, negativeOrientation, targetURI); if (surface instanceof Polygon) { // make sure all exterior and interior rings do have a gml:id to assign texture coordinates @@ -384,7 +384,7 @@ else if (geometry instanceof _TexturedSurface) { // do mapping if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, -1, -1, negativeOrientation, targetURI); + importer.putGeometryId(origGmlId, -1, -1, negativeOrientation, targetURI); // well, regarding appearances we cannot work on remote geometries so far... importer.logOrThrowErrorMessage(importer.getObjectSignature(texturedSurface, origGmlId) + @@ -456,7 +456,7 @@ else if (geometry instanceof OrientableSurface) { // do mapping if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, -1, -1, negativeOrientation, mapping); + importer.putGeometryId(origGmlId, -1, -1, negativeOrientation, mapping); } else { importer.logOrThrowErrorMessage(importer.getObjectSignature(orientableSurface, origGmlId) + ": The orientable surface lacks a base surface."); @@ -468,7 +468,7 @@ else if (geometry instanceof CompositeSurface) { CompositeSurface compositeSurface = (CompositeSurface) geometry; if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, id, rootId, reverse, gmlId); + importer.putGeometryId(origGmlId, id, rootId, reverse, gmlId); // set root entry psGeomElem.setLong(1, id); @@ -517,7 +517,7 @@ else if (geometry instanceof TriangulatedSurface) { TriangulatedSurface triangulatedSurface = (TriangulatedSurface) geometry; if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, id, rootId, reverse, gmlId); + importer.putGeometryId(origGmlId, id, rootId, reverse, gmlId); // set root entry psGeomElem.setLong(1, id); @@ -565,7 +565,7 @@ else if (geometry instanceof Surface) { Surface surface = (Surface) geometry; if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, id, rootId, reverse, gmlId); + importer.putGeometryId(origGmlId, id, rootId, reverse, gmlId); int nrOfPatches = surface.isSetPatches() && surface.getPatches().isSetSurfacePatch() ? surface.getPatches().getSurfacePatch().size() : 0; @@ -631,7 +631,7 @@ else if (geometry instanceof Solid) { Solid solid = (Solid) geometry; if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, id, rootId, reverse, gmlId); + importer.putGeometryId(origGmlId, id, rootId, reverse, gmlId); // set root entry psGeomElem.setLong(1, id); @@ -703,7 +703,7 @@ else if (geometry instanceof CompositeSolid) { CompositeSolid compositeSolid = (CompositeSolid) geometry; if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, id, rootId, reverse, gmlId); + importer.putGeometryId(origGmlId, id, rootId, reverse, gmlId); // set root entry psGeomElem.setLong(1, id); @@ -770,7 +770,7 @@ else if (geometry instanceof MultiPolygon) { MultiPolygon multiPolygon = (MultiPolygon) geometry; if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, id, rootId, reverse, gmlId); + importer.putGeometryId(origGmlId, id, rootId, reverse, gmlId); // set root entry psGeomElem.setLong(1, id); @@ -819,7 +819,7 @@ else if (geometry instanceof MultiSurface) { MultiSurface multiSurface = (MultiSurface) geometry; if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, id, rootId, reverse, gmlId); + importer.putGeometryId(origGmlId, id, rootId, reverse, gmlId); // set root entry psGeomElem.setLong(1, id); @@ -877,7 +877,7 @@ else if (geometry instanceof MultiSolid) { MultiSolid multiSolid = (MultiSolid) geometry; if (origGmlId != null && !isCopy) - importer.putGeometryUID(origGmlId, id, rootId, reverse, gmlId); + importer.putGeometryId(origGmlId, id, rootId, reverse, gmlId); // set root entry psGeomElem.setLong(1, id); diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTexImage.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTexImage.java index 3dc09b341..433ee010e 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTexImage.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTexImage.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.importer.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureFile; +import org.citydb.citygml.common.xlink.DBXlinkTextureFile; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.ConcurrentLockManager; import org.citydb.citygml.importer.util.ExternalFileChecker; @@ -102,7 +102,7 @@ public long doImport(AbstractTexture abstractTexture, long surfaceDataId) throws texImageId = 0; } - importer.putTextureImageUID(md5URI, texImageId); + importer.putTextureImageId(md5URI, texImageId); } } finally { lockManager.releaseLock(md5URI); diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBThematicSurface.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBThematicSurface.java index 7b0752bd7..b42a477e7 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBThematicSurface.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBThematicSurface.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.config.Config; import org.citydb.database.schema.TableEnum; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTrafficArea.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTrafficArea.java index d0fe1de10..4f5f0590d 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTrafficArea.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTrafficArea.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTransportationComplex.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTransportationComplex.java index f0d1fcfab..5e04cfa9e 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTransportationComplex.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTransportationComplex.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnel.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnel.java index 5fa9ba6a8..9628964e3 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnel.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnel.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelFurniture.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelFurniture.java index a66af8047..e843e17f7 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelFurniture.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelFurniture.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelHollowSpace.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelHollowSpace.java index 25f2e8fa4..676e85c50 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelHollowSpace.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelHollowSpace.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelInstallation.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelInstallation.java index 013bfea96..b55596f81 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelInstallation.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelInstallation.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelOpening.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelOpening.java index 92be3194d..8ed1d4ab8 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelOpening.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelOpening.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelThematicSurface.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelThematicSurface.java index 13f672140..26427f610 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelThematicSurface.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBTunnelThematicSurface.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.config.Config; import org.citydb.database.schema.TableEnum; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBWaterBody.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBWaterBody.java index 3f1dff030..5ed1bb856 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBWaterBody.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBWaterBody.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.citygml.importer.util.AttributeValueJoiner; import org.citydb.config.Config; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBWaterBoundarySurface.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBWaterBoundarySurface.java index afccabaad..72694b4c4 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBWaterBoundarySurface.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/DBWaterBoundarySurface.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.importer.database.content; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.config.Config; import org.citydb.database.schema.TableEnum; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/TexturedSurfaceConverter.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/TexturedSurfaceConverter.java index 616a063bd..5d47d691a 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/TexturedSurfaceConverter.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/content/TexturedSurfaceConverter.java @@ -31,7 +31,7 @@ import java.util.ArrayList; import java.util.List; -import org.citydb.citygml.common.database.xlink.DBXlinkDeprecatedMaterial; +import org.citydb.citygml.common.xlink.DBXlinkDeprecatedMaterial; import org.citydb.citygml.importer.CityGMLImportException; import org.citydb.config.Config; import org.citygml4j.model.citygml.appearance.AbstractSurfaceData; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterBasic.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterBasic.java index f0e656efc..4c02b4677 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterBasic.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterBasic.java @@ -31,8 +31,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkBasic; public class DBXlinkImporterBasic implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterDeprecatedMaterial.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterDeprecatedMaterial.java index 9f5462873..aac6f78f1 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterDeprecatedMaterial.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterDeprecatedMaterial.java @@ -30,8 +30,8 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkDeprecatedMaterial; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkDeprecatedMaterial; public class DBXlinkImporterDeprecatedMaterial implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterGroupToCityObject.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterGroupToCityObject.java index 6b9bdd267..f6d841b2d 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterGroupToCityObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterGroupToCityObject.java @@ -30,8 +30,8 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkGroupToCityObject; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkGroupToCityObject; public class DBXlinkImporterGroupToCityObject implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterLibraryObject.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterLibraryObject.java index 5f3ae0ee7..b34f04644 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterLibraryObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterLibraryObject.java @@ -30,8 +30,8 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkLibraryObject; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkLibraryObject; public class DBXlinkImporterLibraryObject implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterLinearRing.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterLinearRing.java index a85ef31f9..a36dfee60 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterLinearRing.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterLinearRing.java @@ -30,8 +30,8 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkLinearRing; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkLinearRing; public class DBXlinkImporterLinearRing implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterManager.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterManager.java index 62d2f752e..31395fd1b 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterManager.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterManager.java @@ -30,9 +30,9 @@ import java.sql.SQLException; import java.util.HashMap; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.model.CacheTableModel; import org.citydb.database.adapter.AbstractDatabaseAdapter; import org.citydb.event.Event; import org.citydb.event.EventDispatcher; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSolidGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSolidGeometry.java index cba07583f..b57e8255c 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSolidGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSolidGeometry.java @@ -30,8 +30,8 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkSolidGeometry; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkSolidGeometry; public class DBXlinkImporterSolidGeometry implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSurfaceDataToTexImage.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSurfaceDataToTexImage.java index 6f417f49d..c04eec57b 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSurfaceDataToTexImage.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSurfaceDataToTexImage.java @@ -30,8 +30,8 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceDataToTexImage; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceDataToTexImage; public class DBXlinkImporterSurfaceDataToTexImage implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSurfaceGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSurfaceGeometry.java index 10dc3de66..81f136acf 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSurfaceGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterSurfaceGeometry.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.database.xlink.importer; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import java.sql.PreparedStatement; import java.sql.SQLException; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureAssociation.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureAssociation.java index 5091cf124..b12610ce3 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureAssociation.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureAssociation.java @@ -30,8 +30,8 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociation; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociation; public class DBXlinkImporterTextureAssociation implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureAssociationTarget.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureAssociationTarget.java index 205d7b907..65302c6b0 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureAssociationTarget.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureAssociationTarget.java @@ -30,8 +30,8 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociationTarget; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociationTarget; public class DBXlinkImporterTextureAssociationTarget implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureCoordList.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureCoordList.java index 2005b8519..819037a98 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureCoordList.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureCoordList.java @@ -31,8 +31,8 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureCoordList; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkTextureCoordList; public class DBXlinkImporterTextureCoordList implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureFile.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureFile.java index c08b9ee15..52cc19ac7 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureFile.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureFile.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.database.xlink.importer; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureFile; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkTextureFile; import java.sql.PreparedStatement; import java.sql.SQLException; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureParam.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureParam.java index 2583807d7..36bb992fd 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureParam.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/importer/DBXlinkImporterTextureParam.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.sql.Types; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureParam; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkTextureParam; public class DBXlinkImporterTextureParam implements DBXlinkImporter { private final DBXlinkImporterManager xlinkImporterManager; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBGmlIdResolver.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBGmlIdResolver.java index 27e112290..bd286fe53 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBGmlIdResolver.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBGmlIdResolver.java @@ -27,10 +27,10 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.uid.UIDCache; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.uid.UIDCacheType; +import org.citydb.citygml.common.cache.IdCache; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.cache.IdCacheType; import org.citydb.database.adapter.AbstractDatabaseAdapter; import org.citydb.log.Logger; @@ -41,29 +41,29 @@ public class DBGmlIdResolver { private final Logger log = Logger.getInstance(); - private final UIDCacheManager uidCacheManager; + private final IdCacheManager idCacheManager; private final PreparedStatement psSurfaceGeometryId; private final PreparedStatement psCityObjectId; - public DBGmlIdResolver(Connection connection, AbstractDatabaseAdapter databaseAdapter, UIDCacheManager uidCacheManager) throws SQLException { - this.uidCacheManager = uidCacheManager; + public DBGmlIdResolver(Connection connection, AbstractDatabaseAdapter databaseAdapter, IdCacheManager idCacheManager) throws SQLException { + this.idCacheManager = idCacheManager; String schema = databaseAdapter.getConnectionDetails().getSchema(); psSurfaceGeometryId = connection.prepareStatement("select ID from " + schema + ".SURFACE_GEOMETRY where ROOT_ID=? and GMLID=?"); psCityObjectId = connection.prepareStatement("select ID, OBJECTCLASS_ID from " + schema + ".CITYOBJECT where GMLID=?"); } - public UIDCacheEntry getDBId(String gmlId, UIDCacheType type, boolean forceCityObjectDatabaseLookup) { - UIDCache cache = uidCacheManager.getCache(type); + public IdCacheEntry getDBId(String gmlId, IdCacheType type, boolean forceCityObjectDatabaseLookup) { + IdCache cache = idCacheManager.getCache(type); if (cache == null) return null; // replace leading # gmlId = gmlId.replaceAll("^#", ""); - UIDCacheEntry entry = cacheLookup(gmlId, null, cache); + IdCacheEntry entry = cacheLookup(gmlId, null, cache); if (entry == null || entry.getId() == -1) { try { - if (type == UIDCacheType.GEOMETRY) { + if (type == IdCacheType.GEOMETRY) { if (entry == null) return null; @@ -82,30 +82,30 @@ public UIDCacheEntry getDBId(String gmlId, UIDCacheType type, boolean forceCityO return entry; } - private UIDCacheEntry geometryLookup(UIDCacheEntry entry) throws SQLException { + private IdCacheEntry geometryLookup(IdCacheEntry entry) throws SQLException { psSurfaceGeometryId.setLong(1, entry.getRootId()); psSurfaceGeometryId.setString(2, entry.getMapping()); try (ResultSet rs = psSurfaceGeometryId.executeQuery()) { return rs.next() ? - new UIDCacheEntry(rs.getLong(1), entry.getRootId(), entry.isReverse(), entry.getMapping()) : + new IdCacheEntry(rs.getLong(1), entry.getRootId(), entry.isReverse(), entry.getMapping()) : null; } } - private UIDCacheEntry cityObjectLookup(String gmlId) throws SQLException { + private IdCacheEntry cityObjectLookup(String gmlId) throws SQLException { psCityObjectId.setString(1, gmlId); try (ResultSet rs = psCityObjectId.executeQuery()) { return rs.next() ? - new UIDCacheEntry(rs.getLong(1), 0, false, gmlId, rs.getInt(2)) : + new IdCacheEntry(rs.getLong(1), 0, false, gmlId, rs.getInt(2)) : null; } } - private UIDCacheEntry cacheLookup(String gmlId, UIDCacheEntry oldEntry, UIDCache cache) { + private IdCacheEntry cacheLookup(String gmlId, IdCacheEntry oldEntry, IdCache cache) { // this is a recursive server request since we might have mapped gml:ids! - UIDCacheEntry entry = cache.get(gmlId); + IdCacheEntry entry = cache.get(gmlId); // we get an answer and it has got some meaningful content. so we are done if (entry != null && entry.getId() != -1) { @@ -113,7 +113,7 @@ private UIDCacheEntry cacheLookup(String gmlId, UIDCacheEntry oldEntry, UIDCache // flip reverse attribute if necessary. since we do not want to // change the entry in the gmlId cache we create a new one to do so if (oldEntry != null) - entry = new UIDCacheEntry( + entry = new IdCacheEntry( entry.getId(), entry.getRootId(), entry.isReverse() ^ oldEntry.isReverse(), @@ -131,7 +131,7 @@ private UIDCacheEntry cacheLookup(String gmlId, UIDCacheEntry oldEntry, UIDCache // flip reverse attribute if necessary. since we do not want to // change the entry in the gmlId cache we create a new one to do so if (oldEntry != null) - entry = new UIDCacheEntry( + entry = new IdCacheEntry( entry.getId(), entry.getRootId(), entry.isReverse() ^ oldEntry.isReverse(), diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBXlinkResolverManager.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBXlinkResolverManager.java index db064ba16..10ddf7e79 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBXlinkResolverManager.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBXlinkResolverManager.java @@ -27,13 +27,13 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.uid.UIDCacheManager; -import org.citydb.citygml.common.database.uid.UIDCacheType; -import org.citydb.citygml.common.database.xlink.DBXlink; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.model.CacheTableModel; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.cache.IdCacheManager; +import org.citydb.citygml.common.cache.IdCacheType; +import org.citydb.citygml.common.xlink.DBXlink; import org.citydb.citygml.importer.database.SequenceHelper; import org.citydb.citygml.importer.util.ConcurrentLockManager; import org.citydb.concurrent.WorkerPool; @@ -82,7 +82,7 @@ public DBXlinkResolverManager( Connection batchConn, AbstractDatabaseAdapter databaseAdapter, WorkerPool tmpXlinkPool, - UIDCacheManager uidCacheManager, + IdCacheManager idCacheManager, CacheTableManager cacheTableManager, Config config, EventDispatcher eventDispatcher) throws SQLException { @@ -94,7 +94,7 @@ public DBXlinkResolverManager( this.eventDispatcher = eventDispatcher; resolvers = new HashMap<>(); - gmlIdResolver = new DBGmlIdResolver(batchConn, databaseAdapter, uidCacheManager); + gmlIdResolver = new DBGmlIdResolver(batchConn, databaseAdapter, idCacheManager); sequenceHelper = new SequenceHelper(batchConn, databaseAdapter, config); schemaMapping = ObjectRegistry.getInstance().getSchemaMapping(); } @@ -162,16 +162,16 @@ public long getDBId(String sequence) throws SQLException { return sequenceHelper.getNextSequenceValue(sequence); } - public UIDCacheEntry getObjectId(String gmlId) { - return gmlIdResolver.getDBId(gmlId, UIDCacheType.OBJECT, false); + public IdCacheEntry getObjectId(String gmlId) { + return gmlIdResolver.getDBId(gmlId, IdCacheType.OBJECT, false); } - public UIDCacheEntry getObjectId(String gmlId, boolean forceCityObjectDatabaseLookup) { - return gmlIdResolver.getDBId(gmlId, UIDCacheType.OBJECT, forceCityObjectDatabaseLookup); + public IdCacheEntry getObjectId(String gmlId, boolean forceCityObjectDatabaseLookup) { + return gmlIdResolver.getDBId(gmlId, IdCacheType.OBJECT, forceCityObjectDatabaseLookup); } - public UIDCacheEntry getGeometryId(String gmlId) { - return gmlIdResolver.getDBId(gmlId, UIDCacheType.GEOMETRY, false); + public IdCacheEntry getGeometryId(String gmlId) { + return gmlIdResolver.getDBId(gmlId, IdCacheType.GEOMETRY, false); } public FeatureType getFeatureType(int objectClassId) { diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBXlinkSplitter.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBXlinkSplitter.java index 2a25e6e62..7f1fc8134 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBXlinkSplitter.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/DBXlinkSplitter.java @@ -27,22 +27,22 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.cache.CacheTableManager; -import org.citydb.citygml.common.database.cache.model.CacheTableModel; -import org.citydb.citygml.common.database.xlink.DBXlink; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; -import org.citydb.citygml.common.database.xlink.DBXlinkDeprecatedMaterial; -import org.citydb.citygml.common.database.xlink.DBXlinkGroupToCityObject; -import org.citydb.citygml.common.database.xlink.DBXlinkLibraryObject; -import org.citydb.citygml.common.database.xlink.DBXlinkSolidGeometry; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceDataToTexImage; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociation; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureCoordList; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureFile; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureParam; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureParamEnum; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.CacheTableManager; +import org.citydb.citygml.common.cache.model.CacheTableModel; +import org.citydb.citygml.common.xlink.DBXlink; +import org.citydb.citygml.common.xlink.DBXlinkBasic; +import org.citydb.citygml.common.xlink.DBXlinkDeprecatedMaterial; +import org.citydb.citygml.common.xlink.DBXlinkGroupToCityObject; +import org.citydb.citygml.common.xlink.DBXlinkLibraryObject; +import org.citydb.citygml.common.xlink.DBXlinkSolidGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceDataToTexImage; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociation; +import org.citydb.citygml.common.xlink.DBXlinkTextureCoordList; +import org.citydb.citygml.common.xlink.DBXlinkTextureFile; +import org.citydb.citygml.common.xlink.DBXlinkTextureParam; +import org.citydb.citygml.common.xlink.DBXlinkTextureParamEnum; import org.citydb.concurrent.WorkerPool; import org.citydb.config.i18n.Language; import org.citydb.config.project.global.LogLevel; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkBasic.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkBasic.java index 8ef382a60..b83e54ef4 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkBasic.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkBasic.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.xlink.DBXlinkBasic; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.xlink.DBXlinkBasic; import org.citydb.database.schema.TableEnum; import java.sql.Connection; @@ -55,7 +55,7 @@ public XlinkBasic(Connection connection, DBXlinkResolverManager manager) { } public boolean insert(DBXlinkBasic xlink) throws SQLException { - UIDCacheEntry entry = TableEnum.SURFACE_GEOMETRY.getName().equalsIgnoreCase(xlink.getTable()) ? + IdCacheEntry entry = TableEnum.SURFACE_GEOMETRY.getName().equalsIgnoreCase(xlink.getTable()) ? manager.getGeometryId(xlink.getGmlId()) : manager.getObjectId(xlink.getGmlId()); diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkDeprecatedMaterial.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkDeprecatedMaterial.java index 5dc7f1295..8f77f3347 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkDeprecatedMaterial.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkDeprecatedMaterial.java @@ -27,8 +27,8 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.xlink.DBXlinkDeprecatedMaterial; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.xlink.DBXlinkDeprecatedMaterial; import org.citydb.database.schema.SequenceEnum; import java.sql.Connection; @@ -58,7 +58,7 @@ public XlinkDeprecatedMaterial(Connection batchConn, DBXlinkResolverManager mana } public boolean insert(DBXlinkDeprecatedMaterial xlink) throws SQLException { - UIDCacheEntry surfaceDataEntry = manager.getObjectId(xlink.getGmlId()); + IdCacheEntry surfaceDataEntry = manager.getObjectId(xlink.getGmlId()); if (surfaceDataEntry == null || surfaceDataEntry.getId() == -1) return false; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkGroupToCityObject.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkGroupToCityObject.java index 578364339..39d294e40 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkGroupToCityObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkGroupToCityObject.java @@ -27,9 +27,9 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.xlink.DBXlinkGroupToCityObject; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.xlink.DBXlinkGroupToCityObject; import org.citydb.database.schema.mapping.FeatureType; import java.sql.Connection; @@ -67,7 +67,7 @@ public XlinkGroupToCityObject(Connection connection, CacheTable cacheTable, DBXl public boolean insert(DBXlinkGroupToCityObject xlink) throws SQLException { // for groupMembers, we do not only lookup gml:ids within the document // but within the whole database - UIDCacheEntry cityObjectEntry = manager.getObjectId(xlink.getGmlId(), true); + IdCacheEntry cityObjectEntry = manager.getObjectId(xlink.getGmlId(), true); if (cityObjectEntry == null || cityObjectEntry.getId() == -1) return false; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkLibraryObject.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkLibraryObject.java index 6a85144b3..ac6c65558 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkLibraryObject.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkLibraryObject.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.xlink.DBXlinkLibraryObject; +import org.citydb.citygml.common.xlink.DBXlinkLibraryObject; import org.citydb.database.adapter.BlobImportAdapter; import org.citydb.database.adapter.BlobType; import org.citydb.log.Logger; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSolidGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSolidGeometry.java index 448f88664..ca167c9ee 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSolidGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSolidGeometry.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.xlink.DBXlinkSolidGeometry; +import org.citydb.citygml.common.xlink.DBXlinkSolidGeometry; import org.citydb.config.geometry.GeometryObject; import org.citydb.config.project.database.DatabaseType; import org.citydb.log.Logger; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSurfaceDataToTexImage.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSurfaceDataToTexImage.java index 9eaa702ef..6e8ffa498 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSurfaceDataToTexImage.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSurfaceDataToTexImage.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceDataToTexImage; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceDataToTexImage; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSurfaceGeometry.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSurfaceGeometry.java index 8d7654e61..496df9afb 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSurfaceGeometry.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkSurfaceGeometry.java @@ -27,9 +27,9 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.xlink.DBXlinkSurfaceGeometry; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.xlink.DBXlinkSurfaceGeometry; import org.citydb.config.geometry.GeometryObject; import org.citydb.config.project.database.DatabaseType; import org.citydb.database.schema.SequenceEnum; @@ -101,7 +101,7 @@ public XlinkSurfaceGeometry(Connection connection, CacheTable cacheTable, DBXlin } public boolean insert(DBXlinkSurfaceGeometry xlink) throws SQLException { - UIDCacheEntry rootGeometryEntry = manager.getGeometryId(xlink.getGmlId()); + IdCacheEntry rootGeometryEntry = manager.getGeometryId(xlink.getGmlId()); if (rootGeometryEntry == null || rootGeometryEntry.getRootId() == -1) { // do not return an error in case of implicit geometries since the // the implicit geometry might be a point or curve diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTexCoordList.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTexCoordList.java index b6e6916bd..ede2c09fd 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTexCoordList.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTexCoordList.java @@ -27,9 +27,9 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociationTarget; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureCoordList; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociationTarget; +import org.citydb.citygml.common.xlink.DBXlinkTextureCoordList; import org.citydb.config.geometry.GeometryObject; import org.citydb.log.Logger; import org.citydb.util.Util; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureAssociation.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureAssociation.java index f769fc86d..34a184a15 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureAssociation.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureAssociation.java @@ -27,10 +27,10 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.cache.CacheTable; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociation; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociationTarget; +import org.citydb.citygml.common.cache.CacheTable; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociation; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociationTarget; import org.citydb.log.Logger; import org.citydb.util.Util; import org.citygml4j.model.citygml.CityGMLClass; @@ -98,7 +98,7 @@ public boolean insert(DBXlinkTextureAssociation xlink) throws SQLException { if (rs.next()) { String worldToTexture = rs.getString("WORLD_TO_TEXTURE"); if (!rs.wasNull()) { - UIDCacheEntry entry = manager.getGeometryId(xlink.getTargetURI()); + IdCacheEntry entry = manager.getGeometryId(xlink.getTargetURI()); if (entry == null || entry.getId() == -1) { log.error("Failed to resolve XLink reference '" + xlink.getTargetURI() + "'."); continue; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureImage.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureImage.java index b22d9dd4b..308b09ebc 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureImage.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureImage.java @@ -27,7 +27,7 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureFile; +import org.citydb.citygml.common.xlink.DBXlinkTextureFile; import org.citydb.database.adapter.BlobImportAdapter; import org.citydb.database.adapter.BlobType; import org.citydb.event.global.CounterEvent; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureParam.java b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureParam.java index 2bb2d44dd..135a79101 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureParam.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/database/xlink/resolver/XlinkTextureParam.java @@ -27,10 +27,10 @@ */ package org.citydb.citygml.importer.database.xlink.resolver; -import org.citydb.citygml.common.database.uid.UIDCacheEntry; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureAssociationTarget; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureParam; -import org.citydb.citygml.common.database.xlink.DBXlinkTextureParamEnum; +import org.citydb.citygml.common.cache.IdCacheEntry; +import org.citydb.citygml.common.xlink.DBXlinkTextureAssociationTarget; +import org.citydb.citygml.common.xlink.DBXlinkTextureParam; +import org.citydb.citygml.common.xlink.DBXlinkTextureParamEnum; import org.citydb.util.Util; import java.sql.Connection; @@ -59,7 +59,7 @@ public boolean insert(DBXlinkTextureParam xlink) throws SQLException { if (Util.isRemoteXlink(xlink.getGmlId())) return false; - UIDCacheEntry geometryEntry = manager.getGeometryId(xlink.getGmlId()); + IdCacheEntry geometryEntry = manager.getGeometryId(xlink.getGmlId()); if (geometryEntry == null || geometryEntry.getId() == -1) return false; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/filter/CityGMLFilterBuilder.java b/impexp-core/src/main/java/org/citydb/citygml/importer/filter/CityGMLFilterBuilder.java index 592fdfaae..5e3ce244e 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/filter/CityGMLFilterBuilder.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/filter/CityGMLFilterBuilder.java @@ -64,13 +64,13 @@ public CityGMLFilter buildCityGMLFilter(ImportFilter filterConfig) throws Filter if (filterConfig.isUseAttributeFilter() && filterConfig.isSetAttributeFilter()) { SimpleAttributeFilter attributeFilterConfig = filterConfig.getAttributeFilter(); - // gml:id filter - if (attributeFilterConfig.isSetGmlIdFilter() && attributeFilterConfig.getGmlIdFilter().isSetResourceIds()) - filter.getSelectionFilter().setResourceIdFilter(new ResourceIdFilter(attributeFilterConfig.getGmlIdFilter())); + // resource id filter + if (attributeFilterConfig.isSetResourceIdFilter() && attributeFilterConfig.getResourceIdFilter().isSetResourceIds()) + filter.getSelectionFilter().setResourceIdFilter(new ResourceIdFilter(attributeFilterConfig.getResourceIdFilter())); - // gml:name filter - if (attributeFilterConfig.isSetGmlNameFilter() && attributeFilterConfig.getGmlNameFilter().isSetLiteral()) { - LikeOperator likeOperator = attributeFilterConfig.getGmlNameFilter(); + // name filter + if (attributeFilterConfig.isSetNameFilter() && attributeFilterConfig.getNameFilter().isSetLiteral()) { + LikeOperator likeOperator = attributeFilterConfig.getNameFilter(); if (!likeOperator.isSetWildCard() || likeOperator.getWildCard().length() > 1) throw new FilterException("Wildcards must be defined by a single character."); @@ -80,7 +80,7 @@ public CityGMLFilter buildCityGMLFilter(ImportFilter filterConfig) throws Filter if (!likeOperator.isSetEscapeCharacter() || likeOperator.getEscapeCharacter().length() > 1) throw new FilterException("An escape character must be defined by a single character."); - filter.getSelectionFilter().setGmlNameFilter(new LikeFilter(attributeFilterConfig.getGmlNameFilter())); + filter.getSelectionFilter().setNameFilter(new LikeFilter(attributeFilterConfig.getNameFilter())); } } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/filter/selection/SelectionFilter.java b/impexp-core/src/main/java/org/citydb/citygml/importer/filter/selection/SelectionFilter.java index 17a3543c2..f7276b5d3 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/filter/selection/SelectionFilter.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/filter/selection/SelectionFilter.java @@ -35,7 +35,7 @@ public class SelectionFilter { private ResourceIdFilter resourceIdFilter; - private LikeFilter gmlNameFilter; + private LikeFilter nameFilter; private SimpleBBOXFilter bboxFilter; public ResourceIdFilter getResourceIdFilter() { @@ -50,16 +50,16 @@ public void setResourceIdFilter(ResourceIdFilter resourceIdFilter) { this.resourceIdFilter = resourceIdFilter; } - public LikeFilter getGmlNameFilter() { - return gmlNameFilter; + public LikeFilter getNameFilter() { + return nameFilter; } - public boolean isSetGmlNameFilter() { - return gmlNameFilter != null; + public boolean isSetNameFilter() { + return nameFilter != null; } - public void setGmlNameFilter(LikeFilter gmlNameFilter) { - this.gmlNameFilter = gmlNameFilter; + public void setNameFilter(LikeFilter nameFilter) { + this.nameFilter = nameFilter; } public SimpleBBOXFilter getBboxFilter() { @@ -78,7 +78,7 @@ public boolean isSatisfiedBy(AbstractFeature feature) throws FilterException { if (resourceIdFilter != null && !resourceIdFilter.isSatisfiedBy(feature)) return false; - if (gmlNameFilter != null && !gmlNameFilter.isSatisfiedBy(feature)) + if (nameFilter != null && !nameFilter.isSatisfiedBy(feature)) return false; if (bboxFilter != null && !bboxFilter.isSatisfiedBy(feature)) diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/reader/citygml/CityGMLReader.java b/impexp-core/src/main/java/org/citydb/citygml/importer/reader/citygml/CityGMLReader.java index bc4c64801..2f7d4c81c 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/reader/citygml/CityGMLReader.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/reader/citygml/CityGMLReader.java @@ -21,6 +21,7 @@ import org.citygml4j.xml.io.reader.XMLChunk; import java.io.IOException; +import java.io.InputStream; public class CityGMLReader implements FeatureReader, EventHandler { private final CityGMLInputFilter typeFilter; @@ -74,7 +75,8 @@ public void read(InputFile inputFile, WorkerPool workerPool) throws Fea featureWorkerPool.prestartCoreWorkers(); try { - reader = factory.createFilteredCityGMLReader(factory.createCityGMLReader(inputFile.getFile().toString(), inputFile.openStream()), typeFilter); + reader = factory.createFilteredCityGMLReader( + createCityGMLReader(inputFile.getFile().toString(), inputFile.openStream()), typeFilter); while (shouldRun && reader.hasNext()) { XMLChunk chunk = reader.nextChunk(); @@ -109,8 +111,9 @@ public void read(InputFile inputFile, WorkerPool workerPool) throws Fea throw new FeatureReadException("Failed to close CityGML reader.", e); } } finally { - if (featureWorkerPool != null && !featureWorkerPool.isTerminated()) + if (featureWorkerPool != null && !featureWorkerPool.isTerminated()) { featureWorkerPool.shutdownNow(); + } } } @@ -123,4 +126,10 @@ public void close() throws FeatureReadException { public void handleEvent(Event event) throws Exception { shouldRun = false; } + + private org.citygml4j.xml.io.reader.CityGMLReader createCityGMLReader(String systemId, InputStream stream) throws CityGMLReadException { + return !config.getImportConfig().getGeneralOptions().isSetFileEncoding() ? + factory.createCityGMLReader(systemId, stream) : + factory.createCityGMLReader(systemId, stream, config.getImportConfig().getGeneralOptions().getFileEncoding()); + } } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/reader/citygml/CityGMLReaderFactory.java b/impexp-core/src/main/java/org/citydb/citygml/importer/reader/citygml/CityGMLReaderFactory.java index 5620bad80..daa06f733 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/reader/citygml/CityGMLReaderFactory.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/reader/citygml/CityGMLReaderFactory.java @@ -6,6 +6,7 @@ import org.citydb.citygml.importer.reader.FeatureReader; import org.citydb.citygml.importer.reader.FeatureReaderFactory; import org.citydb.config.Config; +import org.citydb.config.project.importer.CityGMLOptions; import org.citydb.log.Logger; import org.citydb.registry.ObjectRegistry; import org.citygml4j.builder.jaxb.CityGMLBuilderException; @@ -51,25 +52,27 @@ public void initializeContext(CityGMLFilter filter, Config config) throws Featur throw new FeatureReadException("Failed to initialize CityGML input factory.", e); } + CityGMLOptions cityGMLOptions = config.getImportConfig().getCityGMLOptions(); + // prepare XML validation - if (config.getImportConfig().getXMLValidation().isSetUseXMLValidation()) { + if (cityGMLOptions.getXMLValidation().isSetUseXMLValidation()) { log.info("Applying XML validation to CityGML input features."); factory.setProperty(CityGMLInputFactory.USE_VALIDATION, true); factory.setProperty(CityGMLInputFactory.PARSE_SCHEMA, true); validationHandler = new ValidationErrorHandler(); - validationHandler.setReportAllErrors(!config.getImportConfig().getXMLValidation().isSetReportOneErrorPerFeature()); + validationHandler.setReportAllErrors(!cityGMLOptions.getXMLValidation().isSetReportOneErrorPerFeature()); factory.setValidationEventHandler(validationHandler); } // build XSLT transformer chain - if (config.getImportConfig().getXSLTransformation().isEnabled() - && config.getImportConfig().getXSLTransformation().isSetStylesheets()) { + if (cityGMLOptions.getXSLTransformation().isEnabled() + && cityGMLOptions.getXSLTransformation().isSetStylesheets()) { try { log.info("Applying XSL transformations to CityGML input features."); - List stylesheets = config.getImportConfig().getXSLTransformation().getStylesheets(); + List stylesheets = cityGMLOptions.getXSLTransformation().getStylesheets(); SAXTransformerFactory factory = (SAXTransformerFactory) TransformerFactory.newInstance(); Templates[] templates = new Templates[stylesheets.size()]; diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/reader/cityjson/CityJSONReader.java b/impexp-core/src/main/java/org/citydb/citygml/importer/reader/cityjson/CityJSONReader.java index 6971fe2f4..d7e159281 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/reader/cityjson/CityJSONReader.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/reader/cityjson/CityJSONReader.java @@ -4,36 +4,38 @@ import org.citydb.citygml.importer.reader.FeatureReadException; import org.citydb.citygml.importer.reader.FeatureReader; import org.citydb.concurrent.WorkerPool; +import org.citydb.config.Config; import org.citydb.event.Event; import org.citydb.event.EventDispatcher; import org.citydb.event.EventHandler; import org.citydb.event.global.EventType; import org.citydb.file.InputFile; import org.citydb.registry.ObjectRegistry; +import org.citygml4j.builder.cityjson.json.io.reader.CityJSONChunkReader; import org.citygml4j.builder.cityjson.json.io.reader.CityJSONInputFactory; import org.citygml4j.builder.cityjson.json.io.reader.CityJSONReadException; import org.citygml4j.model.citygml.CityGML; import org.citygml4j.model.citygml.appearance.Appearance; -import org.citygml4j.model.citygml.core.CityModel; import org.citygml4j.model.gml.feature.AbstractFeature; -import org.citygml4j.model.gml.feature.FeatureProperty; import org.citygml4j.xml.io.reader.CityGMLInputFilter; -import java.io.IOException; -import java.util.Iterator; +import java.io.InputStream; public class CityJSONReader implements FeatureReader, EventHandler { private final CityGMLInputFilter typeFilter; private final CounterFilter counterFilter; private final CityJSONInputFactory factory; + private final Config config; private final EventDispatcher eventDispatcher; + private WorkerPool workerPool; private volatile boolean shouldRun = true; - CityJSONReader(CityGMLInputFilter typeFilter, CounterFilter counterFilter, CityJSONInputFactory factory) { + CityJSONReader(CityGMLInputFilter typeFilter, CounterFilter counterFilter, CityJSONInputFactory factory, Config config) { this.typeFilter = typeFilter; this.counterFilter = counterFilter; this.factory = factory; + this.config = config; eventDispatcher = ObjectRegistry.getInstance().getEventDispatcher(); eventDispatcher.addEventHandler(EventType.INTERRUPT,this); @@ -46,40 +48,29 @@ public long getValidationErrors() { @Override public void read(InputFile inputFile, WorkerPool workerPool) throws FeatureReadException { - try (org.citygml4j.builder.cityjson.json.io.reader.CityJSONReader reader = factory.createFilteredCityJSONReader( - factory.createCityJSONReader(inputFile.openStream()), typeFilter)) { - // read input file into a city model - CityModel cityModel = reader.read(); + this.workerPool = workerPool; - // process city model members - process(cityModel.getCityObjectMember().iterator(), workerPool); - process(cityModel.getFeatureMember().iterator(), workerPool); - process(cityModel.getAppearanceMember().iterator(), workerPool); - } catch (CityJSONReadException | IOException e) { + try (CityJSONChunkReader reader = factory.createFilteredCityJSONReader( + createCityJSONChunkReader(inputFile.openStream()), typeFilter)) { + reader.read(this::process); + } catch (Exception e) { throw new FeatureReadException("Failed to read CityJSON input file.", e); } } - private void process(Iterator> iter, WorkerPool workerPool) { - while (shouldRun && iter.hasNext()) { - AbstractFeature feature = iter.next().getFeature(); - - // unset parent to mark the feature as top-level - feature.unsetParent(); - - // remove feature from feature collection - iter.remove(); - + private void process(AbstractFeature feature) { + if (shouldRun) { if (feature instanceof CityGML) { if (counterFilter != null && !(feature instanceof Appearance)) { if (!counterFilter.isStartIndexSatisfied()) { counterFilter.incrementStartIndex(); - continue; + return; } counterFilter.incrementCount(); - if (!counterFilter.isCountSatisfied()) - continue; + if (!counterFilter.isCountSatisfied()) { + return; + } } workerPool.addWork((CityGML) feature); @@ -96,4 +87,10 @@ public void close() throws FeatureReadException { public void handleEvent(Event event) throws Exception { shouldRun = false; } + + private CityJSONChunkReader createCityJSONChunkReader(InputStream stream) throws CityJSONReadException { + return !config.getImportConfig().getGeneralOptions().isSetFileEncoding() ? + factory.createCityJSONChunkReader(stream) : + factory.createCityJSONChunkReader(stream, config.getImportConfig().getGeneralOptions().getFileEncoding()); + } } diff --git a/impexp-core/src/main/java/org/citydb/citygml/importer/reader/cityjson/CityJSONReaderFactory.java b/impexp-core/src/main/java/org/citydb/citygml/importer/reader/cityjson/CityJSONReaderFactory.java index de36a6c42..704d2eb96 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/importer/reader/cityjson/CityJSONReaderFactory.java +++ b/impexp-core/src/main/java/org/citydb/citygml/importer/reader/cityjson/CityJSONReaderFactory.java @@ -19,12 +19,16 @@ public class CityJSONReaderFactory implements FeatureReaderFactory { private CityJSONInputFactory factory; private CityGMLInputFilter typeFilter; private CounterFilter counterFilter; + private Config config; @Override public void initializeContext(CityGMLFilter filter, Config config) throws FeatureReadException { + this.config = config; + CityJSONBuilder builder = CityGMLContext.getInstance().createCityJSONBuilder(); try { factory = builder.createCityJSONInputFactory(); + factory.setProcessUnknownExtensions(config.getImportConfig().getCityJSONOptions().isMapUnknownExtensions()); } catch (CityJSONBuilderException e) { throw new FeatureReadException("Failed to initialize CityJSON input factory.", e); } @@ -43,6 +47,6 @@ public void initializeContext(CityGMLFilter filter, Config config) throws Featur @Override public FeatureReader createFeatureReader() throws FeatureReadException { - return new CityJSONReader(typeFilter, counterFilter, factory); + return new CityJSONReader(typeFilter, counterFilter, factory, config); } } diff --git a/impexp-core/src/main/java/org/citydb/citygml/validator/reader/citygml/ValidationErrorHandler.java b/impexp-core/src/main/java/org/citydb/citygml/validator/reader/citygml/ValidationErrorHandler.java index 2e7624517..7e137136f 100644 --- a/impexp-core/src/main/java/org/citydb/citygml/validator/reader/citygml/ValidationErrorHandler.java +++ b/impexp-core/src/main/java/org/citydb/citygml/validator/reader/citygml/ValidationErrorHandler.java @@ -68,7 +68,7 @@ public boolean hasFatalErrors() { void reset() { validationErrors = 0; - isReportAllErrors = !config.getImportConfig().getXMLValidation().isSetReportOneErrorPerFeature(); + isReportAllErrors = !config.getImportConfig().getCityGMLOptions().getXMLValidation().isSetReportOneErrorPerFeature(); isAborted = false; hasFatalErrors = false; location = null; diff --git a/impexp-core/src/main/java/org/citydb/file/output/OutputFileFactory.java b/impexp-core/src/main/java/org/citydb/file/output/OutputFileFactory.java index 904e70350..db16b7002 100644 --- a/impexp-core/src/main/java/org/citydb/file/output/OutputFileFactory.java +++ b/impexp-core/src/main/java/org/citydb/file/output/OutputFileFactory.java @@ -29,9 +29,10 @@ package org.citydb.file.output; import org.citydb.config.Config; +import org.citydb.config.project.exporter.OutputFormat; +import org.citydb.event.EventDispatcher; import org.citydb.file.FileType; import org.citydb.file.OutputFile; -import org.citydb.event.EventDispatcher; import org.citydb.util.Util; import java.io.IOException; @@ -53,7 +54,7 @@ public OutputFileFactory(Config config, EventDispatcher eventDispatcher) { this(config, eventDispatcher, null); } - public OutputFile createOutputFile(Path file) throws IOException { + public OutputFile createOutputFile(Path file, OutputFormat outputFormat) throws IOException { file = file.toAbsolutePath().normalize(); Files.createDirectories(file.getParent()); @@ -65,7 +66,8 @@ public OutputFile createOutputFile(Path file) throws IOException { switch (extension) { case "zip": - return new ZipOutputFile(Util.stripFileExtension(file.getFileName().toString()) + ".gml", + extension = outputFormat == OutputFormat.CITYJSON ? ".json" : ".gml"; + return new ZipOutputFile(Util.stripFileExtension(file.getFileName().toString()) + extension, file, file.getParent(), config.getExportConfig().getResources().getThreadPool().getMaxThreads(), @@ -75,11 +77,11 @@ public OutputFile createOutputFile(Path file) throws IOException { case "gz": return new GZipOutputFile(file); default: - return new XMLOutputFile(file); + return new RegularOutputFile(file); } } - public FileType getFileType(Path file) { + public static FileType getFileType(Path file) { switch (Util.getFileExtension(file)) { case "zip": return FileType.ARCHIVE; @@ -90,4 +92,18 @@ public FileType getFileType(Path file) { return FileType.REGULAR; } } + + public static OutputFormat getOutputFormat(Path file, Config config) { + switch (Util.getFileExtension(file)) { + case "json": + case "cityjson": + return OutputFormat.CITYJSON; + case "zip": + case "gzip": + case "gz": + return config.getExportConfig().getGeneralOptions().getCompressedOutputFormat(); + } + + return OutputFormat.CITYGML; + } } diff --git a/impexp-core/src/main/java/org/citydb/file/output/XMLOutputFile.java b/impexp-core/src/main/java/org/citydb/file/output/RegularOutputFile.java similarity index 92% rename from impexp-core/src/main/java/org/citydb/file/output/XMLOutputFile.java rename to impexp-core/src/main/java/org/citydb/file/output/RegularOutputFile.java index 019504413..69730d7c2 100644 --- a/impexp-core/src/main/java/org/citydb/file/output/XMLOutputFile.java +++ b/impexp-core/src/main/java/org/citydb/file/output/RegularOutputFile.java @@ -33,9 +33,9 @@ import java.nio.file.Files; import java.nio.file.Path; -public class XMLOutputFile extends AbstractRegularOutputFile { +public class RegularOutputFile extends AbstractRegularOutputFile { - XMLOutputFile(Path file) { + RegularOutputFile(Path file) { super(file, false); } diff --git a/impexp-core/src/main/java/org/citydb/query/builder/config/ConfigQueryBuilder.java b/impexp-core/src/main/java/org/citydb/query/builder/config/ConfigQueryBuilder.java index a74251109..2e6a53f16 100644 --- a/impexp-core/src/main/java/org/citydb/query/builder/config/ConfigQueryBuilder.java +++ b/impexp-core/src/main/java/org/citydb/query/builder/config/ConfigQueryBuilder.java @@ -220,12 +220,12 @@ else if (featureVersionFilter.isSetStartDate() if (!selectionFilter.isUseSQLFilter()) { // gml:id filter - if (selectionFilter.isSetGmlIdFilter() && selectionFilter.getGmlIdFilter().isSetResourceIds()) - predicates.add(predicateBuilder.buildPredicate(selectionFilter.getGmlIdFilter())); + if (selectionFilter.isSetResourceIdFilter() && selectionFilter.getResourceIdFilter().isSetResourceIds()) + predicates.add(predicateBuilder.buildPredicate(selectionFilter.getResourceIdFilter())); // gml:name filter - if (selectionFilter.isSetGmlNameFilter() && selectionFilter.getGmlNameFilter().isSetLiteral()) { - LikeOperator gmlNameFilter = selectionFilter.getGmlNameFilter(); + if (selectionFilter.isSetNameFilter() && selectionFilter.getNameFilter().isSetLiteral()) { + LikeOperator gmlNameFilter = selectionFilter.getNameFilter(); gmlNameFilter.setValueReference("gml:name"); predicates.add(predicateBuilder.buildPredicate(gmlNameFilter)); } @@ -318,8 +318,8 @@ public Query buildQuery(SimpleKmlQuery queryConfig, NamespaceContext namespaceCo } // gml:id filter - if (queryConfig.isUseGmlIdFilter() && queryConfig.isSetGmlIdFilter() && queryConfig.getGmlIdFilter().isSetResourceIds()) { - query.setSelection(new SelectionFilter(predicateBuilder.buildPredicate(queryConfig.getGmlIdFilter()))); + if (queryConfig.isUseResourceIdFilter() && queryConfig.isSetResourceIdFilter() && queryConfig.getResourceIdFilter().isSetResourceIds()) { + query.setSelection(new SelectionFilter(predicateBuilder.buildPredicate(queryConfig.getResourceIdFilter()))); } KmlTiling spatialFilter = queryConfig.getSpatialFilter(); diff --git a/impexp-plugin-api/src/main/java/org/citydb/plugin/cli/ResourceIdOption.java b/impexp-plugin-api/src/main/java/org/citydb/plugin/cli/ResourceIdOption.java index 8d319868e..45dea3f09 100644 --- a/impexp-plugin-api/src/main/java/org/citydb/plugin/cli/ResourceIdOption.java +++ b/impexp-plugin-api/src/main/java/org/citydb/plugin/cli/ResourceIdOption.java @@ -32,8 +32,8 @@ import picocli.CommandLine; public class ResourceIdOption implements CliOption { - @CommandLine.Option(names = {"-i", "--gml-id"}, split = ",", paramLabel = "", - description = "Process top-level features with a matching gml:id.") + @CommandLine.Option(names = {"-i", "--resource-id"}, split = ",", paramLabel = "", + description = "Process top-level features with a matching identifier.") private String[] ids; public ResourceIdOperator toResourceIdOperator() {