Class FileUploadController

java.lang.Object
org.imixs.workflow.faces.fileupload.FileUploadController
All Implemented Interfaces:
Serializable

@Named @ConversationScoped public class FileUploadController extends Object implements Serializable
The FileUploadController is a conversation scoped bean and used to hold the upladed files and transfere the to the accoicated workitem. The AjaxFileUploadServlet injects this bean to provide new file data.
Author:
rsoika
See Also:
  • Constructor Details

    • FileUploadController

      public FileUploadController()
  • Method Details

    • getWorkitem

      public ItemCollection getWorkitem()
      Setter method to get an instance of the current workitem the FileData should be stored.
      Returns:
    • setWorkitem

      public void setWorkitem(ItemCollection workitem)
      This method set the current workitem and starts a new conversation. With this mechanism the fileUploadController bean can be used in multiple browser tabs or browser sessions.
      Parameters:
      workitem -
    • getCID

      public String getCID()
      Returns the current conversation id. This id is passed to the AjaxFileUploadServelt URIs so make sure that the correct FileUploadController is injected.
      Returns:
    • onWorkflowEvent

      public void onWorkflowEvent(@Observes WorkflowEvent workflowEvent)
      WorkflowEvent listener

      If a new WorkItem was created the file upload will be reset.

      Parameters:
      workflowEvent -
    • addAttachedFile

      public void addAttachedFile(FileData filedata)
      This method is called by the AjaxFileUpload Servlet. The method adds the file to the workitem but also updates the list of temporary files, which are not yet persisted.
      Parameters:
      document -
      aFilename -
    • removeAttachedFile

      public void removeAttachedFile(String aFilename)
      Removes a attached file object from the tmp list of uploaded files.
      Parameters:
      sFilename - - filename to be removed
    • removePersistedFile

      public void removePersistedFile(String aFilename)
      Removes a file object from a given workitem. Here we operate on a given workitem as the imixsFileUpload.xhtml has no idea of he current conversation scoped controller.
      Parameters:
      sFilename - - filename to be removed
    • getAttachedFiles

      public List<FileData> getAttachedFiles()
      returns the list of currently new attached files. This list is not equal the $file item!
      Returns:
    • getPersistedFiles

      public List<FileData> getPersistedFiles()
      returns the list of already persisted files. This list is not equal the $file item!
      Returns:
    • reset

      public void reset()
      reset the temp and persisted file variables.
    • getFileSize

      public String getFileSize(String aFilename)
      get the file size for a given filename in human readable format

      In case the Imixs-Archive API is connected, the file size is stored in the attriubte 'size'

      Parameters:
      sFilename - - filename to be removed
      Returns:
      - filsize in human readable string
    • round

      public static double round(double value)
      helper method to round for 2 digits.
      Parameters:
      value -
      places -
      Returns: