@POST
  @Timed
  @Consumes(MediaType.APPLICATION_JSON)
  @ApiOperation(value = "Update extractor order of an input")
  @ApiResponses(value = {@ApiResponse(code = 404, message = "No such input on this node.")})
  @Path("order")
  public void order(
      @ApiParam(name = "inputId", value = "Persist ID (!) of input.", required = true)
          @PathParam("inputId")
          String inputPersistId,
      @ApiParam(name = "JSON body", required = true) OrderExtractorsRequest oer)
      throws NotFoundException {
    checkPermission(RestPermissions.INPUTS_EDIT, inputPersistId);

    final Input mongoInput = inputService.find(inputPersistId);

    for (Extractor extractor : inputService.getExtractors(mongoInput)) {
      if (oer.order().containsValue(extractor.getId())) {
        extractor.setOrder(Tools.getKeyByValue(oer.order(), extractor.getId()));
      }

      // Docs embedded in MongoDB array cannot be updated atomically... :/
      inputService.removeExtractor(mongoInput, extractor.getId());
      try {
        inputService.addExtractor(mongoInput, extractor);
      } catch (ValidationException e) {
        LOG.warn("Validation error for extractor update.", e);
      }
    }

    LOG.info("Updated extractor ordering of input <persist:{}>.", inputPersistId);
  }
  @GET
  @Timed
  @ApiOperation(value = "List all extractors of an input")
  @ApiResponses(value = {@ApiResponse(code = 404, message = "No such input on this node.")})
  @Produces(MediaType.APPLICATION_JSON)
  public ExtractorSummaryList list(
      @ApiParam(name = "inputId", required = true) @PathParam("inputId") String inputId)
      throws NotFoundException {
    checkPermission(RestPermissions.INPUTS_READ, inputId);

    final Input input = inputService.find(inputId);
    if (input == null) {
      LOG.error("Input <{}> not found.", inputId);
      throw new javax.ws.rs.NotFoundException();
    }

    final List<ExtractorSummary> extractors = Lists.newArrayList();
    for (Extractor extractor : inputService.getExtractors(input)) {
      extractors.add(toSummary(extractor));
    }

    return ExtractorSummaryList.create(extractors);
  }