class UnitGraphInfoLoader {

    public Set<String> selectUnitsByQueryDslAndAccessContract(MetaDataClient metaDataClient,
        SelectMultiQuery select, AccessContractModel accessContractModel)
        throws InvalidParseOperationException, VitamDBException, MetaDataDocumentSizeException,
        MetaDataExecutionException, MetaDataClientServerException, InvalidCreateOperationException {

        // Only return document id
        select.addUsedProjection(VitamFieldsHelper.id());
        JsonNode selectWithAccessContractFilter = AccessContractRestrictionHelper
            .applyAccessContractRestrictionForUnitForSelect(select.getFinalSelect(), accessContractModel);

        JsonNode resultJson = metaDataClient.selectUnits(selectWithAccessContractFilter);

        Set<String> foundUnitIds = new HashSet<>();
        for (JsonNode node : resultJson.get(RESULTS)) {
            String id = node.get(VitamFieldsHelper.id()).asText();
            foundUnitIds.add(id);
        }

        return foundUnitIds;
    }

}