Commit dba87907 authored by Matija Obreza's avatar Matija Obreza

Fix: Repository services require sort

parent 457fbbe3
......@@ -283,11 +283,11 @@ public class RepositoryController {
private FolderDetails folderDetails(final Path path) throws InvalidRepositoryPathException {
FolderDetails fd = new FolderDetails();
fd.folder = repositoryService.getFolder(path);
fd.subFolders = repositoryService.getFolders(path);
fd.subFolders = repositoryService.getFolders(path, RepositoryFolder.DEFAULT_SORT);
if (fd.folder == null && !path.toAbsolutePath().toString().equals("/")) {
throw new ResourceNotFoundException("No such folder");
}
fd.files = repositoryService.getFiles(path);
fd.files = repositoryService.getFiles(path, RepositoryFile.DEFAULT_SORT);
fd.gallery = imagegalleryService.loadImageGallery(path);
return fd;
}
......
......@@ -558,13 +558,13 @@ public class WiewsController extends BaseController {
}
List<String> subPaths = new ArrayList<>();
for (RepositoryFolder subPath : repositoryService.listPaths(repositoryPath)) {
for (RepositoryFolder subPath : repositoryService.listPathsRecursively(repositoryPath)) {
if (!subPath.getFolderPath().equals(repositoryPath)) {
subPaths.add(institutePath.relativize(subPath.getFolderPath()).toString());
}
}
model.addAttribute("fileList", repositoryService.getFiles(repositoryPath));
model.addAttribute("fileList", repositoryService.getFiles(repositoryPath, RepositoryFile.DEFAULT_SORT));
model.addAttribute("currentPath", repositoryPath);
model.addAttribute("subPaths", subPaths);
model.addAttribute("imageGallery", imageGalleryService.loadImageGallery(repositoryPath));
......@@ -745,7 +745,7 @@ public class WiewsController extends BaseController {
response.setContentType("text/csv;charset=UTF-16LE");
response.setHeader("Content-Disposition", "attachment; filename=" + wiewsCode + "_files_metadata.csv ");
Stream<RepositoryFile> files = repositoryService.streamFiles(wiewsPath);
Stream<RepositoryFile> files = repositoryService.streamFiles(wiewsPath, RepositoryFile.DEFAULT_SORT);
filesMetadataInfo.downloadMetadata(files, response, '\t', '"', '\\', "\n", "UTF-16LE");
}
......
......@@ -115,11 +115,11 @@ public class RepositoryController extends BaseController {
}
RepositoryFolder currentFolder = repositoryService.getFolder(path);
List<RepositoryFile> fileList = repositoryService.getFiles(path);
List<RepositoryFile> fileList = repositoryService.getFiles(path, RepositoryFile.DEFAULT_SORT);
model.addAttribute("fileList", fileList);
model.addAttribute("currentPath", path);
model.addAttribute("currentFolder", currentFolder);
model.addAttribute("subPaths", repositoryService.getFolders(path));
model.addAttribute("subPaths", repositoryService.getFolders(path, RepositoryFolder.DEFAULT_SORT));
model.addAttribute("imageGallery", imageGalleryService.loadImageGallery(path));
......
......@@ -262,7 +262,7 @@ public class ApplicationStartup implements InitializingBean, ApplicationListener
private void ensureInsituteFolders() throws Exception {
asAdminInvoker.invoke(() -> {
List<RepositoryFolder> wiewsFolders = repositoryService.getFolders(Paths.get("/wiews"));
List<RepositoryFolder> wiewsFolders = repositoryService.getFolders(Paths.get("/wiews"), RepositoryFolder.DEFAULT_SORT);
for (RepositoryFolder instFolder: wiewsFolders) {
LOG.warn("Ensuring inheritance for {}", instFolder.getFolderPath());
FaoInstitute institute = instituteRepository.findByCode(instFolder.getName());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment