Class DocumentController
- All Implemented Interfaces:
Serializable
The DocumentController fires CDI events from the type WorkflowEvent. A CDI bean can observe these events to participate in the processing life cycle.
To load a document the methods load(id) and onLoad() can be used. The method load expects the uniqueId of a document to be loaded. The onLoad() method extracts the uniqueid from the query parameter 'id'. This is the recommended way to support bookmarkable URLs. To load a document the onLoad method can be triggered by an jsf viewAction placed in the header of a JSF page:
<f:metadata>
<f:viewAction action="... documentController.onLoad()" />
</f:metadata>
A bookmarkable URL looks like this:
/myForm.xthml?id=[UNIQUEID]
In combination with the viewAction the DocumentController is automatically initialized.
After a document is loaded, a new conversation is started and the CDI event WorkflowEvent.DOCUMENT_CHANGED is fired.
After a document was saved, the conversation is automatically closed. Stale conversations will automatically timeout with the default session timeout.
After each call of the method save the Post-Redirect-Get is initialized with the default URL from the start of the conversation. This guarantees bookmakrable URLs.
Within a JSF form, the items of a document can be accessed by the getter method getDocument().
#{documentController.document.item['$workflowstatus']}
The default type of a entity created with the DataController is 'workitem'. This property can be changed from a client.
- Version:
- 0.0.1
- Author:
- rsoika
- See Also:
-
Field Summary
Fields inherited from class org.imixs.workflow.faces.data.AbstractDataController
data
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
This method creates an empty workItem with the default type property and the property '$Creator' holding the current RemoteUser This method should be overwritten to add additional Business logic here.void
This action method deletes a workitem.Returns the current workItem.void
Loads a workitem by a given $uniqueid and starts a new conversaton.void
save()
This method saves the current document.void
setDocument
(ItemCollection document) Set the current worktItemMethods inherited from class org.imixs.workflow.faces.data.AbstractDataController
close, getDefaultType, getDocumentService, isNewWorkitem, onLoad, reset, setDefaultType, startConversation
-
Field Details
-
events
-
-
Constructor Details
-
DocumentController
public DocumentController()
-
-
Method Details
-
getDocument
Returns the current workItem. If no workitem is defined the method Instantiates a empty ItemCollection.- Returns:
- - current workItem or null if not set
-
setDocument
Set the current worktItem- Parameters:
workitem
- - new reference or null to clear the current workItem.
-
create
public void create()This method creates an empty workItem with the default type property and the property '$Creator' holding the current RemoteUser This method should be overwritten to add additional Business logic here. -
save
This method saves the current document.The method fires the WorkflowEvents WORKITEM_BEFORE_SAVE and WORKITEM_AFTER_SAVE.
- Throws:
AccessDeniedException
- - if user has insufficient access rights.
-
delete
This action method deletes a workitem. The Method also deletes also all child workitems recursive- Parameters:
currentSelection
- - workitem to be deleted- Throws:
AccessDeniedException
-
load
Loads a workitem by a given $uniqueid and starts a new conversaton. The conversaion will be ended after the workitem was processed or after the MaxInactiveInterval from the session.- Overrides:
load
in classAbstractDataController
- Parameters:
uniqueid
-
-