@Transactional(propagation = Propagation.REQUIRED)
  public Map<String, List<String>> removeSeries(String userName) throws DataAccessException {
    List<Integer> seriesList = seriesDao.listAllDeletedSeries();
    if (seriesList == null || seriesList.size() == 0) {
      // no need to do deletion
      logger.info("There is no series need to be deleted!!!");

      return null;
    }
    annotationFile = annotationDao.deleteAnnotation(seriesList);
    dicomFileNames = imageDAO.removeImages(seriesList); // including CT Images
    // seriesDao.setSeriesObject(seriesList);
    Map<Integer, Integer> studyIds = seriesDao.getStudyMap(seriesList);
    Map<Integer, Integer> patientIds = seriesDao.getPatientMap(seriesList);

    List<DeletionAuditSeriesInfo> seriesDeletionAuditInfoList =
        seriesDao.getDeletionAuditSeriesInfo(seriesList);
    deletionAuditTrailDao.recordSeries(seriesDeletionAuditInfoList, userName);
    seriesDao.removeSeries(seriesList);

    Map<Integer, Boolean> patientsOfDeletedStudiesSet = new HashMap<Integer, Boolean>();
    // check study to see if they need to be removed or not
    Iterator<Integer> iterator = studyIds.keySet().iterator();
    while (iterator.hasNext()) {
      Integer studyId = iterator.next();
      if (studyDao.checkStudyNeedToBeRemoved(studyId, studyIds.get(studyId))) {
        DeletionAuditStudyInfo dasi = studyDao.getDeletionAuditStudyInfo(studyId);
        deletionAuditTrailDao.recordStudy(dasi, userName);

        Integer patientId = studyDao.getPatientId(studyId);
        patientsOfDeletedStudiesSet.put(patientId, true);
        studyDao.removeStudy(studyId);
      }
    }

    // if study has not been removed, patient should not be removed.
    // check Patient to see if they need to be removed or not
    iterator = patientIds.keySet().iterator();
    while (iterator.hasNext()) {
      Integer patientId = iterator.next();

      if (patientsOfDeletedStudiesSet.get(patientId) != null
          && patientsOfDeletedStudiesSet.get(patientId) == true
          && patientDao.checkPatientNeedToBeRemoved(patientId, patientIds.get(patientId))) {
        DeletionAuditPatientInfo dapi = patientDao.getDeletionAuditPatientInfo(patientId);
        deletionAuditTrailDao.recordPatient(dapi, userName);
        patientDao.removePatient(patientId);
      }
    }

    Map<String, List<String>> fileMap = new HashMap<String, List<String>>();
    fileMap.put("dicom", dicomFileNames);
    fileMap.put("annotation", annotationFile);

    return fileMap;
  }
  @Transactional(propagation = Propagation.REQUIRED)
  public List<DeletionDisplayObject> getDeletionDisplayObject() {
    List<DeletionDisplayObject> object = new ArrayList<DeletionDisplayObject>();

    List<Integer> seriesList = seriesDao.listAllDeletedSeries();

    object = seriesDao.getDeletionDisplayObjectDTO(seriesList);

    return object;
  }
 @Transactional(propagation = Propagation.REQUIRED)
 public List<Integer> getAllDeletedSeries() {
   return seriesDao.listAllDeletedSeries();
 }