<commit_before>package io.github.cloudiator.rest.api;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.ApiParam;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import org.cloudiator.messaging.services.EncryptionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class DecryptionApiController implements DecryptionApi {

  private static final Logger log = LoggerFactory.getLogger(DecryptionApiController.class);

  private final ObjectMapper objectMapper;

  private final HttpServletRequest request;

  @Autowired
  private EncryptionService encryptionService;

  @org.springframework.beans.factory.annotation.Autowired
  public DecryptionApiController(ObjectMapper objectMapper, HttpServletRequest request) {
    this.objectMapper = objectMapper;
    this.request = request;
  }

  public ResponseEntity<String> decrypt(
      @ApiParam(value = "Text to decrypt", required = true) @PathVariable("text") String text) {

    String accept = request.getHeader("Accept");
    if (accept != null && accept.contains("application/json")) {
      try {
        return new ResponseEntity<String>(objectMapper.readValue("\"\"", String.class),
            HttpStatus.NOT_IMPLEMENTED);
      } catch (IOException e) {
        log.error("Couldn't serialize response for content type application/json", e);
        return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
      }
    }

    return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
  }

}<commit_msg>Implemented decryption controller<commit_after>package io.github.cloudiator.rest.api;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.cloudiator.rest.UserInfo;
import io.swagger.annotations.ApiParam;
import javax.servlet.http.HttpServletRequest;
import org.cloudiator.messages.entities.Encryption.DecryptionRequest;
import org.cloudiator.messages.entities.Encryption.DecryptionResponse;
import org.cloudiator.messaging.ResponseException;
import org.cloudiator.messaging.services.EncryptionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class DecryptionApiController implements DecryptionApi {

  private static final Logger log = LoggerFactory.getLogger(DecryptionApiController.class);

  private final ObjectMapper objectMapper;

  private final HttpServletRequest request;

  @Autowired
  private EncryptionService encryptionService;

  @org.springframework.beans.factory.annotation.Autowired
  public DecryptionApiController(ObjectMapper objectMapper, HttpServletRequest request) {
    this.objectMapper = objectMapper;
    this.request = request;
  }

  public ResponseEntity<String> decrypt(
      @ApiParam(value = "Text to decrypt", required = true) @PathVariable("text") String text) {

    final String tenant = UserInfo.of(request).tenant();

    try {
      DecryptionResponse decryptionResponse = encryptionService
          .decrypt(DecryptionRequest.newBuilder().setUserId(tenant).setCiphertext(text).build());

      return new ResponseEntity<>(decryptionResponse.getPlaintext(), HttpStatus.OK);
    } catch (ResponseException e) {
      throw new ApiException(e.code(), e.getMessage());
    }
  }

}
{'fraction_non_alphanumeric': 0.09295550847457627, 'fraction_numerical': 0.001059322033898305, 'mean_word_length': 5.456410256410257, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6649230', 'n_tokens_mistral': 1012, 'n_tokens_neox': 995, 'n_words': 202}