private CustomSeriesListDTO convertHibernateObjectToCustomSeriesListDTO( List<CustomSeriesList> daos) { List<CustomSeriesListDTO> returnList = new ArrayList<CustomSeriesListDTO>(); // if (daos != null) { // this should contain only 1 record for customSeriesList for (int i = 0; i < daos.size(); i++) { CustomSeriesListDTO dto = new CustomSeriesListDTO(); CustomSeriesList series = (CustomSeriesList) daos.get(0); Set<CustomSeriesListAttribute> children = series.getCustomSeriesListAttributes(); List<String> seriesUidsList = new ArrayList<String>(); for (Iterator<CustomSeriesListAttribute> iter = children.iterator(); iter.hasNext(); ) { CustomSeriesListAttribute attr = iter.next(); String seriesInstanceUid = attr.getSeriesInstanceUid(); seriesUidsList.add(seriesInstanceUid); } dto.setName(series.getName()); dto.setComment(series.getComment()); dto.setHyperlink(series.getHyperlink()); dto.setDate(series.getCustomSeriesListTimestamp()); dto.setId(series.getId()); dto.setSeriesInstanceUIDs(seriesUidsList); dto.setUserName(series.getUserName()); returnList.add(dto); } /*} else { throw new Exception("No record found the query."); }*/ return returnList.get(0); }
private List<CustomSeriesListDTO> convertHibernateObjectToCustomSeriesListDTOList( List<CustomSeriesList> daos) { List<CustomSeriesListDTO> returnList = new ArrayList<CustomSeriesListDTO>(); if (daos != null) { for (CustomSeriesList dataRow : daos) { Date d = dataRow.getCustomSeriesListTimestamp(); CustomSeriesListDTO dto = new CustomSeriesListDTO(); dto.setName(dataRow.getName()); dto.setComment(dataRow.getComment()); dto.setHyperlink((String) dataRow.getHyperlink()); dto.setDate(d); dto.setId(dataRow.getId()); dto.setUserName(dataRow.getUserName()); Set<CustomSeriesListAttribute> children = dataRow.getCustomSeriesListAttributes(); List<String> seriesUidsList = new ArrayList<String>(); for (Iterator<CustomSeriesListAttribute> iter = children.iterator(); iter.hasNext(); ) { CustomSeriesListAttribute attr = iter.next(); String seriesInstanceUid = attr.getSeriesInstanceUid(); seriesUidsList.add(seriesInstanceUid); } dto.setSeriesInstanceUIDs(seriesUidsList); returnList.add(dto); } } return returnList; }
private List<CustomSeriesListAttributeDTO> convertHibernateObjectToCustomSeriesListAttributeDTO( List<CustomSeriesListAttribute> daos) { List<CustomSeriesListAttributeDTO> returnList = new ArrayList<CustomSeriesListAttributeDTO>(); if (daos != null) { // this should contain only 1 record for customSeriesList for (int i = 0; i < daos.size(); i++) { CustomSeriesListAttribute rowData = daos.get(i); CustomSeriesListAttributeDTO dto = new CustomSeriesListAttributeDTO(rowData.getId(), rowData.getSeriesInstanceUid()); returnList.add(dto); } } /* else { throw new Exception("No record found for the query."); }*/ return returnList; }