/**
   * Find all shared list by a given list of series instance uids
   *
   * @param seriesUids
   */
  @Transactional(propagation = Propagation.REQUIRED)
  public List<QcCustomSeriesListDTO> findSharedListBySeriesInstanceUids(List<String> seriesUids)
      throws DataAccessException {
    List<QcCustomSeriesListDTO> returnList = new ArrayList<QcCustomSeriesListDTO>();
    List<Object[]> results = new ArrayList<Object[]>();

    List<List<String>> breakdownList = Util.breakListIntoChunks(seriesUids, 900);

    for (List<String> unitList : breakdownList) {
      List<Object[]> temp = getSharedListResult(unitList);
      for (Object[] obj : temp) {
        results.add(obj);
      }
    }

    for (Object[] row : results) {
      String uName = (String) row[0];
      String name = (String) row[1];
      String series = (String) row[2];
      String email = findEmailByUserName(uName);
      returnList.add(new QcCustomSeriesListDTO(uName, name, series, email));
    }

    return returnList;
  }
  public List<GeneralImage> getImageObject(List<Integer> seriesIds) {
    List<GeneralImage> imageObjects = new ArrayList<GeneralImage>();

    List<List<Integer>> breakdownList = Util.breakListIntoChunks(seriesIds, 900);
    for (List<Integer> unit : breakdownList) {
      Criteria criteria = session.createCriteria(GeneralImage.class);
      criteria.add(Restrictions.in("seriesPKId", unit));

      List<GeneralImage> tempHolder = criteria.list();
      for (GeneralImage image : tempHolder) {
        imageObjects.add(image);
      }
    }

    return imageObjects;
  }
  public Collection<ImgObsCharacteristicQuantificationDTO> findAllQuantifications()
      throws DataAccessException {

    Collection<ImgObsCharacteristicQuantificationDTO> dtos =
        new ArrayList<ImgObsCharacteristicQuantificationDTO>();

    Collection<String> names = findAllQuantificationNames();

    for (String name : names) {
      Collection<String> possibleValues = findAllValuesByName(name);

      ImgObsCharacteristicQuantificationDTO dto =
          new ImgObsCharacteristicQuantificationDTO(
              name,
              "Scale", // shortarm this for prototype
              new TreeSet<String>(Util.removeNullElement(possibleValues)));
      dtos.add(dto);
    }

    return dtos;
  }
  /**
   * find series that belongs to public group
   *
   * @param seriesUids
   * @param authorizedPublicSites
   */
  @Transactional(propagation = Propagation.REQUIRED)
  public List<CustomSeriesDTO> findSeriesForPublicCollection(
      List<String> seriesUids, List<SiteData> authorizedPublicSites) throws DataAccessException {
    List<GeneralSeries> seriesList = new ArrayList<GeneralSeries>();
    List<CustomSeriesDTO> seriesDTOList = null;

    if (seriesUids == null || seriesUids.size() <= 0) {
      return new ArrayList<CustomSeriesDTO>();
    }

    List<List<String>> breakdownList = Util.breakListIntoChunks(seriesUids, 900);
    for (List<String> unitList : breakdownList) {
      List<GeneralSeries> temp = getSeriesList(unitList, authorizedPublicSites);
      for (GeneralSeries series : temp) {
        seriesList.add(series);
      }
    }

    seriesDTOList = convertHibernateObjectToCustomSeriesDTO(seriesList);

    return seriesDTOList;
  }