Class FileUploadController
java.lang.Object
org.imixs.workflow.faces.fileupload.FileUploadController
- All Implemented Interfaces:
Serializable
The FileUploadController is a conversation scoped JSF 4.0 component used to
transfer the parts to the associated workitem.
The controller supports two modes:
SingleMode:
In this mode one or multiple files can be transferred in a one request. This is mainly covered by JavaScript code and works in a simple straight forward way.
AjaxMode:
In the ajax mode one or multiple files can be transferred sequentiell in separate ajax request. This mode is more user friendly.
<i:imixsFileUpload id="file_upload_id"
showattachments="true"
workitem="#{workflowController.workitem}"
labelButton="#{message.documents_upload}"
labelHelp="#{message.documents_upload_help}"/>
- Author:
- rsoika
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttachedFile
(FileData fileData) The method adds a FileData object to the workitem For example this method is used by the Imixs WopiControllervoid
addFileUpload
(FileData fileData) Adds a FileData object to the uploaded File listvoid
attacheFiles
(ItemCollection workitem) Attaches the uploaded file objects to the current workitem.getCID()
Returns the current conversation id.List<jakarta.servlet.http.Part>
getFiles()
getFileSize
(String aFilename) get the file size for a given filename in human readable formatgetFileUpload
(String fileName) returns the single fileData object form the upload list by name This method is called by the AjaxFileUpload Servlet.returns the list of currently new attached files.getUserInfo
(String aFilename) Returns the user info (creator / modified) by filenamevoid
onDocumentEvent
(DocumentEvent documentEvent) In case no WorkflowController was used we observer also the before Save eventvoid
onWorkflowEvent
(WorkflowEvent workflowEvent) WorkflowEvent listener to add uploaded file parts into the current workitem.void
removeAttachedFile
(String aFilename) Removes a attached file object from the tmp list of uploaded files.void
removeFileUpload
(String aFilename) Removes a FileData object from the uploaded File liststatic double
round
(double value) helper method to round for 2 digits.void
void
setWorkitem
(ItemCollection workitem)
-
Field Details
-
FILEUPLOAD_ERROR
- See Also:
-
-
Constructor Details
-
FileUploadController
public FileUploadController()
-
-
Method Details
-
getFiles
-
setFiles
-
getWorkitem
-
setWorkitem
-
onWorkflowEvent
public void onWorkflowEvent(@Observes @Priority(1000) WorkflowEvent workflowEvent) throws PluginException WorkflowEvent listener to add uploaded file parts into the current workitem. If no workitem was specified the component takes the workitem of theWorkflowController
. The observer runs before normal application observers (Interceptor.Priority.LIBRARY_BEFORE)- Parameters:
workflowEvent
-- Throws:
AccessDeniedException
PluginException
-
onDocumentEvent
public void onDocumentEvent(@Observes @Priority(1000) DocumentEvent documentEvent) throws PluginException In case no WorkflowController was used we observer also the before Save event- Parameters:
documentEvent
-- Throws:
PluginException
-
attacheFiles
Attaches the uploaded file objects to the current workitem.- Throws:
PluginException
-
addAttachedFile
The method adds a FileData object to the workitem For example this method is used by the Imixs WopiController- Parameters:
fileData
-
-
removeAttachedFile
Removes a attached file object from the tmp list of uploaded files.- Parameters:
sFilename
- - filename to be removed
-
getUserInfo
Returns the user info (creator / modified) by filename- Returns:
-
getFileSize
get the file size for a given filename in human readable formatIn 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:
-
getCID
Returns the current conversation id. This id is passed to the AjaxFileUploadServelt URIs so make sure that the correct FileUploadController is injected.- Returns:
-
getFileUploads
returns the list of currently new attached files. This list is not equal the $file item! This method is called by the AjaxFileUpload Servlet.- Returns:
-
getFileUpload
returns the single fileData object form the upload list by name This method is called by the AjaxFileUpload Servlet.- Returns:
-
addFileUpload
Adds a FileData object to the uploaded File list- Parameters:
document
-aFilename
-
-
removeFileUpload
Removes a FileData object from the uploaded File list- Parameters:
document
-aFilename
-
-