class MetadataRuleService {

    public RequestResponse<JsonNode> selectUnitsWithInheritedRules(JsonNode selectQuery)
        throws InvalidParseOperationException, MetaDataExecutionException, BadRequestException, VitamDBException,
        MetaDataNotFoundException, MetaDataDocumentSizeException {
        LOGGER.debug("selectUnitsWithInheritedRules / selectQuery: " + selectQuery);

        RequestParserMultiple parser = RequestParserHelper.getParser(selectQuery);
        if (!(parser instanceof SelectParserMultiple)) {
            throw new InvalidParseOperationException("Expected a select query");
        }

        // Set target collection in hint
        final SelectMultiQuery request = (SelectMultiQuery) parser.getRequest();

        ObjectNode fieldsProjection =
            (ObjectNode) request.getProjection().get(BuilderToken.PROJECTION.FIELDS.exactToken());
        if (fieldsProjection != null && fieldsProjection.size() > 0) {
            // Check obsolete #rules
            if (fieldsProjection.has(BuilderToken.GLOBAL.RULES.exactToken())) {
                throw new InvalidParseOperationException(
                    "Invalid " + BuilderToken.GLOBAL.RULES.exactToken() + " projection");
            }

            // Ensure unit id is included (required for inherited rule computation)
            fieldsProjection.put(VitamFieldsHelper.id(), 1);
        }

        RequestResponseOK<JsonNode> unitsRequestResponseOK =
            (RequestResponseOK<JsonNode>) metaData.selectUnitsByQuery(request.getFinalSelect());

        // Compute inherited rules
        computeInheritedRulesForUnits(unitsRequestResponseOK.getResults());

        return unitsRequestResponseOK;
    }

    public  MetadataRuleService(MetaDataImpl metaData);
    @VisibleForTesting  MetadataRuleService(ComputeInheritedRuleService computeInheritedRuleService, MetaDataImpl metaData);

}