Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,8 @@ private String init(boolean initFull) {
// ... And now the "real" working version lookup:

if (versionId != null) {
this.workingVersion = datasetVersionService.findDeep(versionId);
//6.6patch this.workingVersion = datasetVersionService.findDeep(versionId);
this.workingVersion = datasetVersionService.find(versionId);
dataset = workingVersion.getDataset();
}

Expand Down Expand Up @@ -3069,7 +3070,8 @@ public String refresh() {
// versionId must have been set by now (see null check above), in the init()
// method, regardless of how the page was originally called - by the dataset
// database id, by the persistent identifier, or by the db id of the version.
this.workingVersion = datasetVersionService.findDeep(versionId);
//6.6patch this.workingVersion = datasetVersionService.findDeep(versionId);
this.workingVersion = datasetVersionService.find(versionId);
dataset = workingVersion.getDataset();
}

Expand Down
20 changes: 12 additions & 8 deletions src/main/java/edu/harvard/iq/dataverse/api/Datasets.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public interface DsVersionHandler<T> {
@Path("{id}")
public Response getDataset(@Context ContainerRequestContext crc, @PathParam("id") String id, @Context UriInfo uriInfo, @Context HttpHeaders headers, @Context HttpServletResponse response, @QueryParam("returnOwners") boolean returnOwners) {
return response( req -> {
final Dataset retrieved = execCommand(new GetDatasetCommand(req, findDatasetOrDie(id, true)));
final Dataset retrieved = execCommand(new GetDatasetCommand(req, findDatasetOrDie(id, false)));
final DatasetVersion latest = execCommand(new GetLatestAccessibleDatasetVersionCommand(req, retrieved));
final JsonObjectBuilder jsonbuilder = json(retrieved, returnOwners);
//Report MDC if this is a released version (could be draft if user has access, or user may not have access at all and is not getting metadata beyond the minimum)
Expand Down Expand Up @@ -451,16 +451,17 @@ public Response useDefaultCitationDate(@Context ContainerRequestContext crc, @Pa
@GET
@AuthRequired
@Path("{id}/versions")
public Response listVersions(@Context ContainerRequestContext crc, @PathParam("id") String id, @QueryParam("excludeFiles") Boolean excludeFiles,@QueryParam("excludeMetadataBlocks") Boolean excludeMetadataBlocks, @QueryParam("limit") Integer limit, @QueryParam("offset") Integer offset) {
public Response listVersions(@Context ContainerRequestContext crc, @PathParam("id") String id, @QueryParam("excludeFiles") Boolean excludeFiles, @QueryParam("excludeMetadataBlocks") Boolean excludeMetadataBlocks, @QueryParam("limit") Integer limit, @QueryParam("offset") Integer offset) {

return response( req -> {
Dataset dataset = findDatasetOrDie(id);
Boolean deepLookup = excludeFiles == null ? true : !excludeFiles;
//6.6patchBoolean deepLookup = excludeFiles == null ? true : !excludeFiles;
Boolean includeFiles = excludeFiles == null ? true : !excludeFiles;
Boolean includeMetadataBlocks = excludeMetadataBlocks == null ? true : !excludeMetadataBlocks;

return ok( execCommand( new ListVersionsCommand(req, dataset, offset, limit, deepLookup) )
return ok( execCommand( new ListVersionsCommand(req, dataset, offset, limit, false) )
.stream()
.map( d -> json(d, deepLookup, includeMetadataBlocks) )
.map( d -> json(d, includeFiles, includeMetadataBlocks) )
.collect(toJsonArray()));
}, getRequestUser(crc));
}
Expand Down Expand Up @@ -498,9 +499,12 @@ public Response getVersion(@Context ContainerRequestContext crc,
if (requestedDatasetVersion == null || requestedDatasetVersion.getId() == null) {
return notFound("Dataset version not found");
}
if (includeFiles) {

/* patch6.7 if (excludeFiles == null ? true : !excludeFiles) {
requestedDatasetVersion = datasetversionService.findDeep(requestedDatasetVersion.getId());
}
}*/

Boolean includeMetadataBlocks = excludeMetadataBlocks == null ? true : !excludeMetadataBlocks;

// Check to see if the caller wants to ignore the ExcludeEmailFromExport setting in the metadata block and that they have permission to do so
// Let the JsonPrinter know to ignore the ExcludeEmailFromExport setting so the emails will show for this API call by permitted user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,18 @@ public List<DatasetVersion> execute(CommandContext ctxt) throws CommandException

boolean includeUnpublished = ctxt.permissions().request(getRequest()).on(ds).has(Permission.EditDataset);

if (offset == null && limit == null) {
Integer requestedOffset = offset;
Integer requestedLimit = limit;

if (offset == null && limit == null) {
// I don't want to allow some rando to run this on a dataset w/ 1,000
// versions without a range limit. -- 6.7patch
requestedOffset = 0;
requestedLimit = 10;
}


List<DatasetVersion> outputList = new LinkedList<>();
/* patch6.7 List<DatasetVersion> outputList = new LinkedList<>();
for (DatasetVersion dsv : ds.getVersions()) {
if (dsv.isReleased() || includeUnpublished) {
if (deepLookup) {
Expand All @@ -72,9 +81,9 @@ public List<DatasetVersion> execute(CommandContext ctxt) throws CommandException
}
}
return outputList;
} else {
} else { */
// Only a partial list (one "page"-worth) of versions is being requested
return ctxt.datasetVersion().findVersions(ds.getId(), offset, limit, includeUnpublished);
}
return ctxt.datasetVersion().findVersions(ds.getId(), requestedOffset, requestedLimit, includeUnpublished);
/*}*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2117,7 +2117,8 @@ private void updatePathForExistingSolrDocs(DvObject object) throws SolrServerExc

Dataset dataset = null;
if (object.isInstanceofDataset()) {
dataset = datasetService.findDeep(object.getId());
//6.6patch dataset = datasetService.findDeep(object.getId());
dataset = (Dataset)object;
}
List<String> paths = object.isInstanceofDataset() ? retrieveDVOPaths(dataset)
: retrieveDVOPaths(dataverseService.find(object.getId()));
Expand Down
Loading