예제 #1
0
  @RequestMapping(method = RequestMethod.GET, value = "/artist/{artistName}/albums")
  public String viewArtistAlbums(
      @PathVariable("artistName") String artistName, Model map, HttpSession session) {
    artistName = UtilImpl.rewriteParams(artistName);
    Integer artistID;
    Integer pageSize = 4;
    Integer albumNumberOfArtist;
    Integer albumPageNumberOfArtist;

    Artist artist = serviceFactory.getArtistService().getArtistByName(artistName);
    artistID = artist.getArtistid();
    albumNumberOfArtist = serviceFactory.getAlbumService().getAlbumNumberOfArtist(artistID);
    List<Album> albums =
        serviceFactory.getAlbumService().getAlbumsByArtist(artist, 0, pageSize.intValue());

    if ((albumNumberOfArtist % pageSize) == 0) {
      albumPageNumberOfArtist = (albumNumberOfArtist / pageSize);
    } else {
      albumPageNumberOfArtist = (albumNumberOfArtist / pageSize) + 1;
    }

    map.addAttribute("albums", albums);
    map.addAttribute("artistId", artistID);
    map.addAttribute("albumPageNumberOfArtist", albumPageNumberOfArtist);
    return "artist/artist_albums";
  }
예제 #2
0
  @RequestMapping(
      method = RequestMethod.GET,
      value = "/artistList/albums/{currentPage}/artistNO/{artistID}")
  public String viewArtistAlbumList(
      @PathVariable Integer currentPage,
      @PathVariable Integer artistID,
      Model map,
      HttpSession session) {
    Artist artist = new Artist(artistID);
    Integer firstIndex;
    Integer pageSize = 4;
    firstIndex = ((currentPage * pageSize) - pageSize);

    List<Album> albums =
        serviceFactory
            .getAlbumService()
            .getAlbumsByArtist(artist, firstIndex.intValue(), pageSize.intValue());
    map.addAttribute("albums", albums);
    return "artist/list/artistAlbumList";
  }
예제 #3
0
  @RequestMapping(method = RequestMethod.GET, value = "/artist/{artistName}/general")
  public String viewArtistGeneral(
      @PathVariable("artistName") String artistName, Model map, HttpSession session) {
    artistName = UtilImpl.rewriteParams(artistName);
    Artist artist = serviceFactory.getArtistService().getArtistByName(artistName);
    List<UserActivity> activities =
        serviceFactory.getUserService().getArtistActivity(artist, 0, 10);
    List<Album> albums = serviceFactory.getAlbumService().getAlbumsByArtist(artist, 0, 4);
    List<ArtistFans> artistFans = serviceFactory.getArtistService().getArtistFans(artist, 0, 5);
    // List songs = serviceFactory.getListenHistoryService().getMostListenedSongsByArtist(artist, 0,
    // 10);
    List<SongStats> songs = serviceFactory.getSongService().getTopSongsByArtist(artist, 0, 10);
    List<ArtistSimiliar> similiars =
        serviceFactory.getArtistService().getSimiliarArtists(artist, 0, 5);

    serviceFactory.getArtistService().saveArtistBioAndPicture(artist);
    for (ArtistSimiliar similiar : similiars) {
      serviceFactory.getArtistService().saveArtistBioAndPicture(similiar.getSimiliarArtistid());
    }

    // List<ArtistSimiliar> similiars = new ArrayList<ArtistSimiliar>();
    ArtistStats stats = artist.getArtistStats();
    map.addAttribute("artist", artist);
    map.addAttribute("activities", activities);
    map.addAttribute("albums", albums);
    String biography = artist.getBiography();
    if (biography != null && artist.getBiography().length() > 800) {
      biography = biography.substring(0, 800);
    }
    String moreInfo = artist.getMoreInfo();
    if (moreInfo != null && moreInfo.length() > 400) {
      moreInfo = moreInfo.substring(0, 400);
    }
    map.addAttribute("moreInfo", moreInfo);
    map.addAttribute("biography", biography);
    map.addAttribute("artistFans", artistFans);
    map.addAttribute("songs", songs);
    map.addAttribute("similiars", similiars);
    return "artist/artist_general";
  }