public boolean isFolderSynchronized(IliasFolder folder) { for (IliasTreeNode node : folder.getChildNodes()) { if (node instanceof IliasFile) { IliasFile iliasFile = (IliasFile) node; if (!contains(iliasFile) && !iliasFile.isIgnored()) { return false; } } else if (node instanceof IliasFolder) { if (!isFolderSynchronized((IliasFolder) node)) { return false; } } } return true; }
public File getFile(IliasFile iliasFile) { final String location = localFileLocations.get(iliasFile.getSize()); if (location == null) { return null; } return new File(location); }
private String getContainingFolder(IliasFile iliasFile) { final int size = iliasFile.getSize(); String path = localFileLocations.get(size); if (path == null) { return null; } path = path.substring(0, path.lastIndexOf(File.separator)); return path; }
public String suggestDownloadPath(IliasFile iliasFile) { final List<IliasTreeNode> siblings = iliasFile.getParentFolder().getChildNodes(); for (IliasTreeNode node : siblings) { if (node instanceof IliasFile) { final String result = getContainingFolder((IliasFile) node); if (result != null) { return result; } } } return Settings.getInstance().getIliasFolderSettings().getLocalIliasFolderPath(); }
public void addIliasFile(IliasFile iliasFile, String path) { localFileLocations.put(iliasFile.getSize(), path); }
public boolean contains(IliasFile iliasFile) { return localFileLocations.containsKey(iliasFile.getSize()); }