Class DirectoryController


  • @Controller
    @RequestMapping("/material1/dir")
    public class DirectoryController
    extends java.lang.Object
    Controller Class for all requests on 'material1/dir'.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String createSubFolder​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token, long parentDirId, java.lang.String folderName)
      Creates a new sub folder.
      java.lang.String deleteFolder​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token, long dirId)
      Deletes a folder.
      java.lang.String editFolder​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token, long dirId, EditDirectoryForm editForm)
      Edit the folder.
      java.lang.String renameFolder​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token, long dirId, java.util.Optional<java.lang.Long> originDirId, java.lang.String newName)
      Renames a directory.
      java.lang.String searchFolder​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token, org.springframework.ui.Model model, long dirId, FileQueryForm queryForm)
      Searches a folder for files.
      java.lang.String showFolderContent​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token, org.springframework.ui.Model model, long dirId)
      Shows the content of a folder (files and sub folders).
      java.lang.String uploadFile​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token, long dirId, org.springframework.web.multipart.MultipartFile multipartFile)
      Uploads a file.
      org.springframework.http.ResponseEntity<byte[]> zipDirectory​(org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token, long dirId)
      Download a directory as zip.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • showFolderContent

        @GetMapping("/{dirId}")
        public java.lang.String showFolderContent​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes,
                                                  org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token,
                                                  org.springframework.ui.Model model,
                                                  @PathVariable("dirId")
                                                  long dirId)
        Shows the content of a folder (files and sub folders).
        Parameters:
        redirectAttributes - redirect attributes
        token - keycloak auth token
        model - spring view model
        dirId - id of the folder
        Returns:
        route to folder
      • uploadFile

        @PostMapping("/{dirId}/upload")
        public java.lang.String uploadFile​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes,
                                           org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token,
                                           @PathVariable("dirId")
                                           long dirId,
                                           @RequestParam("file")
                                           org.springframework.web.multipart.MultipartFile multipartFile)
        Uploads a file.
        Parameters:
        redirectAttributes - redirect attributes
        token - keycloak auth token
        dirId - id of the directory where it will be uploaded
        multipartFile - file object
        Returns:
        route after completion
      • zipDirectory

        @GetMapping("/{dirId}/zip")
        public org.springframework.http.ResponseEntity<byte[]> zipDirectory​(org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token,
                                                                            @PathVariable("dirId")
                                                                            long dirId)
        Download a directory as zip.
        Parameters:
        token - keycloak auth token
        dirId - id of the directory
        Returns:
        a zip as byte array
      • createSubFolder

        @PostMapping("/{parentDirId}/create")
        public java.lang.String createSubFolder​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes,
                                                org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token,
                                                @PathVariable("parentDirId")
                                                long parentDirId,
                                                @RequestParam("folderName")
                                                java.lang.String folderName)
        Creates a new sub folder.
        Parameters:
        redirectAttributes - redirect attributes
        token - keycloak auth token
        parentDirId - id of the parent folder
        folderName - name of the new sub folder
        Returns:
        object of the folder
      • editFolder

        @PostMapping("/{dirId}/edit")
        public java.lang.String editFolder​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes,
                                           org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token,
                                           @PathVariable("dirId")
                                           long dirId,
                                           @ModelAttribute("editDirectoryForm")
                                           EditDirectoryForm editForm)
        Edit the folder.
        Parameters:
        redirectAttributes - redirect attributes
        token - keycloak auth token
        dirId - id of the current folder
        editForm - new directory properties from the template
        Returns:
        object of the folder
      • deleteFolder

        @PostMapping("/{dirId}/delete")
        public java.lang.String deleteFolder​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes,
                                             org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token,
                                             @PathVariable("dirId")
                                             long dirId)
        Deletes a folder.
        Parameters:
        redirectAttributes - redirect attributes
        token - user credentials
        dirId - id of the folder to be deleted
        Returns:
        the id of the parent folder
      • searchFolder

        @PostMapping("/{dirId}/search")
        public java.lang.String searchFolder​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes,
                                             org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token,
                                             org.springframework.ui.Model model,
                                             @PathVariable("dirId")
                                             long dirId,
                                             @ModelAttribute("fileQueryForm")
                                             FileQueryForm queryForm)
        Searches a folder for files.
        Parameters:
        redirectAttributes - redirect attributes
        token - user credentials
        model - spring view model
        dirId - id of the folder to be searched
        queryForm - wrapper object of the query form parameter
        Returns:
        route to files view
      • renameFolder

        @PostMapping("/{dirId}/rename")
        public java.lang.String renameFolder​(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes,
                                             org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken token,
                                             @PathVariable("dirId")
                                             long dirId,
                                             @RequestParam(value="originDirId",required=false)
                                             java.util.Optional<java.lang.Long> originDirId,
                                             @RequestParam("newName")
                                             java.lang.String newName)
        Renames a directory.
        Parameters:
        redirectAttributes - redirection attributes
        token - keyloak auth token
        originDirId - the (optional) directory where this request came from
        dirId - the directory id
        newName - the new name
        Returns:
        back to the overview