public Result update(String nodeId, String inputId, String extractorId) {
    if (!Permissions.isPermitted(RestPermissions.INPUTS_EDIT, inputId)) {
      return redirect(routes.StartpageController.redirect());
    }
    try {
      final Node node = nodeService.loadNode(nodeId);
      final Input input = node.getInput(inputId);
      final Extractor originalExtractor = extractorService.load(node, input, extractorId);
      final Map<String, String[]> form = request().body().asFormUrlEncoded();
      final String title = form.get("title")[0];

      CreateExtractorRequest request;
      try {
        request = this.generateCreateExtractorRequest(form, originalExtractor);
      } catch (NullPointerException e) {
        Logger.error("Cannot build extractor configuration.", e);
        return badRequest();
      }

      extractorService.update(extractorId, node, input, request);
      flash("success", "Extractor \"" + title + "\" was updated successfully");
      return redirect(controllers.routes.ExtractorsController.manage(nodeId, inputId));
    } catch (IOException e) {
      return status(500, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, e, request()));
    } catch (APIException e) {
      String message =
          "Could not update extractor! We expected HTTP 200, but got a HTTP "
              + e.getHttpCode()
              + ".";
      return status(500, views.html.errors.error.render(message, e, request()));
    } catch (NodeService.NodeNotFoundException e) {
      return status(
          404, views.html.errors.error.render(ApiClient.ERROR_MSG_NODE_NOT_FOUND, e, request()));
    }
  }
  public Result editExtractor(String nodeId, String inputId, String extractorId) {
    if (!Permissions.isPermitted(RestPermissions.INPUTS_EDIT, inputId)) {
      return redirect(routes.StartpageController.redirect());
    }
    try {
      final Node node = nodeService.loadNode(nodeId);
      final Input input = node.getInput(inputId);
      final Extractor extractor = extractorService.load(node, input, extractorId);
      final String sourceField = extractor.getSourceField();
      String example;
      try {
        final MessageResult exampleMessage = input.getRecentlyReceivedMessage(nodeId);
        example = exampleMessage.getFields().get(sourceField).toString();
      } catch (Exception e) {
        example = null;
      }

      return ok(
          views.html.system.inputs.extractors.edit_extractor.render(
              currentUser(),
              standardBreadcrumbs(node, input, extractor),
              node,
              input,
              extractor,
              example));
    } catch (IOException e) {
      return status(500, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, e, request()));
    } catch (APIException e) {
      String message =
          "Could not fetch system information. We expected HTTP 200, but got a HTTP "
              + e.getHttpCode()
              + ".";
      return status(500, views.html.errors.error.render(message, e, request()));
    } catch (NodeService.NodeNotFoundException e) {
      return status(
          404, views.html.errors.error.render(ApiClient.ERROR_MSG_NODE_NOT_FOUND, e, request()));
    }
  }