class DslScannerFilter implements ContainerRequestFilter {

    @Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        try {
            final InputStream bodyInputStream = requestContext.getEntityStream();
            final ByteArrayOutputStream bout = new ByteArrayOutputStream();
            StreamUtils.copy(bodyInputStream, bout);
            switch (this.dslSchema) {
                case SELECT_MULTIPLE:
                    selectMultipleSchemaValidator.validate(JsonHandler.getFromBytes(bout.toByteArray()));
                    break;
                case SELECT_SINGLE:
                    selectSingleSchemaValidator.validate(JsonHandler.getFromBytes(bout.toByteArray()));
                    break;
                case BATCH_PROCESSING:
                    batchProcessingQuerySchemaValidator.validate(JsonHandler.getFromBytes(bout.toByteArray()));
                    break;
                case GET_BY_ID:
                    getByIdSchemaValidator.validate(JsonHandler.getFromBytes(bout.toByteArray()));
                    break;
                case UPDATE_BY_ID:
                    updateByIdSchemaValidator.validate(JsonHandler.getFromBytes(bout.toByteArray()));
                    break;
                case RECLASSIFICATION_QUERY:
                    updateQueryReclassificationSchemaValidator.validate(JsonHandler.getFromBytes(bout.toByteArray()));
                    break;
                case MASS_UPDATE:
                    massUpdateSchemaValidator.validate(JsonHandler.getFromBytes(bout.toByteArray()));
                    break;
                default:
                    requestContext.abortWith(
                        VitamCodeHelper.toVitamError(VitamCode.GLOBAL_INTERNAL_SERVER_ERROR,
                            "Dsl schema is not valid.")
                            .toResponse());

            }
            requestContext.setEntityStream(new ByteArrayInputStream(bout.toByteArray()));
        } catch (ValidationException e) {
            LOGGER.warn(e);
            requestContext.abortWith(
                e.getVitamError().toResponse());
        } catch (InvalidParseOperationException e) {
            LOGGER.warn(e);
            requestContext.abortWith(
                VitamCodeHelper.toVitamError(VitamCode.GLOBAL_INTERNAL_SERVER_ERROR,
                    "Can not read Dsl query").toResponse());

        }
    }

    public  DslScannerFilter(DslSchema dslSchema);

}