code: public List<Long> getDocumentsForMetadata(QueryData queryData)
    {
      List<Long> corpusList = queryData.getCorpusList();
  
      if (!corpusList.isEmpty())
      {     
        List<QueryAnnotation> metaData = queryData.getMetaData();
        if (!metaData.isEmpty())
        {
          String documentsWithMetaDataSql = subQueryCorpusSelectionStrategy.buildSubQuery(corpusList, metaData);
          List<Long> documents = getJdbcTemplate()
            .query(documentsWithMetaDataSql, SingleColumnRowMapper.newInstance(Long.class));
  
          return documents;
        }
  
      }
  
      return null;
    }
docs: Will query the database which documents are matching according to the
  given metadata
  @param queryData QueryData from which the meta data will be extracted
  @return The list of documents matching the meta data or null if no
  constraints need to be applied (all documents are matching)