/** {@inheritDoc} */ @Override public List<IconDTO> loadAllIcons() { List<Icon> icons = genericDAO.loadAll(Icon.class); List<IconDTO> iconDTOList = new ArrayList<IconDTO>(); String iconDir = configuration.getIconsDir(); for (Icon icon : icons) { IconDTO iconDTO = new IconDTO(); BeanUtils.copyProperties(icon, iconDTO); iconDTO.setFileName(StringUtil.appendFileSeparator(iconDir) + icon.getFileName()); iconDTOList.add(iconDTO); } return iconDTOList; }
/** {@inheritDoc} */ @Override public List<IconDTO> findIconsByName(String name) { DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Icon.class); detachedCriteria.add(Restrictions.eq("name", name.toLowerCase())); List<Icon> icons = genericDAO.findByDetachedCriteria(detachedCriteria); List<IconDTO> iconDTOList = new ArrayList<IconDTO>(); String iconDir = configuration.getIconsDir(); for (Icon icon : icons) { IconDTO iconDTO = new IconDTO(); BeanUtils.copyProperties(icon, iconDTO); iconDTO.setFileName(iconDir + icon.getFileName()); iconDTOList.add(iconDTO); } return iconDTOList; }