Class WorkflowEngine
Implements
Inherited Members
Namespace: DotNetNuke.Entities.Content.Workflow
Assembly: DotNetNuke.dll
Syntax
public class WorkflowEngine : ServiceLocator<IWorkflowEngine, WorkflowEngine>, IWorkflowEngine
Constructors
| Improve this Doc View SourceWorkflowEngine()
Initializes a new instance of the WorkflowEngine class.
Declaration
public WorkflowEngine()
Methods
| Improve this Doc View SourceCompleteState(StateTransaction)
This method completes a state moving the workflow forward to the next state. If the next state is not the last one it send notifications to the reviewers of the next state, otherwise send the notification to the user that submit the draft in case the workflow complete.
Declaration
public void CompleteState(StateTransaction stateTransaction)
Parameters
Type | Name | Description |
---|---|---|
StateTransaction | stateTransaction | State transaction Dto. |
Exceptions
Type | Condition |
---|---|
WorkflowConcurrencyException | Thrown when the current state of the workflow is not the same of the current state specified in the StateTransaction Dto. |
WorkflowSecurityException | Thrown when the user does not have review permission on the current state. |
CompleteWorkflow(StateTransaction)
This method completes the workflow no matter what is the current state. It also sends a system notification to the user that submit the workflow to let him know about the complete workflow action.
Declaration
public void CompleteWorkflow(StateTransaction stateTransaction)
Parameters
Type | Name | Description |
---|---|---|
StateTransaction | stateTransaction | State transaction Dto. |
Remarks
This method does not check review permission on the current state.
Exceptions
Type | Condition |
---|---|
WorkflowConcurrencyException | Thrown when the current state of the workflow is not the same of the current state specified in the StateTransaction Dto. |
DiscardState(StateTransaction)
This method discard a state moving the workflow backward to the previous state. If the previous state is not the first one it send notifications to the reviewers of the previous state, otherwise send the notification to the user that submit the draft in case the workflow is in the draft state.
Declaration
public void DiscardState(StateTransaction stateTransaction)
Parameters
Type | Name | Description |
---|---|---|
StateTransaction | stateTransaction | State transaction Dto. |
Exceptions
Type | Condition |
---|---|
WorkflowConcurrencyException | Thrown when the current state of the workflow is not the same of the current state specified in the StateTransaction Dto. |
WorkflowSecurityException | Thrown when the user does not have review permission on the current state. |
WorkflowInvalidOperationException | Thrown when trying to discard a workflow in the last state. |
DiscardWorkflow(StateTransaction)
This method discards the workflow no matter what is the current state. It also sends a system notification to the user that submit the workflow to let him know about the discard workflow action.
Declaration
public void DiscardWorkflow(StateTransaction stateTransaction)
Parameters
Type | Name | Description |
---|---|---|
StateTransaction | stateTransaction | State transaction Dto. |
Remarks
This method does not check review permission on the current state.
Exceptions
Type | Condition |
---|---|
WorkflowConcurrencyException | Thrown when the current state of the workflow is not the same of the current state specified in the StateTransaction Dto. |
GetFactory()
Gets the service locator factory.
Declaration
protected override Func<IWorkflowEngine> GetFactory()
Returns
Type | Description |
---|---|
Func<IWorkflowEngine> | A factory function. |
Overrides
GetStartedDraftStateUser(ContentItem)
This method returns the user that started the workflow for the contentItem.
Declaration
public UserInfo GetStartedDraftStateUser(ContentItem contentItem)
Parameters
Type | Name | Description |
---|---|---|
ContentItem | contentItem | ContentItem. |
Returns
Type | Description |
---|---|
UserInfo | User Info. |
Remarks
If Content Item has no workflow, returns null.
GetSubmittedDraftStateUser(ContentItem)
This method returns the user that submitted the contentItem.
Declaration
public UserInfo GetSubmittedDraftStateUser(ContentItem contentItem)
Parameters
Type | Name | Description |
---|---|---|
ContentItem | contentItem | ContentItem. |
Returns
Type | Description |
---|---|
UserInfo | User Info. |
Remarks
If Content Item has no workflow or the content has not submitted yet, returns null.
IsWorkflowCompleted(ContentItem)
This method returns true if the workflow associated to the Content Item is completed (it is in the last state).
Declaration
public bool IsWorkflowCompleted(ContentItem contentItem)
Parameters
Type | Name | Description |
---|---|---|
ContentItem | contentItem | Content item entity. |
Returns
Type | Description |
---|---|
System.Boolean | True if the workflow is completed, false otherwise. |
Remarks
Content Item without workflow is considered as completed as well.
IsWorkflowCompleted(Int32)
This method returns true if the workflow associated to the Content Item is completed (it is in the last state).
Declaration
public bool IsWorkflowCompleted(int contentItemId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | contentItemId | Content item Id. |
Returns
Type | Description |
---|---|
System.Boolean | True if the workflow is completed, false otherwise. |
Remarks
Content Item without workflow is considered as completed as well.
IsWorkflowOnDraft(ContentItem)
This method returns true if the workflow associated to the Content Item is in draft (it is in the first state).
Declaration
public bool IsWorkflowOnDraft(ContentItem contentItem)
Parameters
Type | Name | Description |
---|---|---|
ContentItem | contentItem | Content item entity. |
Returns
Type | Description |
---|---|
System.Boolean | True if the workflow is in draft, false otherwise. |
Remarks
Content Item without workflow is considered as not in draft.
IsWorkflowOnDraft(Int32)
This method returns true if the workflow associated to the Content Item is in draft (it is in the first state).
Declaration
public bool IsWorkflowOnDraft(int contentItemId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | contentItemId | Content item Id. |
Returns
Type | Description |
---|---|
System.Boolean | True if the workflow is in draft, false otherwise. |
Remarks
Content Item without workflow is considered as not in draft.
StartWorkflow(Int32, Int32, Int32)
This method starts a workflow for a Content Item.
Declaration
public void StartWorkflow(int workflowId, int contentItemId, int userId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workflowId | Workflow Id. |
System.Int32 | contentItemId | Content item Id. |
System.Int32 | userId | User Id of the user that start the workflow. |
Exceptions
Type | Condition |
---|---|
WorkflowInvalidOperationException | Thrown when start a workflow on a Content Item that already has a started workflow. |