lumis.content.workflow
Class WorkflowManager

Package class diagram package WorkflowManager
java.lang.Object
  extended by lumis.content.workflow.WorkflowManager
All Implemented Interfaces:
IWorkflowManager

public class WorkflowManager
extends Object
implements IWorkflowManager

The default implementation for IWorkflowManager.

Since:
4.0.0
See Also:
IWorkflowManager

Field Summary
protected static int SCOPE_ALL
           
protected static int SCOPE_ASSIGNED_TO
           
 
Fields inherited from interface lumis.content.workflow.IWorkflowManager
ASSIGNED_TO_KEEP_SAME_VALUE
 
Constructor Summary
WorkflowManager()
           
 
Method Summary
 boolean autoArchivePublishedContent(String metaDataId, ITransaction transaction)
          Used for the automatic content archiving process.
 boolean contentMayBePublished(SessionConfig sessionConfig, String itemId, String serviceInstanceId, String sourceId, ITransaction transaction)
           
 void createNewContentWorkflowMetaData(SessionConfig sessionConfig, String itemId, String serviceInstanceId, String sourceId, String assignedTo, ITransaction transaction)
          Creates the content workflow metadata for a new content.
 void deleteAllContentWorkflowMetaData(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction)
          Deletes all the workflow metadata that is assocated to a specified service instance.
 void deleteContentWorkflowMetaData(SessionConfig sessionConfig, String itemId, String serviceInstanceId, String sourceId, ITransaction transaction)
          Deletes the content workflow metadata of the given content.
 void destroyServiceInstanceWorkflow(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction)
          Destroys the service instance workflow, so that the service instance can be correctly removed.
 void executeAction(SessionConfig sessionConfig, String itemId, String serviceInstanceId, String sourceId, String performedTransitionId, String newAssignedTo, ITransaction transaction)
          Executes an action on a content's workflow.
 Collection<WorkflowStateConfig> getAccessibleStates(SessionConfig sessionConfig, String serviceInstanceId, boolean includeScopeAll, boolean includeScopeAssignedTo, ITransaction transaction)
          Returns a collection of workflow's accessible states.
 Collection<WorkflowTransitionConfig> getAccessibleTransitions(SessionConfig sessionConfig, String itemId, String serviceInstanceId, String sourceId, ITransaction transaction)
          Returns the transitions that are accessible by the sessionConfig's user for a specified content.
 Collection<WorkflowConfig> getAllWorkflows(SessionConfig sessionConfig, ITransaction transaction)
          Returns all registered workflows.
 ContentWorkflowMetaData getContentWorkflowMetaData(SessionConfig sessionConfig, String metaDataId, ITransaction transaction)
          Returns the content workflow metadata for a metadata id.
 ContentWorkflowMetaData getContentWorkflowMetaData(SessionConfig sessionConfig, String itemId, String serviceInstanceId, String sourceId, ITransaction transaction)
          Returns the content workflow metadata for a content.
 Collection<String> getPossibleAssignedToForAction(SessionConfig sessionConfig, String itemId, String serviceInstanceId, String sourceId, String transitionId, ITransaction transaction)
          Returns the possible assignedTo values for a workflow transition.
protected  Collection<String> getPrincipalRoles(SessionConfig sessionConfig, String serviceInstanceId, String principalId, ITransaction transaction)
           
 WorkflowConfig getServiceInstanceWorkflow(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction)
          Returns the workflow of a service instance.
 WorkflowStateConfig getState(SessionConfig sessionConfig, String workflowId, String stateId, ITransaction transaction)
          Returns a workflow state.
 WorkflowTransitionConfig getTransition(SessionConfig sessionConfig, String workflowId, String transitionId, ITransaction transaction)
          Returns a workflow transition.
 List<WorkflowTransitionConfig> getTransitionsByStateId(SessionConfig sessionConfig, String workflowId, String stateId, ITransaction transaction)
          Returns the transitions for a workflow state.
 WorkflowConfig getWorkflow(SessionConfig sessionConfig, String workflowId, ITransaction transaction)
          Returns a workflow.
 Collection<WorkflowPermission> getWorkflowPermissions(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction)
          Returns the permissions set for a workflow in a service instance.
protected  WorkflowConfig getWorkflowToRegister(SessionConfig sessionConfig, String workflowConfigPath, ITransaction transaction)
          Returns the WorkflowConfig instance to save in the register.
 boolean hasEditPermission(SessionConfig sessionConfig, String itemId, String serviceInstanceId, String sourceId, ITransaction transaction)
          Returns true if the sessionConfig's user has edit permission to the specified item, according to the workflow's definition, state and assigned to.
protected  boolean hasPermission(SessionConfig sessionConfig, Collection<String> roles, lumis.content.workflow.IPermissionable permissionable, boolean useScopeAll, boolean useScopeAssignedTo, ITransaction transaction)
          Checks if any of the roles have permission to the specified workflow resource.
protected  boolean hasPermission(SessionConfig sessionConfig, String principalId, lumis.content.workflow.IPermissionable permissionable, String itemId, String serviceInstanceId, String sourceId, ITransaction transaction)
          Checks if any of the principal have permission to the specified workflow resource.
 void register(SessionConfig sessionConfig, String workflowConfigPath, ITransaction transaction)
          Register a workflow.
 void setServiceInstanceWorkflow(SessionConfig sessionConfig, String serviceInstanceId, String workflowId, ITransaction transaction)
          Sets the workflow to be used in a service instance.
 void setWorkflowPermissions(SessionConfig sessionConfig, String serviceInstanceId, Collection<WorkflowPermission> permissions, ITransaction transaction)
          Updates the workflow permissions in a service instance.
 void unregister(SessionConfig sessionConfig, String workflowId, ITransaction transaction)
          Removes a workflow from the register.
 void updateRegister(SessionConfig sessionConfig, String workflowId, ITransaction transaction)
          Updates the register of a workflow.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCOPE_ALL

protected static final int SCOPE_ALL
See Also:
Constant Field Values

SCOPE_ASSIGNED_TO

protected static final int SCOPE_ASSIGNED_TO
See Also:
Constant Field Values
Constructor Detail

WorkflowManager

public WorkflowManager()
Method Detail

getWorkflowToRegister

protected WorkflowConfig getWorkflowToRegister(SessionConfig sessionConfig,
                                               String workflowConfigPath,
                                               ITransaction transaction)
                                        throws ManagerException,
                                               PortalException
Returns the WorkflowConfig instance to save in the register.

Parameters:
sessionConfig - the user session information.
workflowConfigPath - workflow configuration path.
transaction - the transaction for persistence access.
Returns:
the WorkflowConfig instance to save in the register.
Throws:
ManagerException
PortalException
Since:
4.0.5

register

public void register(SessionConfig sessionConfig,
                     String workflowConfigPath,
                     ITransaction transaction)
              throws ManagerException,
                     PortalException
Register a workflow.

Specified by:
register in interface IWorkflowManager
Parameters:
sessionConfig - the user session information.
workflowConfigPath - the path, relative to the definition directory, to the directory with the workflow's definition.
transaction - the transaction for persistence access.
Throws:
ManagerException
PortalException

updateRegister

public void updateRegister(SessionConfig sessionConfig,
                           String workflowId,
                           ITransaction transaction)
                    throws ManagerException,
                           PortalException
Updates the register of a workflow.

Specified by:
updateRegister in interface IWorkflowManager
Parameters:
sessionConfig - the user session information.
workflowId - the workflow id.
transaction - the transaction for persistence access.
Throws:
ManagerException
PortalException

unregister

public void unregister(SessionConfig sessionConfig,
                       String workflowId,
                       ITransaction transaction)
                throws PortalException
Description copied from interface: IWorkflowManager
Removes a workflow from the register.

Specified by:
unregister in interface IWorkflowManager
Parameters:
sessionConfig - the user session information.
workflowId - the workflow's identifier.
transaction - the transaction for persistence access.
Throws:
PortalException

getAllWorkflows

public Collection<WorkflowConfig> getAllWorkflows(SessionConfig sessionConfig,
                                                  ITransaction transaction)
                                           throws PortalException
Description copied from interface: IWorkflowManager
Returns all registered workflows.

Specified by:
getAllWorkflows in interface IWorkflowManager
Parameters:
sessionConfig - the user session information.
transaction - the transaction for persistence access.
Returns:
a collection with all registered workflows.
Throws:
PortalException

getWorkflow

public WorkflowConfig getWorkflow(SessionConfig sessionConfig,
                                  String workflowId,
                                  ITransaction transaction)
                           throws PortalException
Description copied from interface: IWorkflowManager
Returns a workflow.

Specified by:
getWorkflow in interface IWorkflowManager
Parameters:
sessionConfig - the user session information.
workflowId - the workflow's identifier.
transaction - the transaction for persistence access.
Returns:
the workflow.
Throws:
PortalException

getTransitionsByStateId

public List<WorkflowTransitionConfig> getTransitionsByStateId(SessionConfig sessionConfig,
                                                              String workflowId,
                                                              String stateId,
                                                              ITransaction transaction)
                                                       throws PortalException
Description copied from interface: IWorkflowManager
Returns the transitions for a workflow state.

Specified by:
getTransitionsByStateId in interface IWorkflowManager
Parameters:
sessionConfig - the user session information.
workflowId - the identifier of the state's workflow.
stateId - the state's identifier.
transaction - the transaction for persistence access.
Returns:
a list with the state's transitions.
Throws:
PortalException

hasPermission

protected boolean hasPermission(SessionConfig sessionConfig,
                                Collection<String> roles,
                                lumis.content.workflow.IPermissionable permissionable,
                                boolean useScopeAll,
                                boolean useScopeAssignedTo,
                                ITransaction transaction)
                         throws PortalException
Checks if any of the roles have permission to the specified workflow resource.

Parameters:
sessionConfig - the current session information.
roles - a collection with the roles ids.
permissionable - a permissionable workflow resource.
useScopeAll - if the scope='all' permissions will be used to verify permission.
useScopeAssignedTo - if the scope='assignedTo' permissions will be used to verify permission.
transaction - the transaction for persistence access.
Returns:
true if any roles has permission to the specified workflow resource, false otherwise.
Throws:
PortalException

getPrincipalRoles

protected Collection<String> getPrincipalRoles(SessionConfig sessionConfig,
                                               String serviceInstanceId,
                                               String principalId,
                                               ITransaction transaction)
                                        throws PortalException
Throws:
PortalException

hasPermission

protected boolean hasPermission(SessionConfig sessionConfig,
                                String principalId,
                                lumis.content.workflow.IPermissionable permissionable,
                                String itemId,
                                String serviceInstanceId,
                                String sourceId,
                                ITransaction transaction)
                         throws PortalException
Checks if any of the principal have permission to the specified workflow resource.

Parameters:
sessionConfig - the current session information.
principalId - the principal id.
permissionable - a permissionable workflow resource.
itemId - the content item id. If null, the scope='assignedTo' allow permissions are ignored.
serviceInstanceId - the content service instance id.
transaction - the transaction for persistence access.
Returns:
true if the principal has permission to access the specified workflow resource, false otherwise.
Throws:
PortalException

getAccessibleTransitions

public Collection<WorkflowTransitionConfig> getAccessibleTransitions(SessionConfig sessionConfig,
                                                                     String itemId,
                                                                     String serviceInstanceId,
                                                                     String sourceId,
                                                                     ITransaction transaction)
                                                              throws PortalException
Description copied from interface: IWorkflowManager
Returns the transitions that are accessible by the sessionConfig's user for a specified content.

Specified by:
getAccessibleTransitions in interface IWorkflowManager
Parameters:
sessionConfig - the user session information.
itemId - the content's itemId.
serviceInstanceId - the content's service instance identifier.
sourceId - the content's source identifier.
transaction - the transaction for persistence access.
Returns:
a collection with the transitions.
Throws:
PortalException

getAccessibleStates

public Collection<WorkflowStateConfig> getAccessibleStates(SessionConfig sessionConfig,
                                                           String serviceInstanceId,
                                                           boolean includeScopeAll,
                                                           boolean includeScopeAssignedTo,
                                                           ITransaction transaction)
                                                    throws PortalException
Description copied from interface: IWorkflowManager
Returns a collection of workflow's accessible states.

Specified by:
getAccessibleStates in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
serviceInstanceId - the content service instance id.
includeScopeAll - if the states with permission scope all are to be included.
includeScopeAssignedTo - if the states with permission scope assigned to are to be included.
transaction - the transaction for persistence acecess.
Returns:
a collection with the workflow's acessible states.
Throws:
PortalException

getState

public WorkflowStateConfig getState(SessionConfig sessionConfig,
                                    String workflowId,
                                    String stateId,
                                    ITransaction transaction)
                             throws PortalException
Description copied from interface: IWorkflowManager
Returns a workflow state.

Specified by:
getState in interface IWorkflowManager
Parameters:
sessionConfig - the user session information.
workflowId - the identifier of the state's workflow.
stateId - the state's identifier.
transaction - the transaction for persistence access.
Returns:
the state.
Throws:
PortalException

getTransition

public WorkflowTransitionConfig getTransition(SessionConfig sessionConfig,
                                              String workflowId,
                                              String transitionId,
                                              ITransaction transaction)
                                       throws PortalException
Description copied from interface: IWorkflowManager
Returns a workflow transition.

Specified by:
getTransition in interface IWorkflowManager
Parameters:
sessionConfig - the user session information.
workflowId - the identifier of the state's workflow.
transitionId - the transition's identifier.
transaction - the transaction for persistence access.
Returns:
the transition.
Throws:
PortalException

getServiceInstanceWorkflow

public WorkflowConfig getServiceInstanceWorkflow(SessionConfig sessionConfig,
                                                 String serviceInstanceId,
                                                 ITransaction transaction)
                                          throws PortalException
Description copied from interface: IWorkflowManager
Returns the workflow of a service instance.

Specified by:
getServiceInstanceWorkflow in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
serviceInstanceId - the service instance's id.
transaction - the transaction for persistence access.
Throws:
PortalException

setServiceInstanceWorkflow

public void setServiceInstanceWorkflow(SessionConfig sessionConfig,
                                       String serviceInstanceId,
                                       String workflowId,
                                       ITransaction transaction)
                                throws PortalException
Description copied from interface: IWorkflowManager
Sets the workflow to be used in a service instance.

Specified by:
setServiceInstanceWorkflow in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
serviceInstanceId - the service instance's id.
workflowId - the workflow's id.
transaction - the transaction for persistence access.
Throws:
PortalException

destroyServiceInstanceWorkflow

public void destroyServiceInstanceWorkflow(SessionConfig sessionConfig,
                                           String serviceInstanceId,
                                           ITransaction transaction)
                                    throws PortalException
Description copied from interface: IWorkflowManager
Destroys the service instance workflow, so that the service instance can be correctly removed. This method should be called only prior to a service instance removal.

Specified by:
destroyServiceInstanceWorkflow in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
serviceInstanceId - the service instance's id.
transaction - the transaction for persistence access.
Throws:
PortalException

deleteAllContentWorkflowMetaData

public void deleteAllContentWorkflowMetaData(SessionConfig sessionConfig,
                                             String serviceInstanceId,
                                             ITransaction transaction)
                                      throws PortalException
Description copied from interface: IWorkflowManager
Deletes all the workflow metadata that is assocated to a specified service instance.

Specified by:
deleteAllContentWorkflowMetaData in interface IWorkflowManager
Parameters:
sessionConfig - the user session information.
serviceInstanceId - the service instance identifier.
transaction - the transaction for persistence access.
Throws:
PortalException

getWorkflowPermissions

public Collection<WorkflowPermission> getWorkflowPermissions(SessionConfig sessionConfig,
                                                             String serviceInstanceId,
                                                             ITransaction transaction)
                                                      throws PortalException
Description copied from interface: IWorkflowManager
Returns the permissions set for a workflow in a service instance.

Specified by:
getWorkflowPermissions in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
serviceInstanceId - the service instance's id.
transaction - the transaction for persistence access.
Returns:
a WorkflowPermission collection.
Throws:
PortalException

setWorkflowPermissions

public void setWorkflowPermissions(SessionConfig sessionConfig,
                                   String serviceInstanceId,
                                   Collection<WorkflowPermission> permissions,
                                   ITransaction transaction)
                            throws PortalException
Description copied from interface: IWorkflowManager
Updates the workflow permissions in a service instance.

Specified by:
setWorkflowPermissions in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
serviceInstanceId - the service instance's id.
permissions - the set of permissions to be set in the service instance. All previous permissions will be deleted.
transaction - the transaction for persistence access.
Throws:
PortalException

getContentWorkflowMetaData

public ContentWorkflowMetaData getContentWorkflowMetaData(SessionConfig sessionConfig,
                                                          String metaDataId,
                                                          ITransaction transaction)
                                                   throws PortalException
Description copied from interface: IWorkflowManager
Returns the content workflow metadata for a metadata id.

Specified by:
getContentWorkflowMetaData in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
metaDataId - the metadata's id.
transaction - the transaction for persistence access.
Returns:
the content workflow metadata.
Throws:
PortalException

getContentWorkflowMetaData

public ContentWorkflowMetaData getContentWorkflowMetaData(SessionConfig sessionConfig,
                                                          String itemId,
                                                          String serviceInstanceId,
                                                          String sourceId,
                                                          ITransaction transaction)
                                                   throws PortalException
Description copied from interface: IWorkflowManager
Returns the content workflow metadata for a content.

Specified by:
getContentWorkflowMetaData in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
itemId - the content's item id.
serviceInstanceId - the content's service instance id.
sourceId - the content's source id.
transaction - the transaction for persistence access.
Returns:
the content workflow metadata.
Throws:
PortalException

createNewContentWorkflowMetaData

public void createNewContentWorkflowMetaData(SessionConfig sessionConfig,
                                             String itemId,
                                             String serviceInstanceId,
                                             String sourceId,
                                             String assignedTo,
                                             ITransaction transaction)
                                      throws PortalException
Description copied from interface: IWorkflowManager
Creates the content workflow metadata for a new content.

Specified by:
createNewContentWorkflowMetaData in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
itemId - the content's item id.
serviceInstanceId - the content's service instance id.
sourceId - the content's source id.
transaction - the transaction for persistence access.
Throws:
PortalException

deleteContentWorkflowMetaData

public void deleteContentWorkflowMetaData(SessionConfig sessionConfig,
                                          String itemId,
                                          String serviceInstanceId,
                                          String sourceId,
                                          ITransaction transaction)
                                   throws PortalException
Description copied from interface: IWorkflowManager
Deletes the content workflow metadata of the given content.

Specified by:
deleteContentWorkflowMetaData in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
itemId - the content's item id.
serviceInstanceId - the content's service instance id.
sourceId - the content's source id.
transaction - the transaction for persistence access.
Throws:
PortalException

executeAction

public void executeAction(SessionConfig sessionConfig,
                          String itemId,
                          String serviceInstanceId,
                          String sourceId,
                          String performedTransitionId,
                          String newAssignedTo,
                          ITransaction transaction)
                   throws PortalException
Description copied from interface: IWorkflowManager
Executes an action on a content's workflow.

Specified by:
executeAction in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
itemId - the content's item id.
serviceInstanceId - the content's service instance id.
sourceId - the content's source id.
performedTransitionId - the transition action performed. If null, no transition is performed.
newAssignedTo - the new assigned to principal id.
transaction - the transaction for persistence access.
Throws:
PortalException

hasEditPermission

public boolean hasEditPermission(SessionConfig sessionConfig,
                                 String itemId,
                                 String serviceInstanceId,
                                 String sourceId,
                                 ITransaction transaction)
                          throws PortalException
Description copied from interface: IWorkflowManager
Returns true if the sessionConfig's user has edit permission to the specified item, according to the workflow's definition, state and assigned to.

If there is no workflow, or no content workflow metadata, true is returned.

Specified by:
hasEditPermission in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
itemId - the content's item id.
serviceInstanceId - the content's service instance id.
sourceId - the content's source id.
transaction - the transaction for persistence access.
Returns:
true if the user has the permission, false otherwise.
Throws:
PortalException

getPossibleAssignedToForAction

public Collection<String> getPossibleAssignedToForAction(SessionConfig sessionConfig,
                                                         String itemId,
                                                         String serviceInstanceId,
                                                         String sourceId,
                                                         String transitionId,
                                                         ITransaction transaction)
                                                  throws PortalException
Description copied from interface: IWorkflowManager
Returns the possible assignedTo values for a workflow transition.

Specified by:
getPossibleAssignedToForAction in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
serviceInstanceId - the content's service instance id.
sourceId - the content's source id.
transitionId - the workflow's transition id.
transaction - the transaction for persistence access.
Returns:
a collection of principals ids that may be assigned to a content in the given workflow state.
Throws:
PortalException

contentMayBePublished

public boolean contentMayBePublished(SessionConfig sessionConfig,
                                     String itemId,
                                     String serviceInstanceId,
                                     String sourceId,
                                     ITransaction transaction)
                              throws PortalException
Specified by:
contentMayBePublished in interface IWorkflowManager
Parameters:
sessionConfig - user session information.
itemId - the content's item id.
serviceInstanceId - the content's service instance id.
sourceId - the content's source id.
transaction - the transaction for persistence access.
Returns:
true if the content may be published, according to its workflow state, false otherwise.
Throws:
PortalException

autoArchivePublishedContent

public boolean autoArchivePublishedContent(String metaDataId,
                                           ITransaction transaction)
                                    throws PortalException
Description copied from interface: IWorkflowManager
Used for the automatic content archiving process. Performs a transition to a directly reachable archival state, if any. If the content is not in a published state or is already in an archived state or is not after its publishing period then nothing is done.

Specified by:
autoArchivePublishedContent in interface IWorkflowManager
Parameters:
metaDataId - the content's metadata id.
transaction - the transaction for persistence access.
Returns:
true if the content was archived, or false if nothing was done.
Throws:
PortalException


Lumisportal  4.1.0.071221 - Copyright © 2001-2007, Lumis. All Rights Reserved.