Nuxeo Enterprise Platform 5.1

org.nuxeo.ecm.platform.workflow.jbpm.handlers.api.common
Class AbstractWorkflowDocumentHandler

java.lang.Object
  extended by org.nuxeo.ecm.platform.workflow.jbpm.handlers.api.common.AbstractWorkflowDocumentHandler
Direct Known Subclasses:
AbstractWorkflowDocumentActionHandler, AbstractWorkflowDocumentAssignmentHandler

public abstract class AbstractWorkflowDocumentHandler
extends Object

Base handler for both jBPM action and assignment handlers.

Defines an API to interact with NXWorkflow and NXWorkflowDocument from jBPM handlers. Expected to be used and extended to define custom business rules around process dealing with documents.

Current implementation assumes only one document bound to the process...

Author:
Julien Anguenot
See Also:
AbstractWorkflowDocumentActionHandler, AbstractWorkflowDocumentAssignmentHandler

Field Summary
protected  CoreDocumentManagerBusinessDelegate coreDocBD
           
protected  WorkflowDocumentLifeCycleBusinessDelegate lifecycleBD
           
protected static Log log
           
protected  WorkflowDocumentSecurityBusinessDelegate secuBD
           
protected  WorkflowDocumentSecurityPolicyBusinessDelegate secuPolicyBD
           
protected  WorkflowDocumentRelationBusinessDelegate wDocRelBD
           
 
Constructor Summary
AbstractWorkflowDocumentHandler()
           
 
Method Summary
protected  void bindDocumentToProcess(ExecutionContext ec)
          Bind the actual process with the document, if any, given an execution context.
protected  boolean documentFollowTransition(ExecutionContext ec, String transition)
          Makes the document bound to the process, if it exists, follow a transition.
protected  Collection<String> getDocumentAllowedStateTransitions(ExecutionContext ec)
          Returns the allows state transitions for the document bound the process if any.
protected  String getDocumentCurrentLifeCycle(ExecutionContext ec)
          Returns the current life cycle state for the document bound to the process if any.
protected  CoreSession getDocumentManager(ExecutionContext ec)
          Returns the document manager bean (core session).
protected  DocumentMessageProducer getDocumentMessageProducer()
          Returns the document message producer bean.
protected  DocumentModel getDocumentModel(ExecutionContext ec)
          Returns the document model if one is bound to the actual process.
protected  DocumentRef getDocumentRef(ExecutionContext ec)
          Returns the document ref if one is bound to the actual process.
protected  String getDocumentRepositoryLocationURI(ExecutionContext ec)
          Returns the repository location URI if a document ref is bound to the actual process.
protected  Map<String,Serializable> getInfoMap(ExecutionContext ec)
          Computes a process info map => optimization.
protected  WorkflowDocumentLifeCycleManager getLifeCycleManager(ExecutionContext ec)
          Returns the workflow document life cycle manager bean.
protected  String getLifeCycleTransitionToDestinationState(ExecutionContext ec)
          Returns the transition to destination life cycle after the process if any bound to the actual process.
protected  ProcessInstance getProcessInstance(ExecutionContext ec)
          Returns the actual process instance.
protected  String getProcessInstanceCreator(ExecutionContext ec)
          Returns the actual process creator.
protected  int getProcessInstanceCurrentReviewLevel(ExecutionContext ec)
          Returns the actual process instance review level.
protected  String getProcessInstanceDocumentModificationPolicy(ExecutionContext ec)
          Returns the actual process instance modification policy.
protected  String getProcessInstanceDocumentVersioningPolicy(ExecutionContext ec)
          Returns the actual process instance versioning policy.
protected  String getProcessInstanceName(ExecutionContext ec)
          Returns the process instance name.
protected  WorkflowDocumentSecurityManager getSecuManager(ExecutionContext ec)
          Returns the workflow document security manager bean.
protected  WorkflowDocumentSecurityPolicyManager getSecuPolicyManager()
          Returns the worflow document security policy manager bean.
protected  WAPI getWAPI()
          Returns the workflow api bean.
protected  WorkflowDocumentRelationManager getWorkflowDocumentRelation()
          Returns the workflow document relation manager bean.
protected  void notifyEvent(ExecutionContext ec, String eventId)
          Notify event.
protected  void removeWFACL(ExecutionContext ec)
          Removes the ACL the actual process added on the document if one is bound to the process.
protected  void setupDefaultRightsFromPolicy(ExecutionContext ec)
          Setup the default rights on the document bound to the actual process, if any, using the security policy bound to the process, if any.
protected  void setupRightsFromPolicy(ExecutionContext ec)
          Setup the rights on the document bound to the actual process, if any, using the security policy bound to the process, if any.
protected  void unbindDocumentToProcess(ExecutionContext ec)
          Unbinds the document from the process if exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final Log log

lifecycleBD

protected final WorkflowDocumentLifeCycleBusinessDelegate lifecycleBD

secuBD

protected final WorkflowDocumentSecurityBusinessDelegate secuBD

secuPolicyBD

protected final WorkflowDocumentSecurityPolicyBusinessDelegate secuPolicyBD

wDocRelBD

protected final WorkflowDocumentRelationBusinessDelegate wDocRelBD

coreDocBD

protected final CoreDocumentManagerBusinessDelegate coreDocBD
Constructor Detail

AbstractWorkflowDocumentHandler

public AbstractWorkflowDocumentHandler()
Method Detail

getLifeCycleManager

protected WorkflowDocumentLifeCycleManager getLifeCycleManager(ExecutionContext ec)
                                                        throws Exception
Returns the workflow document life cycle manager bean.

Parameters:
ec - the jbpm execution context.
Returns:
an EJB proxy
Throws:
Exception

getDocumentManager

protected CoreSession getDocumentManager(ExecutionContext ec)
                                  throws Exception
Returns the document manager bean (core session).

Parameters:
ec - the jbpm execution context.
Returns:
an EJB proxy
Throws:
Exception

getDocumentMessageProducer

protected DocumentMessageProducer getDocumentMessageProducer()
                                                      throws Exception
Returns the document message producer bean.

Returns:
an EJB proxy
Throws:
NamingException
Exception

getWAPI

protected WAPI getWAPI()
                throws Exception
Returns the workflow api bean.

Returns:
en EJB proxy
Throws:
Exception

getSecuManager

protected WorkflowDocumentSecurityManager getSecuManager(ExecutionContext ec)
                                                  throws Exception
Returns the workflow document security manager bean.

Parameters:
ec - the jbpm execution context
Returns:
en EJB proxy
Throws:
Exception

getSecuPolicyManager

protected WorkflowDocumentSecurityPolicyManager getSecuPolicyManager()
                                                              throws Exception
Returns the worflow document security policy manager bean.

Returns:
en EJB proxy
Throws:
Exception

getWorkflowDocumentRelation

protected WorkflowDocumentRelationManager getWorkflowDocumentRelation()
                                                               throws Exception
Returns the workflow document relation manager bean.

Returns:
an EJB proxy
Throws:
Exception

notifyEvent

protected void notifyEvent(ExecutionContext ec,
                           String eventId)
                    throws Exception
Notify event.

Uses the document message producer bean which forwards on the NXP JMS topic.

Parameters:
ec - the jbpm execution context
Throws:
Exception

getProcessInstance

protected ProcessInstance getProcessInstance(ExecutionContext ec)
Returns the actual process instance.

Parameters:
ec - the jbpm execution context
Returns:
a jbpm process instance.
Throws:
Exception

getProcessInstanceCreator

protected String getProcessInstanceCreator(ExecutionContext ec)
                                    throws Exception
Returns the actual process creator.

Parameters:
ec - the jbpm execution context
Returns:
the principal name
Throws:
Exception

getProcessInstanceDocumentModificationPolicy

protected String getProcessInstanceDocumentModificationPolicy(ExecutionContext ec)
                                                       throws Exception
Returns the actual process instance modification policy.

Parameters:
ec - the jbpm execution context
Returns:
the modification policy
Throws:
Exception

getProcessInstanceDocumentVersioningPolicy

protected String getProcessInstanceDocumentVersioningPolicy(ExecutionContext ec)
                                                     throws Exception
Returns the actual process instance versioning policy.

Parameters:
ec - the jbpm execution context
Returns:
the versioning policy
Throws:
Exception

getProcessInstanceCurrentReviewLevel

protected int getProcessInstanceCurrentReviewLevel(ExecutionContext ec)
                                            throws Exception
Returns the actual process instance review level.

Parameters:
ec - the jbpm execution context
Returns:
the current review level. Default is 0 if not found.
Throws:
Exception

getDocumentRef

protected DocumentRef getDocumentRef(ExecutionContext ec)
Returns the document ref if one is bound to the actual process.

Parameters:
ec - the jbpm execution context
Returns:
a Nuxeo core document reference

getDocumentModel

protected DocumentModel getDocumentModel(ExecutionContext ec)
                                  throws Exception
Returns the document model if one is bound to the actual process.

Parameters:
ec - the jbpm execution context
Returns:
a Nuxeo core document model instance
Throws:
Exception

getDocumentRepositoryLocationURI

protected String getDocumentRepositoryLocationURI(ExecutionContext ec)
Returns the repository location URI if a document ref is bound to the actual process.

Repository location are mandatory beside document ref to identify a document using Nuxeo core remoting, currently. (5.1.x)

Parameters:
ec - the jbpm execution context
Returns:
a repository URI

getLifeCycleTransitionToDestinationState

protected String getLifeCycleTransitionToDestinationState(ExecutionContext ec)
Returns the transition to destination life cycle after the process if any bound to the actual process.

Parameters:
ec - the jbpm execution context
Returns:
a life cycle transition name.

getDocumentAllowedStateTransitions

protected Collection<String> getDocumentAllowedStateTransitions(ExecutionContext ec)
                                                         throws Exception
Returns the allows state transitions for the document bound the process if any.

Parameters:
ec - the jbpm execution context
Returns:
a collection of life cycle state names.
Throws:
Exception

documentFollowTransition

protected boolean documentFollowTransition(ExecutionContext ec,
                                           String transition)
                                    throws Exception
Makes the document bound to the process, if it exists, follow a transition.

Parameters:
ec - the jbpm execution context
transition - a life cycle transtion name
Returns:
true of operation succedeed false if not
Throws:
Exception

getDocumentCurrentLifeCycle

protected String getDocumentCurrentLifeCycle(ExecutionContext ec)
                                      throws Exception
Returns the current life cycle state for the document bound to the process if any.

Parameters:
ec - the jbpm execution context
Returns:
the current life cycle state name.
Throws:
Exception

bindDocumentToProcess

protected void bindDocumentToProcess(ExecutionContext ec)
                              throws Exception
Bind the actual process with the document, if any, given an execution context.

Parameters:
ec - the jbpm execution context
Throws:
Exception

unbindDocumentToProcess

protected void unbindDocumentToProcess(ExecutionContext ec)
                                throws Exception
Unbinds the document from the process if exists.

Parameters:
ec - the jbpm execution context
Throws:
Exception

removeWFACL

protected void removeWFACL(ExecutionContext ec)
                    throws Exception
Removes the ACL the actual process added on the document if one is bound to the process.

Parameters:
ec - the jbpm execution context
Throws:
Exception

getProcessInstanceName

protected String getProcessInstanceName(ExecutionContext ec)
                                 throws Exception
Returns the process instance name.

Parameters:
ec - the jbpm execution context
Returns:
the process instance name
Throws:
Exception

setupRightsFromPolicy

protected void setupRightsFromPolicy(ExecutionContext ec)
                              throws Exception
Setup the rights on the document bound to the actual process, if any, using the security policy bound to the process, if any.

Parameters:
ec - the jbpm execution context
Throws:
Exception

setupDefaultRightsFromPolicy

protected void setupDefaultRightsFromPolicy(ExecutionContext ec)
                                     throws Exception
Setup the default rights on the document bound to the actual process, if any, using the security policy bound to the process, if any.

Parameters:
ec - the jbpm execution context
Throws:
Exception

getInfoMap

protected Map<String,Serializable> getInfoMap(ExecutionContext ec)
                                       throws Exception
Computes a process info map => optimization.

Parameters:
ec - the jbpm execution context.
Returns:
a process info map.
Throws:
Exception

Nuxeo Enterprise Platform 5.1

Copyright ? 2007 Nuxeo SAS. All Rights Reserved.