Skip to content

Commit 0500d7e

Browse files
committed
Another experimental approach (#11766)
1 parent f9963ca commit 0500d7e

File tree

2 files changed

+57
-12
lines changed

2 files changed

+57
-12
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package io.gdcc.spi.export;
2+
3+
/**
4+
*
5+
* @author landreev
6+
* Provides a mechanism for defining various data retrieval options for the
7+
* export subsystem in a way that should allow us adding support for more
8+
* options going forward with minimal or no changes to the existing code in
9+
* export plugins.
10+
*/
11+
public class ExportDataOption {
12+
13+
public enum SupportedOptions {
14+
DatasetMetadataOnly,
15+
PublicFilesOnly;
16+
}
17+
18+
private SupportedOptions optionType;
19+
20+
/*public static ExportDataOption addOption(String option) {
21+
ExportDataOption ret = new ExportDataOption();
22+
23+
for (SupportedOptions supported : SupportedOptions.values()) {
24+
if (supported.toString().equals(option)) {
25+
ret.optionType = supported;
26+
}
27+
}
28+
return ret;
29+
}*/
30+
31+
public static ExportDataOption addDatasetMetadataOnly() {
32+
ExportDataOption ret = new ExportDataOption();
33+
ret.optionType = SupportedOptions.DatasetMetadataOnly;
34+
return ret;
35+
}
36+
37+
public static ExportDataOption addPublicFilesOnly() {
38+
ExportDataOption ret = new ExportDataOption();
39+
ret.optionType = SupportedOptions.PublicFilesOnly;
40+
return ret;
41+
}
42+
43+
public boolean isDatasetMetadataOnly() {
44+
return SupportedOptions.DatasetMetadataOnly.equals(optionType);
45+
}
46+
47+
public boolean isPublicFilesOnly() {
48+
return SupportedOptions.PublicFilesOnly.equals(optionType);
49+
}
50+
}

modules/dataverse-spi/src/main/java/io/gdcc/spi/export/ExportDataProvider.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public interface ExportDataProvider {
3838
* dataset-level metadata along with basic file metadata for each file
3939
* in the dataset.
4040
*/
41-
JsonObject getDatasetORE();
41+
JsonObject getDatasetORE(ExportDataOption... options);
4242

4343
/**
4444
* Dataverse is capable of extracting DDI-centric metadata from tabular
@@ -53,7 +53,7 @@ public interface ExportDataProvider {
5353
* edu.harvard.iq.dataverse.util.json.JSONPrinter classes where this
5454
* output is used/generated (respectively).
5555
*/
56-
JsonArray getDatasetFileDetails();
56+
JsonArray getDatasetFileDetails(ExportDataOption... options);
5757

5858
/**
5959
* Similar to the above, but
@@ -78,7 +78,7 @@ public interface ExportDataProvider {
7878
* a starting point for an Exporter if it simplifies your exporter
7979
* relative to using the JSON or OAI_ORE exports.
8080
*/
81-
JsonObject getDatasetSchemaDotOrg();
81+
JsonObject getDatasetSchemaDotOrg(ExportDataOption... options);
8282

8383
/**
8484
*
@@ -88,7 +88,7 @@ public interface ExportDataProvider {
8888
* a starting point for an Exporter if it simplifies your exporter
8989
* relative to using the JSON or OAI_ORE exports.
9090
*/
91-
String getDataCiteXml();
91+
String getDataCiteXml(ExportDataOption... options);
9292

9393
/**
9494
* If an Exporter has specified a prerequisite format name via the
@@ -108,13 +108,8 @@ public interface ExportDataProvider {
108108
* Exporter is configured to replace the internal ddi Exporter in
109109
* Dataverse.
110110
*/
111-
default Optional<InputStream> getPrerequisiteInputStream() {
111+
default Optional<InputStream> getPrerequisiteInputStream(ExportDataOption... options) {
112112
return Optional.empty();
113113
}
114-
115-
public enum ExportDataOption {
116-
DatasetMetadataOnly,
117-
PublicFilesOnly;
118-
}
119-
120-
}
114+
115+
}

0 commit comments

Comments
 (0)