Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/10171-versions-smaller-resp…
Browse files Browse the repository at this point in the history
…onse' into feat/10171-versions-smaller-response
  • Loading branch information
johannes-darms committed Dec 18, 2024
2 parents bf4e5ff + 29b30c2 commit b8d0f3d
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,17 @@ public static JsonObjectBuilder json(FileDetailsHolder ds) {
}

public static JsonObjectBuilder json(DatasetVersion dsv, boolean includeFiles) {
return json(dsv, null, includeFiles, false);
return json(dsv, null, includeFiles, false,true);
}
public static JsonObjectBuilder json(DatasetVersion dsv, boolean includeFiles, boolean includeMetadataBlocks) {
return json(dsv, null, includeFiles, false, includeMetadataBlocks);
}
public static JsonObjectBuilder json(DatasetVersion dsv, List<String> anonymizedFieldTypeNamesList,
boolean includeFiles, boolean returnOwners) {
return json( dsv, anonymizedFieldTypeNamesList, includeFiles, returnOwners,true);
}

public static JsonObjectBuilder json(DatasetVersion dsv, List<String> anonymizedFieldTypeNamesList,
boolean includeFiles, boolean returnOwners) {
boolean includeFiles, boolean returnOwners, boolean includeMetadataBlocks) {
Dataset dataset = dsv.getDataset();
JsonObjectBuilder bld = jsonObjectBuilder()
.add("id", dsv.getId()).add("datasetId", dataset.getId())
Expand Down Expand Up @@ -471,11 +477,12 @@ public static JsonObjectBuilder json(DatasetVersion dsv, List<String> anonymized
.add("sizeOfCollection", dsv.getTermsOfUseAndAccess().getSizeOfCollection())
.add("studyCompletion", dsv.getTermsOfUseAndAccess().getStudyCompletion())
.add("fileAccessRequest", dsv.getTermsOfUseAndAccess().isFileAccessRequest());

bld.add("metadataBlocks", (anonymizedFieldTypeNamesList != null) ?
jsonByBlocks(dsv.getDatasetFields(), anonymizedFieldTypeNamesList)
: jsonByBlocks(dsv.getDatasetFields())
);
if(includeMetadataBlocks) {
bld.add("metadataBlocks", (anonymizedFieldTypeNamesList != null) ?
jsonByBlocks(dsv.getDatasetFields(), anonymizedFieldTypeNamesList)
: jsonByBlocks(dsv.getDatasetFields())
);
}
if(returnOwners){
bld.add("isPartOf", getOwnersFromDvObject(dataset));
}
Expand Down

0 comments on commit b8d0f3d

Please sign in to comment.