code: static String generateQueryString(final Map<String, List<String>> keyMultivaluePairs) {
  
          if (keyMultivaluePairs == null || keyMultivaluePairs.size() == 0 ) {
              throw new IllegalArgumentException("no selection criteria defined");
          }
  
          List<Entry<String,List<String>>> entryList = new ArrayList<>(keyMultivaluePairs.entrySet());
  
          Collections.sort(entryList, new Comparator<Map.Entry<String,List<String>>>() {
  
              @Override
              public int compare(Entry<String, List<String>> o1, Entry<String, List<String>> o2) {
                  return o1.getKey().compareToIgnoreCase(o2.getKey());
              }
          });
  
          StringWriter query = new StringWriter();
          query.append("SELECT * FROM cmis:document WHERE ");
          String conjonction = " ";
          for (Map.Entry<String, List<String>> e : entryList) {
              // ignore null null values
              if (e.getValue() == null) { 
                  continue;
              }
              query.append(conjonction);
              query.append('(');
              List<String> list = e.getValue();
              Collections.sort(list);
              conjonction = " ";
              for (String value : list) {
                  query.append(conjonction);
                  query.append(e.getKey());
                  query.append(" ='");
                  query.append(value);
                  query.append("' ");
                  conjonction = " OR ";
              }
              query.append(')');
              conjonction = " AND ";
          }
          query.flush();
  
          String qu = query.toString().replaceAll("  ", " ");
          return qu;
      }
docs: /* private