code: public static List<Dashboard> findSharedDashboardsMeta(EntityManager em, PrincipalUser owner, Integer limit, String version) {
      	requireArgument(em != null, "Entity manager can not be null.");
      	
      	try {
          	CriteriaBuilder cb = em.getCriteriaBuilder();
          	CriteriaQuery<Tuple> cq = cb.createTupleQuery();
          	Root<Dashboard> e = cq.from(Dashboard.class);
          	
          	List<Selection<?>> fieldsToSelect = new ArrayList<>();
          	for(Field field : FieldUtils.getFieldsListWithAnnotation(Dashboard.class, Metadata.class)) {
          		fieldsToSelect.add(e.get(field.getName()).alias(field.getName()));
          	}
          	cq.multiselect(fieldsToSelect);
  			if(owner != null){
  				cq.where(cb.equal(e.get("shared"), true), cb.equal(e.get("owner"), owner), version==null?cb.isNull(e.get("version")):cb.equal(e.get("version"), version));
  			} else{
  	        	cq.where(cb.equal(e.get("shared"), true),version==null?cb.isNull(e.get("version")):cb.equal(e.get("version"), version));
  			}
  
          	return _readDashboards(em, cq, limit);
  
          } catch (NoResultException ex) {
              return new ArrayList<>(0);
          }
      }
docs: Gets all meta information of shared dashboards with filtering.
  
  @param   em       The entity manager to use.
  @param   owner    The owner of shared dashboards to filter on
  @param   limit    The maximum number of rows to return.
  @param   version  The version of the dashboard to retrieve. It is either null or not empty
  
  @return  The list of all shared dashboards with meta information only. Will never be null but may be empty.