Uploaded image for project: 'Kuali Rice Development'
  1. Kuali Rice Development
  2. KULRICE-12514 Component for Multiple File Upload
  3. KULRICE-12659

MultiFileUpload implementation of fileUploadGet, fileUploadPost, and fileDeletion

    Details

    • Type: Sub Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: User Experience (UX)
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Rice Module:
      KRAD
    • Sprint:
      2.5.0-m3 Sprint 1, 2.5.0-m3 Sprint 2, 2.5.0-m4 Sprint 1, UXI 2.5.0-m4 Sprint 2, UXI 2.5.0-m5 Sprint 1, Core 2.5.0-m5 Sprint 2b
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required
    • Code Review Status:
      Not Required
    • Include in Release Notes?:
      Yes

      Description

      Implement fileUploadGet, fileUploadPost, and fileDeletion (names tbd/discussed)

      What is working so far in preliminary tests for dummy get and post feedback from the server, There needs to be some handling of error states as well probably:

      @MethodAccessible
      @RequestMapping(method = RequestMethod.GET, params = "methodToCall=fileUpload")
      public @ResponseBody Map fileUploadGet(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
      HttpServletRequest request, HttpServletResponse response)

      { List<FileBase> returnObjects = new ArrayList<FileBase>(); // TODO get the files from service/db here and iterate (unique key would id of top level object + property) // fake data for testing FileBase fakeFile = new FileBase(); fakeFile.setName("fakeName.png"); fakeFile.setSize(5000000L); fakeFile.setDeleteUrl("?methodToCall=fileDelete"); returnObjects.add(fakeFile); Map<String, Object> files = new HashMap<String, Object>(); // TODO actual version would use a name passed to the request files.put("files", returnObjects); return files; }

      @MethodAccessible
      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=fileUpload")
      public @ResponseBody Map fileUploadPost(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
      MultipartHttpServletRequest request, HttpServletResponse response) {
      // TODO actual version would use a name passed to the request
      List<MultipartFile> uploadedFiles = request.getFiles("files");

      List<FileBase> returnObjects = new ArrayList<FileBase>();

      for (MultipartFile uploadedFile: uploadedFiles)

      { FileBase fileObject = new FileBase(uploadedFile); String id = UUID.randomUUID().toString() + "_" + uploadedFile.getName(); // TODO Saving to a db/file system would go here // TODO Generation and setting of thumbnail url (when applicable) and file url would go here fileObject.setId(id); fileObject.setDeleteType("DELETE"); // TODO Form key, cache key, view id needs to be added here (probably) fileObject.setDeleteUrl("?methodToCall=fileDelete"); returnObjects.add(fileObject); }

      ObjectPropertyUtils.setPropertyValue(uifForm, "files", returnObjects);

      Map<String, Object> files = new HashMap<String, Object>();
      // TODO actual version would use a name passed to the request
      files.put("files", returnObjects);
      return files;
      }

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              jheckel Jeff Heckel (Inactive)
              Reporter:
              bsmith Brian Smith (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours
                6h