Package it.unipd.netmus.server.persistent

Examples of it.unipd.netmus.server.persistent.UserAccount


     * nome dato in input. Ritorna true se l’operazione ha successo.
     */
    @Override
    public boolean addPlaylist(String user, String playlist_name) {

        UserAccount useraccount = UserAccount.load(user);

        return useraccount.getMusicLibrary().addPlaylist(playlist_name);

    }
View Full Code Here


     * cata.Ritorna true se l’operazione ha successo.
     */
    @Override
    public boolean addSongToPlaylist(String user, String playlist_name,
            String title, String artist, String album) {
        UserAccount useraccount = UserAccount.load(user);
        return useraccount.getMusicLibrary().addSongToPlaylist(playlist_name,
                title, artist, album);
    }
View Full Code Here

        int albums = 0;
        int songs = 0;
        List<String> curr_artist = new ArrayList<String>();
        List<String> curr_album = new ArrayList<String>();

        UserAccount useraccount = UserAccount.load(user);
        String content;
        String content_tmp = "<table width=\"100%\">\n"
                + "  <tr style=\"background-color: #993366;\">\n"
                + "    <td><b>Title</b></td>\n"
                + "    <td><b>Artist</b></td>\n"
                + "    <td><b>Album</b></td>\n" + "  </tr>\n";

        List<Song> tmp_list = useraccount.getMusicLibrary().getAllSongs();
        Collections.sort(tmp_list, new Comparator<Song>() {
            @Override
            public int compare(Song arg0, Song arg1) {
                String artist_1 = arg0.getArtist();
                String artist_2 = arg1.getArtist();
View Full Code Here

     */
    @Override
    public boolean moveSongInPlaylist(String user, String playlist_name,
            int from, int to) {

        UserAccount user_account = UserAccount.load(user);

        return user_account.getMusicLibrary().moveSongInPlaylist(playlist_name,
                from, to);
    }
View Full Code Here

     * true se l’operazione ha successo.
     */
    @Override
    public boolean removePlaylist(String user, String playlist_name) {

        UserAccount useraccount = UserAccount.load(user);

        return useraccount.getMusicLibrary().removePlaylist(playlist_name);
    }
View Full Code Here

     */
    @Override
    public boolean removeSongFromPlaylist(String user, String playlist_name,
            String title, String artist, String album) {

        UserAccount useraccount = UserAccount.load(user);
        return useraccount.getMusicLibrary().removeSongFromPlaylist(
                playlist_name, title, artist, album);
    }
View Full Code Here

    @Override
    public void sendUserNewMusic(String user, List<SongDTO> new_songs) {

        // Invia al database tutte le canzoni della lista

        UserAccount useraccount = UserAccount.load(user);

        for (SongDTO songDTO : new_songs) {
            Song song = Song.storeOrUpdateFromDTO(songDTO);
            if (song != null) {
                useraccount.getMusicLibrary().addSong(song);
            }
        }

        useraccount.getMusicLibrary().update();
    }
View Full Code Here

     * calcolate nel client.
     */
    @Override
    public void storeStatistics(String user, String preferred_artist,
            String most_popular_song, String most_popular_song_for_this_user) {
        UserAccount user_account = UserAccount.load(user);

        if (!preferred_artist.equals("")) {
            user_account.getMusicLibrary().setPreferredArtist(preferred_artist);
        }

        if (!most_popular_song.equals("")) {
            user_account.getMusicLibrary()
                    .setMostPopularSong(most_popular_song);
        }

        if (!most_popular_song_for_this_user.equals("")) {
            user_account.getMusicLibrary().setMostPopularSongForThisUser(
                    most_popular_song_for_this_user);
        }

    }
View Full Code Here

        if (googleUser != null) {

            try {
                // REGISTRO IL GOOGLE USER (COME GOOGLE USER) E LO LOGGO
                // controllo se esiste gia` in DB
                UserAccount userAccount = UserAccount
                        .load(googleUser.getName());
                if (userAccount == null) {
                    // creo l'utente google nel db
                    userAccount = new UserAccount(googleUser.getName(), "");
                    userAccount.setGoogleUser(true);

                } else {
                    if (!userAccount.isGoogleUser()) {
                        // non e' lui non e' possibile registrarlo con Google
                        // con quel nome
                        throw new NetmusException(
                                "UTENTE NETMUS con STESSO USERNAME/MAIL");
                    }
                }
                // loggo , sessione (non uso i cookies per un utente non Netmus)

                HttpSession session = request.getSession();
                String session_id = session.getId();
                // set session parameter - userID
                LoginHelper.setSession(session, googleUser.getName());
                // set in DB userAccount the new SessionID
                userAccount.setLastSessionId(session_id);
            } catch (NetmusException ne) {
                System.out.println(ne.getMoreInfo());
            }
        }
        // TORNO AL ENTRY POINT E SE E' STATO LOGGATO PASSA IN AUTOMATICO AL
View Full Code Here

TOP

Related Classes of it.unipd.netmus.server.persistent.UserAccount

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.