@Named @ConversationScoped public class DocumentController extends AbstractDataController implements 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.
| Modifier and Type | Field and Description |
|---|---|
protected javax.enterprise.event.Event<WorkflowEvent> |
events |
| Constructor and Description |
|---|
DocumentController() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
void |
delete(String uniqueID)
This action method deletes a workitem.
|
org.imixs.workflow.ItemCollection |
getDocument()
Returns the current workItem.
|
void |
load(String uniqueid)
Loads a workitem by a given $uniqueid and starts a new conversaton.
|
void |
save()
This method saves the current document.
|
void |
setDocument(org.imixs.workflow.ItemCollection document)
Set the current worktItem
|
addMessage, close, getDefaultType, isNewWorkitem, onLoad, reset, setDefaultType, startConversation@Inject protected javax.enterprise.event.Event<WorkflowEvent> events
public org.imixs.workflow.ItemCollection getDocument()
public void setDocument(org.imixs.workflow.ItemCollection document)
workitem - - new reference or null to clear the current workItem.public void create()
public void save()
throws org.imixs.workflow.exceptions.AccessDeniedException
The method fires the WorkflowEvents WORKITEM_BEFORE_SAVE and WORKITEM_AFTER_SAVE.
org.imixs.workflow.exceptions.AccessDeniedException - - if user has insufficient access rights.public void delete(String uniqueID) throws org.imixs.workflow.exceptions.AccessDeniedException
currentSelection - - workitem to be deletedorg.imixs.workflow.exceptions.AccessDeniedExceptionpublic void load(String uniqueid)
load in class AbstractDataControlleruniqueid - Copyright © 2006–2020 Imixs Software Solutions GmbH. All rights reserved.