-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support partitioning XPlanGML by plan
Adds a partitioning scheme for the XPlanGML writer that writes all instances of `*_PlanType` and their directly or indirectly referenced non-plan instances into separate output files. The name of the output files contains both the type and the ID of the exported plan. The split is achieved by first separating plan instances into different `InstanceCollections` and then, for each plan, adding all referenced instances found in the reference graph. This might result in instances being written multiple times if they are shared between different plans. #814
- Loading branch information
1 parent
ac7f12b
commit b3b3221
Showing
4 changed files
with
268 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
...umboldt.hale.io.gml.ui/src/eu/esdihumboldt/hale/io/gml/ui/XPlanGmlWriterSettingsPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Copyright (c) 2020 wetransform GmbH | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this distribution. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Contributors: | ||
* wetransform GmbH <http://www.wetransform.to> | ||
*/ | ||
|
||
package eu.esdihumboldt.hale.io.gml.ui; | ||
|
||
import org.eclipse.jface.layout.GridDataFactory; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.layout.GridLayout; | ||
import org.eclipse.swt.widgets.Button; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.swt.widgets.Group; | ||
|
||
import eu.esdihumboldt.hale.common.core.io.Value; | ||
import eu.esdihumboldt.hale.io.gml.writer.XPlanGmlInstanceWriter; | ||
import eu.esdihumboldt.hale.io.gml.writer.internal.StreamGmlWriter; | ||
import eu.esdihumboldt.hale.ui.io.IOWizard; | ||
import eu.esdihumboldt.hale.ui.io.config.AbstractConfigurationPage; | ||
|
||
/** | ||
* Configuration page for XPlanGML file partitioning. | ||
* | ||
* @author Florian Esser | ||
*/ | ||
@SuppressWarnings("restriction") | ||
public class XPlanGmlWriterSettingsPage | ||
extends AbstractConfigurationPage<StreamGmlWriter, IOWizard<StreamGmlWriter>> { | ||
|
||
private Button activatePartitioningByPlan; | ||
|
||
/** | ||
* Default constructor. | ||
*/ | ||
public XPlanGmlWriterSettingsPage() { | ||
super("xPlanGmlPartition"); | ||
|
||
setTitle("XPlanGML settings"); | ||
setDescription("Settings for writing XPlanGML files"); | ||
} | ||
|
||
@Override | ||
public void enable() { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public void disable() { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public boolean updateConfiguration(StreamGmlWriter provider) { | ||
if (activatePartitioningByPlan.getSelection()) { | ||
provider.setParameter(XPlanGmlInstanceWriter.PARAM_PARTITION_BY_PLAN, Value.of(true)); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
protected void createContent(Composite page) { | ||
page.setLayout(new GridLayout(1, false)); | ||
GridDataFactory groupData = GridDataFactory.fillDefaults().grab(true, false); | ||
|
||
Group split = new Group(page, SWT.NONE); | ||
split.setLayout(new GridLayout(3, false)); | ||
split.setText("Split by plan"); | ||
groupData.applyTo(split); | ||
|
||
activatePartitioningByPlan = new Button(split, SWT.CHECK); | ||
activatePartitioningByPlan.setText("Create separate output file for every plan element"); | ||
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).span(3, 1).grab(true, false) | ||
.applyTo(activatePartitioningByPlan); | ||
activatePartitioningByPlan.setSelection(false); | ||
|
||
setPageComplete(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters