diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java index d0c1eb239f6..fa511051be5 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java @@ -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(); } @@ -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(); } diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Datasets.java b/src/main/java/edu/harvard/iq/dataverse/api/Datasets.java index 1b3016ec2f4..20e11c5a451 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Datasets.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Datasets.java @@ -213,7 +213,7 @@ public interface DsVersionHandler { @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) @@ -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)); } @@ -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 diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ListVersionsCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ListVersionsCommand.java index b93833ffdf9..04a303bf3cc 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ListVersionsCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ListVersionsCommand.java @@ -52,9 +52,18 @@ public List 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 outputList = new LinkedList<>(); + /* patch6.7 List outputList = new LinkedList<>(); for (DatasetVersion dsv : ds.getVersions()) { if (dsv.isReleased() || includeUnpublished) { if (deepLookup) { @@ -72,9 +81,9 @@ public List 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); + /*}*/ } } diff --git a/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java index 63ae3625a96..bfb19a4c169 100644 --- a/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java @@ -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 paths = object.isInstanceofDataset() ? retrieveDVOPaths(dataset) : retrieveDVOPaths(dataverseService.find(object.getId()));