private ExtractorSummary toSummary(Extractor extractor) {
    final ExtractorMetrics metrics =
        ExtractorMetrics.create(
            MetricUtils.buildTimerMap(
                metricRegistry.getTimers().get(extractor.getTotalTimerName())),
            MetricUtils.buildTimerMap(
                metricRegistry.getTimers().get(extractor.getConverterTimerName())));

    return ExtractorSummary.create(
        extractor.getId(),
        extractor.getTitle(),
        extractor.getType().toString().toLowerCase(),
        extractor.getCursorStrategy().toString().toLowerCase(),
        extractor.getSourceField(),
        extractor.getTargetField(),
        extractor.getExtractorConfig(),
        extractor.getCreatorUserId(),
        extractor.converterConfigMap(),
        extractor.getConditionType().toString().toLowerCase(),
        extractor.getConditionValue(),
        extractor.getOrder(),
        extractor.getExceptionCount(),
        extractor.getConverterExceptionCount(),
        metrics);
  }
  @DELETE
  @Timed
  @ApiOperation(value = "Delete an extractor")
  @Path("/{extractorId}")
  @ApiResponses(
      value = {
        @ApiResponse(code = 400, message = "Invalid request."),
        @ApiResponse(code = 404, message = "Input not found."),
        @ApiResponse(code = 404, message = "Extractor not found.")
      })
  @Produces(MediaType.APPLICATION_JSON)
  public void terminate(
      @ApiParam(name = "inputId", required = true) @PathParam("inputId") String inputId,
      @ApiParam(name = "extractorId", required = true) @PathParam("extractorId") String extractorId)
      throws NotFoundException {
    checkPermission(RestPermissions.INPUTS_EDIT, inputId);

    final MessageInput input = persistedInputs.get(inputId);
    if (input == null) {
      LOG.error("Input <{}> not found.", inputId);
      throw new javax.ws.rs.NotFoundException("Couldn't find input " + inputId);
    }

    // Remove from Mongo.
    final Input mongoInput = inputService.find(input.getPersistId());
    final Extractor extractor = inputService.getExtractor(mongoInput, extractorId);
    inputService.removeExtractor(mongoInput, extractor.getId());

    final String msg =
        "Deleted extractor <"
            + extractorId
            + "> of type ["
            + extractor.getType()
            + "] "
            + "from input <"
            + inputId
            + ">.";
    LOG.info(msg);
    activityWriter.write(new Activity(msg, InputsResource.class));
  }