code: public static List<Dashboard> findSharedDashboards(EntityManager em,  PrincipalUser owner, Integer limit, String version) {
      	requireArgument(em != null, "Entity manager can not be null.");
  
  		TypedQuery<Dashboard> query;
  		if(owner == null){
  		    if (version==null) {
  			    query = em.createNamedQuery("Dashboard.getSharedDashboards", Dashboard.class);
              }
              else {
                  query = em.createNamedQuery("Dashboard.getSharedDashboardsByVersion", Dashboard.class);
                  query.setParameter("version",version);
              }
  		} else {
  		    if(version==null) {
                  query = em.createNamedQuery("Dashboard.getSharedDashboardsByOwner", Dashboard.class);
                  query.setParameter("owner", owner);
              }
              else {
                  query = em.createNamedQuery("Dashboard.getSharedDashboardsByOwnerAndByVersion", Dashboard.class);
                  query.setParameter("owner", owner);
                  query.setParameter("version",version);
              }
  
  		}
  		
  		query.setHint("javax.persistence.cache.storeMode", "REFRESH");
  
  		if(limit!= null){
  			query.setMaxResults(limit);
  		}
  		
          try {
              return query.getResultList();
          } catch (NoResultException ex) {
              return new ArrayList<>(0);
          }
      }
docs: Finds the list of dashboards that are marked as globally shared.
  
  @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  Dashboards that are shared/global within the system. Or empty list if no such dashboards exist.