class RequestIdFilter implements ContainerRequestFilter {

    @Override
    public void filter(ContainerRequestContext context) throws IOException {
        String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
        UriInfo uriInfo = context.getUriInfo();
        String requestURI = uriInfo.getPath();

        if (!requestURI.contains("orchestrationRequests")) {
            logger.info("Checking if requestId: {} already exists in requestDb InfraActiveRequests table", requestId);
            InfraActiveRequests infraActiveRequests =
                    infraActiveRequestsClient.getInfraActiveRequestbyRequestId(requestId);

            if (infraActiveRequests != null) {
                logger.error(
                        "RequestId: {} already exists in RequestDB InfraActiveRequests table, throwing DuplicateRequestIdException",
                        requestId);
                throw new DuplicateRequestIdException(createRequestError(requestId, "InfraActiveRequests"));
            }
        }
    }

}