/** * Obtain the path to the temporal folder for uploaded resources * * @param settings {@link MDOMessicSettings} settings for messic * @param albumCode {@link String} code for the album to upload * @return {@link String} temporal path for uploaded */ public String calculateTmpPath( MDOMessicSettings settings, String albumCode ) { String basePath = calculateAbsolutePath( settings ); basePath = basePath + File.separatorChar + Util.TEMPORAL_FOLDER + File.separatorChar + albumCode; return basePath; }
/** * Check if the folders are just the needed folders.. * * @param albumSid * @return */ @Transactional public List<FolderResourceConsistency> checkConsistency( MDOUser user ) { List<FolderResourceConsistency> result = new ArrayList<FolderResourceConsistency>(); String userPath = user.calculateAbsolutePath( daoSettings.getSettings() ); File fuserPath = new File( userPath ); File[] authorFolders = fuserPath.listFiles(); for ( File faufolder : authorFolders ) { List<FolderResourceConsistency> pr = checkConsistencyFolder( user, faufolder ); result.addAll( pr ); } return result; }
/** * Return the list of folders at the author level file system (at the messic music folder of the user scope) * * @param user {@link User} scope * @return {@link List}<{@link String}/> List of folders at the messic music folder */ public List<String> getAuthorFolders( MDOUser user ) { String userPath = user.calculateAbsolutePath( daoSettings.getSettings() ); File fuserPath = new File( userPath ); if ( fuserPath.exists() ) { String[] list = fuserPath.list(); List<String> rlist = new ArrayList<String>(); for ( String string : list ) { rlist.add( string ); } return rlist; } else { return new ArrayList<String>(); } } }
public String calculateAbsolutePath( MDOMessicSettings settings ) { String basePath = getOwner().calculateAbsolutePath( settings ); String result = basePath + File.separatorChar + getLocation(); return result; }
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!" ); } }