/** * Get all albums. * * @return The xml with all album. */ @RequestMapping(value = "/albumPhoto/medias/notread", method = RequestMethod.GET) public ModelAndView listNotRead(HttpServletRequest request) { AlbumWs albumWs = new AlbumWs(); List<Media> mediasNotRead = this.albumPhotoService.getMediaNotRead(); List<MediaDto> mediasDto = new ArrayList<MediaDto>(); for (Media media : mediasNotRead) { mediasDto.add(new MediaDto(media)); } albumWs.setId(0); albumWs.setMedias(mediasDto); albumWs.setName("Non vu"); return this.ChooseView(request, "media", albumWs); }
/** * Return all media with a personn or a horse. * * @param identifier the identifier of the horse or personn you want all media. * @return a xml of media contents personn. */ @RequestMapping(value = "/albumPhoto/photos/{identifier}", method = RequestMethod.GET) public ModelAndView GetMediaWith(HttpServletRequest request, @PathVariable String identifier) { AlbumWs albumWs = new AlbumWs(); User user = this.userService.getUserByLogin(identifier); List<Media> medias = new ArrayList<Media>(); if (user == null) { long id = Long.parseLong(identifier); List<Media> mediasWithHorse = this.albumPhotoService.getMediaWithHorse(id); medias.addAll(mediasWithHorse); } else { List<Media> mediasWithUser = this.albumPhotoService.getMediaWithUser(user); medias.addAll(mediasWithUser); } albumWs.setId(0); albumWs.setName("Marqué " + identifier); albumWs.setMedias(this.convert(medias)); return this.ChooseView(request, "media", albumWs); }