@Transactional public Set<Document> retrieveAllDocumentsInFolder(String folderName, User user) throws InsufficientPrivilagesException { Folder f = folderDao.getFolderByPath(folderName, user); if (!f.canRead(user)) throw new InsufficientPrivilagesException(); Set<Document> docs = f.getDocs(); return docs; }
@Transactional public Document getDocumentByPath(String path, User user) throws InsufficientPrivilagesException { int lastSlash = path.lastIndexOf('/'); String folderPath = path.substring(0, lastSlash); Folder f = folderDao.getFolderByPath(folderPath, user); if (!f.canRead(user)) throw new InsufficientPrivilagesException(); Document doc = f.getDocumentByName(path.substring(lastSlash + 1)); return doc; }