예제 #1
0
  @RequireSystemAccess
  @GET
  @Path("rebuild/{jobId}")
  @JSONP
  @Produces({MediaType.APPLICATION_JSON, "application/javascript"})
  public ApiResponse rebuildIndexesGet(
      @PathParam("jobId") String jobId,
      @QueryParam("callback") @DefaultValue("callback") String callback)
      throws Exception {
    logger.info("Getting status for index jobs");

    Preconditions.checkNotNull(jobId, "query param jobId must not be null");

    ReIndexService.ReIndexStatus status = getReIndexService().getStatus(jobId);

    final ApiResponse response = createApiResponse();

    response.setAction("rebuild indexes");
    response.setProperty("jobId", status.getJobId());
    response.setProperty("status", status.getStatus());
    response.setProperty("lastUpdatedEpoch", status.getLastUpdated());
    response.setProperty("numberQueued", status.getNumberProcessed());
    response.setSuccess();

    return response;
  }
예제 #2
0
  /** Execute the request and return the response. */
  private ApiResponse executeAndCreateResponse(
      final ReIndexRequestBuilder request, final String callback) {

    final ReIndexService.ReIndexStatus status = getReIndexService().rebuildIndex(request);

    final ApiResponse response = createApiResponse();

    response.setAction("rebuild indexes");
    response.setProperty("jobId", status.getJobId());
    response.setProperty("status", status.getStatus());
    response.setProperty("lastUpdatedEpoch", status.getLastUpdated());
    response.setProperty("numberQueued", status.getNumberProcessed());
    response.setSuccess();

    return response;
  }