class RequestIdFilter implements ContainerRequestFilter {

    protected String createRequestError(String requestId, String requestTable) {
        ObjectMapper mapper = new ObjectMapper();
        RequestError error = new RequestError();
        ServiceException serviceException = new ServiceException();
        serviceException.setMessageId(ErrorNumbers.SVC_BAD_PARAMETER);
        serviceException
                .setText("RequestId: " + requestId + " already exists in the RequestDB " + requestTable + " table");
        error.setServiceException(serviceException);
        String errorMessage = null;

        try {
            errorMessage = mapper.writeValueAsString(error);
        } catch (JsonProcessingException e) {
            return "Unable to write requestError to String when requestId already exists in the RequestDb due to error: "
                    + e.getMessage();
        }
        return errorMessage;
    }

}