@Transactional public MDOUser getUser( Long userSid ) { return this.daoUsers.getUserById( userSid ); }
public User getUserById( Long userId ) { MDOUser mdoUser = daoUser.getUserById( userId ); return new User( mdoUser ); }
@Transactional public List<MDOAuthor> getUserAuthors( Long userSid ) { MDOUser user = this.daoUsers.getUserById( userSid ); List<MDOAuthor> authors = new ArrayList<MDOAuthor>(); if ( user != null ) { authors = this.daoauthor.getAll( user.getLogin() ); } return authors; }
public void removeUser( Long sid, boolean removeMusicContent ) throws Exception { MDOUser mdoUserToRemove = daoUser.getUserById( sid ); if ( mdoUserToRemove != null ) { if ( removeMusicContent ) { String absolutePath = mdoUserToRemove.calculateAbsolutePath( daoSettings.getSettings() ); File fabsolutePath = new File( absolutePath ); if ( fabsolutePath.exists() ) { FileUtils.deleteDirectory( new File( absolutePath ) ); } } // first we remove genres of the user // daoGenre.removeAllGenres( mdoUserToRemove.getLogin() ); // daoGenre.flush(); // finally we remove the user daoUser.remove( mdoUserToRemove ); } else { throw new Exception( "User doesn't exist!" ); } }
public void resetPassword( Long sid ) { MDOUser mdoUserToReset = daoUser.getUserById( sid ); mdoUserToReset.setPassword( "123456" ); daoUser.saveUser( mdoUserToReset, true, mdoUserToReset.getPassword() ); }
String username = this.daoUsers.getUserById( sid ).getLogin(); authors = this.daoauthor.getAll( username );