From 772813edcbb94b6a88b1168e3186982d310f43db Mon Sep 17 00:00:00 2001 From: Gustavo Durand Date: Thu, 2 Apr 2015 14:18:40 -0400 Subject: [PATCH] added skipIndexed --- .../java/edu/harvard/iq/dataverse/api/Index.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Index.java b/src/main/java/edu/harvard/iq/dataverse/api/Index.java index dab6d594fa2..9a2b233f173 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Index.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Index.java @@ -74,6 +74,16 @@ public class Index extends AbstractApiBean { @GET public Response indexAllOrSubset(@QueryParam("numPartitions") Long numPartitionsSelected, @QueryParam("partitionIdToProcess") Long partitionIdToProcess, @QueryParam("previewOnly") boolean previewOnly) { + return indexAllOrSubset(numPartitionsSelected, partitionIdToProcess, false, previewOnly); + } + + @GET + @Path("continue") + public Response indexAllOrSubsetContinue(@QueryParam("numPartitions") Long numPartitionsSelected, @QueryParam("partitionIdToProcess") Long partitionIdToProcess, @QueryParam("previewOnly") boolean previewOnly) { + return indexAllOrSubset(numPartitionsSelected, partitionIdToProcess, true, previewOnly); + } + + private Response indexAllOrSubset(Long numPartitionsSelected, Long partitionIdToProcess, boolean skipIndexed, boolean previewOnly) { try { long numPartitions = 1; if (numPartitionsSelected != null) { @@ -113,7 +123,7 @@ public Response indexAllOrSubset(@QueryParam("numPartitions") Long numPartitions availablePartitionIdsBuilder.add(i); } - JsonObjectBuilder preview = indexAllService.indexAllOrSubsetPreview(numPartitions, partitionIdToProcess); + JsonObjectBuilder preview = indexAllService.indexAllOrSubsetPreview(numPartitions, partitionIdToProcess, skipIndexed); if (previewOnly) { preview.add("args", args); preview.add("availablePartitionIds", availablePartitionIdsBuilder); @@ -127,7 +137,7 @@ public Response indexAllOrSubset(@QueryParam("numPartitions") Long numPartitions * @todo How can we expose the String returned from "index all" via * the API? */ - Future indexAllFuture = indexAllService.indexAllOrSubset(numPartitions, partitionIdToProcess, previewOnly); + Future indexAllFuture = indexAllService.indexAllOrSubset(numPartitions, partitionIdToProcess, skipIndexed, previewOnly); JsonObject workloadPreview = preview.build().getJsonObject("previewOfPartitionWorkload"); int dataverseCount = workloadPreview.getInt("dataverseCount"); int datasetCount = workloadPreview.getInt("datasetCount"); @@ -167,7 +177,7 @@ public Response indexAllOrSubset(@QueryParam("numPartitions") Long numPartitions } } } - + @GET @Path("{type}/{id}") public Response indexTypeById(@PathParam("type") String type, @PathParam("id") Long id) {