Class DocumentRoutingServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.platform.routing.core.impl.DocumentRoutingServiceImpl
-
- All Implemented Interfaces:
DocumentRoutingService
,Adaptable
,Component
,Extensible
,TimestampedService
public class DocumentRoutingServiceImpl extends DefaultComponent implements DocumentRoutingService
The implementation of the routing service.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DocumentRoutingServiceImpl.AttachedDocumentsChecker
Cancel the workflow instance if all its attached document don't exist anymore.
-
Field Summary
Fields Modifier and Type Field Description static String
ACTOR_ACE_CREATOR
static String
CHAINS_TO_TYPE_XP
protected DocumentRoutingPersister
persister
static String
PERSISTER_XP
protected RepositoryInitializationHandler
repositoryInitializationHandler
static String
ROUTE_MODELS_IMPORTER_XP
protected RouteTemplateResourceRegistry
routeResourcesRegistry
protected Map<String,String>
typeToChain
protected Map<String,String>
undoChainIdFromDone
protected Map<String,String>
undoChainIdFromRunning
protected static String
WORKFLOW_MODELS_CACHE
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description DocumentRoutingServiceImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
activate(ComponentContext context)
Activates the component.void
addRouteElementToRoute(DocumentRef parentDocumentRef, int idx, DocumentRouteElement routeElement, CoreSession session)
Deprecated.void
addRouteElementToRoute(DocumentRef parentDocumentRef, String sourceName, DocumentRouteElement routeElement, CoreSession session)
Deprecated.void
cancelTask(CoreSession s, String taskId)
Cancels an open task.boolean
canCreateInstance(CoreSession session, List<String> documentIds, String workflowModelName)
Returnstrue
if the workflow model can be started on the document list.boolean
canUserValidateRoute(NuxeoPrincipal currentUser)
if the user can validate a route.boolean
canValidateRoute(DocumentModel documentRoute, CoreSession coreSession)
Checks if the principal that created the client session can validate the routevoid
cleanupDoneAndCanceledRouteInstances(String reprositoryName, int limit)
Deprecated.void
cleanupRouteInstances(String reprositoryName)
Remove the routes in state 'done' or 'canceled' of the given repository.void
completeTask(String routeId, String taskId, Map<String,Object> data, String status, CoreSession session)
Completes a task on a give node.protected void
completeTask(String routeId, String nodeId, Task task, Map<String,Object> data, String status, CoreSession session)
String
createNewInstance(String routeModelId, List<String> docIds, Map<String,Serializable> map, CoreSession s, boolean startInstance)
Creates a new route instance and optionally starts it.String
createNewInstance(String routeModelId, List<String> docIds, CoreSession session, boolean startInstance)
Creates a new route instance and optionally starts it.DocumentRoute
createNewInstance(DocumentRoute model, String documentId, CoreSession session)
Deprecated.DocumentRoute
createNewInstance(DocumentRoute model, String documentId, CoreSession session, boolean startInstance)
Deprecated.DocumentRoute
createNewInstance(DocumentRoute model, List<String> documentIds, CoreSession session)
Deprecated.DocumentRoute
createNewInstance(DocumentRoute model, List<String> docIds, CoreSession session, boolean startInstance)
Create a newDocumentRoute
instance from thisDocumentRoute
model.void
deactivate(ComponentContext context)
Deactivates the component.void
delegateTask(CoreSession s, String taskId, List<String> delegatedActors, String comment)
Reassigns the given task to the list of actors.int
doCleanupDoneAndCanceledRouteInstances(String reprositoryName, int limit)
Deprecated.void
endTask(CoreSession session, Task task, Map<String,Object> data, String status)
Ends a task.void
finishTask(CoreSession session, DocumentRoute route, Task task, boolean delete)
Finishes an open task.protected static void
fireEvent(String eventName, Map<String,Serializable> eventProperties, DocumentRoute route, CoreSession session)
protected void
fireEventAfterWorkflowStarted(DocumentRoute route, CoreSession session)
List<DocumentRoute>
getAvailableDocumentRoute(CoreSession session)
Return the list of availableDocumentRoute
document route.List<DocumentRoute>
getAvailableDocumentRouteModel(CoreSession session)
Return the list of availableDocumentRoute
model the user can start.protected static String
getDelegationACLName(String taskId)
protected static String
getDelegationACLName(Task task)
List<DocumentRoute>
getDocumentRelatedWorkflows(DocumentModel document, CoreSession session)
List<DocumentRoute>
getDocumentRoutesForAttachedDocument(CoreSession session, String attachedDocId)
List<DocumentRoute>
getDocumentRoutesForAttachedDocument(CoreSession session, String attachedDocId, List<DocumentRouteElement.ElementLifeCycleState> states)
Return the list of relatedDocumentRoute
in a state for a given attached document.protected FileManager
getFileManager()
String
getOperationChainId(String documentType)
Return the operation chain to run for a documentType.DocumentModelList
getOrderedRouteElement(String routeElementId, CoreSession session)
Get the children of the given stepFolder ordered by the ecm:pos metadata.protected List<DocumentRouteTableElement>
getRouteElements(DocumentRouteElement routeElementDocument, CoreSession session, List<DocumentRouteTableElement> routeElements, int depth)
Deprecated.List<DocumentRouteTableElement>
getRouteElements(DocumentRoute route, CoreSession session)
Deprecated.since 5.9.2 - Use only routes of type 'graph'String
getRouteModelDocIdWithId(CoreSession session, String id)
Returns the doc id of the route model with the given idList<URL>
getRouteModelTemplateResources()
Returns all the route models resource templates.DocumentRoute
getRouteModelWithId(CoreSession session, String id)
Returns the route model with the given idprotected static String
getRoutingACLName(String taskId)
protected static String
getRoutingACLName(Task task)
Finds an ACL name specific to the task (there may be several tasks applying permissions to the same document).List<DocumentRoute>
getRunnableWorkflows(CoreSession session, List<String> documentIds)
Returns a list of runnable document routes for the input document IDs.List<DocumentRoute>
getRunningWorkflowInstancesLaunchedByCurrentUser(CoreSession session)
List<DocumentRoute>
getRunningWorkflowInstancesLaunchedByCurrentUser(CoreSession session, String worflowModelName)
List<Task>
getTasks(DocumentModel document, String actorId, String workflowInstanceId, String worflowModelName, CoreSession s)
Deprecated.since 11.1 this method does not scale as it does not paginate results.String
getUndoFromDoneOperationChainId(String documentType)
Return the operation chain to undo a step when the step is in done state.String
getUndoFromRunningOperationChainId(String documentType)
Return the operation chain to undo a step when the step is in running state.protected URL
getUrlFromPath(RouteModelResourceType res, RuntimeContext extensionContext)
protected Map<String,Serializable>
getWorkflowContextualInfo(CoreSession session, Task item)
List<DocumentModel>
getWorkflowInputDocuments(CoreSession session, Task task)
Gets the documents following the workflow to which the given task belongsvoid
grantPermissionToTaskAssignees(CoreSession session, String permission, List<DocumentModel> docs, Task task)
Grants on these documents the specified assignees permissions for this task.void
grantPermissionToTaskDelegatedActors(CoreSession session, String permission, List<DocumentModel> docs, Task task)
Grants on these documents the specified assignees permissions for this task to the tasks delegated actors.void
importAllRouteModels(CoreSession session)
Imports all the route models resource templates.DocumentRoute
importRouteModel(URL modelToImport, boolean overwrite, CoreSession session)
Creates a route model in the root models folder defined by the current persister.void
invalidateRouteModelsCache()
boolean
isLockedByCurrentUser(DocumentRoute routeModel, CoreSession session)
Verify is thisDocumentRoute
is already locked by the current user.boolean
isRoutable(DocumentModel doc)
Checks if the given document can be associated to a DocumentRoute.boolean
isWorkflowModel(DocumentRoute documentRoute)
Returns true id the document route is a model, false if it is just an instance i.e.void
lockDocumentRoute(DocumentRoute routeModel, CoreSession session)
Locks thisDocumentRoute
if not already locked by the current user.void
makeRoutingTasks(CoreSession coreSession, List<Task> tasks)
Deprecated.protected void
prepareAndFireEvent(Serializable actors, DocumentRoutingConstants.Events event, String comment, CoreSession session, Task task, GraphRoute routeInstance)
protected void
processElementsInFolder(DocumentModel doc, List<DocumentRouteTableElement> elements, RouteTable table, CoreSession session, int depth, RouteFolderElement folder)
Deprecated.since 5.9.2 - Use only routes of type 'graph'boolean
purgeDocumentRoute(CoreSession session, DocumentRoute route)
Remove the workflow instance if it is canceled, done or orphan.void
reassignTask(CoreSession s, String taskId, List<String> actors, String comment)
Reassigns the given task to the list of actors.void
registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
void
registerRouteResource(RouteModelResourceType res, RuntimeContext context)
Registers a new route model template to be imported at application startup.void
removePermissionFromTaskAssignees(CoreSession s, List<DocumentModel> docs, Task task)
Removes on these documents the specified assignees permissions for this task.void
removePermissionsForTaskActors(CoreSession s, List<DocumentModel> docs, String taskId)
Removes on these documents the specified assignees permissions for the task actors and also tasks delegated actors if this task was delegatedvoid
removePermissionsForTaskActors(CoreSession session, List<DocumentModel> docs, Task task)
Removes on these documents the specified assignees permissions for the task actors and also tasks delegated actors if this task was delegatedvoid
removeRouteElement(DocumentRouteElement routeElement, CoreSession session)
Remove the given route elementvoid
resumeInstance(String routeId, String nodeId, Map<String,Object> data, String status, CoreSession session)
Resumes a route instance on a give node.DocumentRoute
saveRouteAsNewModel(DocumentRoute instance, CoreSession session)
Save a route instance as a new model of route.List<DocumentModel>
searchRouteModels(CoreSession session, String searchString)
Returns the route models matching thesearchString
.protected void
setAclForActors(CoreSession s, String aclName, String permission, List<DocumentModel> docs, List<String> actors)
void
start(ComponentContext context)
Start the component.void
startInstance(String routeInstanceId, List<String> docIds, Map<String,Serializable> map, CoreSession s)
Starts an instance that was created withDocumentRoutingService.createNewInstance(java.lang.String, java.util.List<java.lang.String>, java.util.Map<java.lang.String, java.io.Serializable>, org.nuxeo.ecm.core.api.CoreSession, boolean)
but withstartInstance = false
.void
unlockDocumentRoute(DocumentRoute routeModel, CoreSession session)
Unlocks thisDocumentRoute
.If the document is not locked throws aDocumentRouteNotLockedException
DocumentRoute
unlockDocumentRouteUnrestrictedSession(DocumentRoute routeModel, CoreSession userSession)
Unlock the givenDocumentRoute
model under unrestricted session.void
unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
void
updateRouteElement(DocumentRouteElement routeElement, CoreSession session)
Update the given route elementprotected void
updateTaskInfo(CoreSession session, GraphRoute graph, Task task, String status)
DocumentRoute
validateRouteModel(DocumentRoute routeModel, CoreSession userSession)
Validates the givenDocumentRoute
model by changing its lifecycle state and setting it and all its children in ReadOnly.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, stop, unregister, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
CHAINS_TO_TYPE_XP
public static final String CHAINS_TO_TYPE_XP
- See Also:
- Constant Field Values
-
PERSISTER_XP
public static final String PERSISTER_XP
- See Also:
- Constant Field Values
-
ACTOR_ACE_CREATOR
public static final String ACTOR_ACE_CREATOR
- Since:
- 7.10
- See Also:
- Constant Field Values
-
ROUTE_MODELS_IMPORTER_XP
public static final String ROUTE_MODELS_IMPORTER_XP
- See Also:
- Constant Field Values
-
WORKFLOW_MODELS_CACHE
protected static final String WORKFLOW_MODELS_CACHE
- Since:
- 11.5
- See Also:
- Constant Field Values
-
persister
protected DocumentRoutingPersister persister
-
routeResourcesRegistry
protected RouteTemplateResourceRegistry routeResourcesRegistry
-
repositoryInitializationHandler
protected RepositoryInitializationHandler repositoryInitializationHandler
-
-
Method Detail
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContribution
in classDefaultComponent
-
fireEvent
protected static void fireEvent(String eventName, Map<String,Serializable> eventProperties, DocumentRoute route, CoreSession session)
-
createNewInstance
public String createNewInstance(String routeModelId, List<String> docIds, Map<String,Serializable> map, CoreSession s, boolean startInstance)
Description copied from interface:DocumentRoutingService
Creates a new route instance and optionally starts it.If
startInstance = false
, then the route can be started later by callingDocumentRoutingService.startInstance(java.lang.String, java.util.List<java.lang.String>, java.util.Map<java.lang.String, java.io.Serializable>, org.nuxeo.ecm.core.api.CoreSession)
.- Specified by:
createNewInstance
in interfaceDocumentRoutingService
- Parameters:
routeModelId
- the route model iddocIds
- the list of document bound to the instancemap
- the values to pass as initial workflow variabless
- the sessionstartInstance
- if the route is automatically started- Returns:
- the created route instance id
-
createNewInstance
public String createNewInstance(String routeModelId, List<String> docIds, CoreSession session, boolean startInstance)
Description copied from interface:DocumentRoutingService
Creates a new route instance and optionally starts it.If
startInstance = false
, then the route can be started later by callingDocumentRoutingService.startInstance(java.lang.String, java.util.List<java.lang.String>, java.util.Map<java.lang.String, java.io.Serializable>, org.nuxeo.ecm.core.api.CoreSession)
.- Specified by:
createNewInstance
in interfaceDocumentRoutingService
- Parameters:
routeModelId
- the route model iddocIds
- The list of document bound to the instance.session
- the sessionstartInstance
- if the route is automatically started- Returns:
- the created route instance id
-
createNewInstance
public DocumentRoute createNewInstance(DocumentRoute model, List<String> docIds, CoreSession session, boolean startInstance)
Description copied from interface:DocumentRoutingService
Create a newDocumentRoute
instance from thisDocumentRoute
model.- Specified by:
createNewInstance
in interfaceDocumentRoutingService
- Parameters:
model
- The model used to create the instance.docIds
- The list of document bound to the instance.startInstance
- if theDocumentRoute
is automatically started.- Returns:
- the created
DocumentRoute
instance.
-
createNewInstance
@Deprecated public DocumentRoute createNewInstance(DocumentRoute model, String documentId, CoreSession session, boolean startInstance)
Deprecated.- Specified by:
createNewInstance
in interfaceDocumentRoutingService
-
createNewInstance
@Deprecated public DocumentRoute createNewInstance(DocumentRoute model, List<String> documentIds, CoreSession session)
Deprecated.- Specified by:
createNewInstance
in interfaceDocumentRoutingService
-
createNewInstance
@Deprecated public DocumentRoute createNewInstance(DocumentRoute model, String documentId, CoreSession session)
Deprecated.- Specified by:
createNewInstance
in interfaceDocumentRoutingService
-
startInstance
public void startInstance(String routeInstanceId, List<String> docIds, Map<String,Serializable> map, CoreSession s)
Description copied from interface:DocumentRoutingService
Starts an instance that was created withDocumentRoutingService.createNewInstance(java.lang.String, java.util.List<java.lang.String>, java.util.Map<java.lang.String, java.io.Serializable>, org.nuxeo.ecm.core.api.CoreSession, boolean)
but withstartInstance = false
.- Specified by:
startInstance
in interfaceDocumentRoutingService
- Parameters:
routeInstanceId
- the route instance iddocIds
- the list of document bound to the instancemap
- the values to pass as initial workflow variabless
- the session
-
fireEventAfterWorkflowStarted
protected void fireEventAfterWorkflowStarted(DocumentRoute route, CoreSession session)
-
resumeInstance
public void resumeInstance(String routeId, String nodeId, Map<String,Object> data, String status, CoreSession session)
Description copied from interface:DocumentRoutingService
Resumes a route instance on a give node. Any remaining tasks on this node will be cancelled.Called by the UI action corresponding to a task button.
If all attached documents of the workflow instance have been deleted then the workflow is cancelled.
- Specified by:
resumeInstance
in interfaceDocumentRoutingService
- Parameters:
routeId
- the id of the route instancenodeId
- the node id to resume ondata
- the data coming from UI formstatus
- the status coming from UI formsession
- the session
-
completeTask
public void completeTask(String routeId, String taskId, Map<String,Object> data, String status, CoreSession session)
Description copied from interface:DocumentRoutingService
Completes a task on a give node. If this is the last task the workflow will continue.Called by the UI action corresponding to a task button.
- Specified by:
completeTask
in interfaceDocumentRoutingService
- Parameters:
routeId
- the id of the route instancetaskId
- the id of the taskdata
- the data coming from UI formstatus
- the status coming from UI formsession
- the session
-
completeTask
protected void completeTask(String routeId, String nodeId, Task task, Map<String,Object> data, String status, CoreSession session)
-
getAvailableDocumentRouteModel
public List<DocumentRoute> getAvailableDocumentRouteModel(CoreSession session)
Description copied from interface:DocumentRoutingService
Return the list of availableDocumentRoute
model the user can start.- Specified by:
getAvailableDocumentRouteModel
in interfaceDocumentRoutingService
- Parameters:
session
- The session of the user.- Returns:
- A list of available
DocumentRoute
-
getAvailableDocumentRoute
public List<DocumentRoute> getAvailableDocumentRoute(CoreSession session)
Description copied from interface:DocumentRoutingService
Return the list of availableDocumentRoute
document route.- Specified by:
getAvailableDocumentRoute
in interfaceDocumentRoutingService
- Parameters:
session
- The session of the user.- Returns:
- A list of available
DocumentRoute
-
getOperationChainId
public String getOperationChainId(String documentType)
Description copied from interface:DocumentRoutingService
Return the operation chain to run for a documentType. The document type should extend the DocumentRouteStep. Use thechainsToType
extension point to contribute new mapping.- Specified by:
getOperationChainId
in interfaceDocumentRoutingService
- Parameters:
documentType
- The document type- Returns:
- The operation chain id.
-
getUndoFromRunningOperationChainId
public String getUndoFromRunningOperationChainId(String documentType)
Description copied from interface:DocumentRoutingService
Return the operation chain to undo a step when the step is in running state. The document type should extend the DocumentRouteStep. Use thechainsToType
extension point to contribute new mapping.- Specified by:
getUndoFromRunningOperationChainId
in interfaceDocumentRoutingService
-
getUndoFromDoneOperationChainId
public String getUndoFromDoneOperationChainId(String documentType)
Description copied from interface:DocumentRoutingService
Return the operation chain to undo a step when the step is in done state. The document type should extend the DocumentRouteStep. Use thechainsToType
extension point to contribute new mapping.- Specified by:
getUndoFromDoneOperationChainId
in interfaceDocumentRoutingService
-
unlockDocumentRouteUnrestrictedSession
public DocumentRoute unlockDocumentRouteUnrestrictedSession(DocumentRoute routeModel, CoreSession userSession)
Description copied from interface:DocumentRoutingService
Unlock the givenDocumentRoute
model under unrestricted session.- Specified by:
unlockDocumentRouteUnrestrictedSession
in interfaceDocumentRoutingService
- Returns:
- The unlocked route.
-
validateRouteModel
public DocumentRoute validateRouteModel(DocumentRoute routeModel, CoreSession userSession) throws DocumentRouteNotLockedException
Description copied from interface:DocumentRoutingService
Validates the givenDocumentRoute
model by changing its lifecycle state and setting it and all its children in ReadOnly.- Specified by:
validateRouteModel
in interfaceDocumentRoutingService
- Returns:
- The validated route.
- Throws:
DocumentRouteNotLockedException
-
getRouteElements
@Deprecated public List<DocumentRouteTableElement> getRouteElements(DocumentRoute route, CoreSession session)
Deprecated.since 5.9.2 - Use only routes of type 'graph'Description copied from interface:DocumentRoutingService
Computes the list of elementsDocumentRouteTableElement
for thisDocumentRoute
.- Specified by:
getRouteElements
in interfaceDocumentRoutingService
- Parameters:
route
-DocumentRoute
.session
- The session used to query theDocumentRoute
.
-
processElementsInFolder
@Deprecated protected void processElementsInFolder(DocumentModel doc, List<DocumentRouteTableElement> elements, RouteTable table, CoreSession session, int depth, RouteFolderElement folder)
Deprecated.since 5.9.2 - Use only routes of type 'graph'
-
getRouteElements
@Deprecated protected List<DocumentRouteTableElement> getRouteElements(DocumentRouteElement routeElementDocument, CoreSession session, List<DocumentRouteTableElement> routeElements, int depth)
Deprecated.
-
getDocumentRoutesForAttachedDocument
public List<DocumentRoute> getDocumentRoutesForAttachedDocument(CoreSession session, String attachedDocId)
- Specified by:
getDocumentRoutesForAttachedDocument
in interfaceDocumentRoutingService
- See Also:
for route running or ready.
-
getDocumentRoutesForAttachedDocument
public List<DocumentRoute> getDocumentRoutesForAttachedDocument(CoreSession session, String attachedDocId, List<DocumentRouteElement.ElementLifeCycleState> states)
Description copied from interface:DocumentRoutingService
Return the list of relatedDocumentRoute
in a state for a given attached document.- Specified by:
getDocumentRoutesForAttachedDocument
in interfaceDocumentRoutingService
- Parameters:
session
- The session used to query theDocumentRoute
.states
- the list of states.- Returns:
- A list of available
DocumentRoute
-
canUserValidateRoute
public boolean canUserValidateRoute(NuxeoPrincipal currentUser)
Description copied from interface:DocumentRoutingService
if the user can validate a route.- Specified by:
canUserValidateRoute
in interfaceDocumentRoutingService
-
canValidateRoute
public boolean canValidateRoute(DocumentModel documentRoute, CoreSession coreSession)
Description copied from interface:DocumentRoutingService
Checks if the principal that created the client session can validate the route- Specified by:
canValidateRoute
in interfaceDocumentRoutingService
-
addRouteElementToRoute
@Deprecated public void addRouteElementToRoute(DocumentRef parentDocumentRef, int idx, DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException
Deprecated.Description copied from interface:DocumentRoutingService
Add a route element in another route element.- Specified by:
addRouteElementToRoute
in interfaceDocumentRoutingService
- Parameters:
parentDocumentRef
- The DocumentRef of the parent document.idx
- The position of the document in its container.routeElement
- The document to add.- Throws:
DocumentRouteNotLockedException
-
addRouteElementToRoute
@Deprecated public void addRouteElementToRoute(DocumentRef parentDocumentRef, String sourceName, DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException
Deprecated.Description copied from interface:DocumentRoutingService
Add a route element in another route element.If the parent element is in draft state, the routeElement is kept in draft state. Otherwise, the element is set to 'ready' state.
- Specified by:
addRouteElementToRoute
in interfaceDocumentRoutingService
- Parameters:
parentDocumentRef
- The DocumentRef of the parent document.sourceName
- the name of the previous document in the container.routeElement
- the document to add.- Throws:
DocumentRouteNotLockedException
-
removeRouteElement
public void removeRouteElement(DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException
Description copied from interface:DocumentRoutingService
Remove the given route element- Specified by:
removeRouteElement
in interfaceDocumentRoutingService
- Throws:
DocumentRouteNotLockedException
-
getOrderedRouteElement
public DocumentModelList getOrderedRouteElement(String routeElementId, CoreSession session)
Description copied from interface:DocumentRoutingService
Get the children of the given stepFolder ordered by the ecm:pos metadata.- Specified by:
getOrderedRouteElement
in interfaceDocumentRoutingService
-
lockDocumentRoute
public void lockDocumentRoute(DocumentRoute routeModel, CoreSession session) throws DocumentRouteAlredayLockedException
Description copied from interface:DocumentRoutingService
Locks thisDocumentRoute
if not already locked by the current user. If the document is already locked by another user andDocumentRouteAlredayLockedException
is thrown- Specified by:
lockDocumentRoute
in interfaceDocumentRoutingService
session
- The session used to lock theDocumentRoute
.- Throws:
DocumentRouteAlredayLockedException
-
unlockDocumentRoute
public void unlockDocumentRoute(DocumentRoute routeModel, CoreSession session) throws DocumentRouteNotLockedException
Description copied from interface:DocumentRoutingService
Unlocks thisDocumentRoute
.If the document is not locked throws aDocumentRouteNotLockedException
- Specified by:
unlockDocumentRoute
in interfaceDocumentRoutingService
session
- The session used to lock theDocumentRoute
.- Throws:
DocumentRouteNotLockedException
-
isLockedByCurrentUser
public boolean isLockedByCurrentUser(DocumentRoute routeModel, CoreSession session)
Description copied from interface:DocumentRoutingService
Verify is thisDocumentRoute
is already locked by the current user.- Specified by:
isLockedByCurrentUser
in interfaceDocumentRoutingService
-
updateRouteElement
public void updateRouteElement(DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException
Description copied from interface:DocumentRoutingService
Update the given route element- Specified by:
updateRouteElement
in interfaceDocumentRoutingService
- Throws:
DocumentRouteNotLockedException
-
saveRouteAsNewModel
public DocumentRoute saveRouteAsNewModel(DocumentRoute instance, CoreSession session)
Description copied from interface:DocumentRoutingService
Save a route instance as a new model of route.The place in which the new instance is persisted and its name depends on
DocumentRoutingPersister
. The route instance should be in either running, done or ready state. The new route model will be in draft state and won't have any attached documents.- Specified by:
saveRouteAsNewModel
in interfaceDocumentRoutingService
- Parameters:
instance
- the instance from which we create a new model.- Returns:
- the new model in draft state.
-
isRoutable
public boolean isRoutable(DocumentModel doc)
Description copied from interface:DocumentRoutingService
Checks if the given document can be associated to a DocumentRoute.- Specified by:
isRoutable
in interfaceDocumentRoutingService
- Parameters:
doc
- the document- Returns:
true
if the document can be routed
-
importAllRouteModels
public void importAllRouteModels(CoreSession session)
Description copied from interface:DocumentRoutingService
Imports all the route models resource templates.- Specified by:
importAllRouteModels
in interfaceDocumentRoutingService
- Parameters:
session
- the core session to use
-
importRouteModel
public DocumentRoute importRouteModel(URL modelToImport, boolean overwrite, CoreSession session)
Description copied from interface:DocumentRoutingService
Creates a route model in the root models folder defined by the current persister. The templateResource is a zip tree xml export of a route document and it is imported using the core-io importer.- Specified by:
importRouteModel
in interfaceDocumentRoutingService
-
getFileManager
protected FileManager getFileManager()
-
activate
public void activate(ComponentContext context)
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
start
public void start(ComponentContext context)
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
deactivate
public void deactivate(ComponentContext context)
Description copied from interface:Component
Deactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivate
in interfaceComponent
- Overrides:
deactivate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
getRouteModelTemplateResources
public List<URL> getRouteModelTemplateResources()
Description copied from interface:DocumentRoutingService
Returns all the route models resource templates. Use therouteModelImporter
extension point to contribute new resources.- Specified by:
getRouteModelTemplateResources
in interfaceDocumentRoutingService
-
searchRouteModels
public List<DocumentModel> searchRouteModels(CoreSession session, String searchString)
Description copied from interface:DocumentRoutingService
Returns the route models matching thesearchString
.- Specified by:
searchRouteModels
in interfaceDocumentRoutingService
-
registerRouteResource
public void registerRouteResource(RouteModelResourceType res, RuntimeContext context)
Description copied from interface:DocumentRoutingService
Registers a new route model template to be imported at application startup.- Specified by:
registerRouteResource
in interfaceDocumentRoutingService
- Parameters:
res
- the resource
-
getUrlFromPath
protected URL getUrlFromPath(RouteModelResourceType res, RuntimeContext extensionContext)
-
getRouteModelWithId
public DocumentRoute getRouteModelWithId(CoreSession session, String id)
Description copied from interface:DocumentRoutingService
Returns the route model with the given id- Specified by:
getRouteModelWithId
in interfaceDocumentRoutingService
-
getRouteModelDocIdWithId
public String getRouteModelDocIdWithId(CoreSession session, String id)
Description copied from interface:DocumentRoutingService
Returns the doc id of the route model with the given id- Specified by:
getRouteModelDocIdWithId
in interfaceDocumentRoutingService
-
makeRoutingTasks
@Deprecated public void makeRoutingTasks(CoreSession coreSession, List<Task> tasks)
Deprecated.Description copied from interface:DocumentRoutingService
Marks the tasks as Routing tasks.This allows the related documents to be adapted to
RoutingTask
.- Specified by:
makeRoutingTasks
in interfaceDocumentRoutingService
- Parameters:
coreSession
- the sessiontasks
- the tasks
-
endTask
public void endTask(CoreSession session, Task task, Map<String,Object> data, String status)
Description copied from interface:DocumentRoutingService
Ends a task. If this is the last task the workflow will continue.- Specified by:
endTask
in interfaceDocumentRoutingService
status
- name of the button clicked to submit the task form
-
getWorkflowInputDocuments
public List<DocumentModel> getWorkflowInputDocuments(CoreSession session, Task task)
Description copied from interface:DocumentRoutingService
Gets the documents following the workflow to which the given task belongs- Specified by:
getWorkflowInputDocuments
in interfaceDocumentRoutingService
-
grantPermissionToTaskAssignees
public void grantPermissionToTaskAssignees(CoreSession session, String permission, List<DocumentModel> docs, Task task)
Description copied from interface:DocumentRoutingService
Grants on these documents the specified assignees permissions for this task.- Specified by:
grantPermissionToTaskAssignees
in interfaceDocumentRoutingService
- Parameters:
session
- the sessionpermission
- the permissiondocs
- the documentstask
- the task
-
grantPermissionToTaskDelegatedActors
public void grantPermissionToTaskDelegatedActors(CoreSession session, String permission, List<DocumentModel> docs, Task task)
Description copied from interface:DocumentRoutingService
Grants on these documents the specified assignees permissions for this task to the tasks delegated actors.- Specified by:
grantPermissionToTaskDelegatedActors
in interfaceDocumentRoutingService
- Parameters:
session
- the sessionpermission
- the permissiondocs
- the documentstask
- the task
-
removePermissionFromTaskAssignees
public void removePermissionFromTaskAssignees(CoreSession s, List<DocumentModel> docs, Task task)
Description copied from interface:DocumentRoutingService
Removes on these documents the specified assignees permissions for this task.- Specified by:
removePermissionFromTaskAssignees
in interfaceDocumentRoutingService
- Parameters:
s
- the sessiondocs
- the documentstask
- the task
-
removePermissionsForTaskActors
public void removePermissionsForTaskActors(CoreSession s, List<DocumentModel> docs, String taskId)
Description copied from interface:DocumentRoutingService
Removes on these documents the specified assignees permissions for the task actors and also tasks delegated actors if this task was delegated- Specified by:
removePermissionsForTaskActors
in interfaceDocumentRoutingService
- Parameters:
s
- the sessiondocs
- the documentstaskId
- the taskId- Since:
- 7.4
-
removePermissionsForTaskActors
public void removePermissionsForTaskActors(CoreSession session, List<DocumentModel> docs, Task task)
Description copied from interface:DocumentRoutingService
Removes on these documents the specified assignees permissions for the task actors and also tasks delegated actors if this task was delegated- Specified by:
removePermissionsForTaskActors
in interfaceDocumentRoutingService
- Parameters:
session
- the sessiondocs
- the documentstask
- the task
-
getRoutingACLName
protected static String getRoutingACLName(Task task)
Finds an ACL name specific to the task (there may be several tasks applying permissions to the same document).
-
purgeDocumentRoute
public boolean purgeDocumentRoute(CoreSession session, DocumentRoute route)
Description copied from interface:DocumentRoutingService
Remove the workflow instance if it is canceled, done or orphan. An orphan instance has all its attached document already removed.- Specified by:
purgeDocumentRoute
in interfaceDocumentRoutingService
- Returns:
- true if the route has been deleted, false otherwise
-
finishTask
public void finishTask(CoreSession session, DocumentRoute route, Task task, boolean delete) throws DocumentRouteException
Description copied from interface:DocumentRoutingService
Finishes an open task. All permissions granted to the tasks assignees on the document following the worklflow are removed. Doesn't resume the workflow as thecompleteTask
method. Not executed using an unrestricted session.- Specified by:
finishTask
in interfaceDocumentRoutingService
- Throws:
DocumentRouteException
-
cancelTask
public void cancelTask(CoreSession s, String taskId) throws DocumentRouteException
Description copied from interface:DocumentRoutingService
Cancels an open task. If the task was created by an workflow, all permissions granted to the tasks assignees on the document following the worklflow are removed. Doesn't resume the workflow as thecompleteTask
method.- Specified by:
cancelTask
in interfaceDocumentRoutingService
- Throws:
DocumentRouteException
-
updateTaskInfo
protected void updateTaskInfo(CoreSession session, GraphRoute graph, Task task, String status)
-
reassignTask
public void reassignTask(CoreSession s, String taskId, List<String> actors, String comment) throws DocumentRouteException
Description copied from interface:DocumentRoutingService
Reassigns the given task to the list of actors. Removes the permissions granted on the document following the workflow to the current task assignees and grants them to the new actors.- Specified by:
reassignTask
in interfaceDocumentRoutingService
- Throws:
DocumentRouteException
-
prepareAndFireEvent
protected void prepareAndFireEvent(Serializable actors, DocumentRoutingConstants.Events event, String comment, CoreSession session, Task task, GraphRoute routeInstance)
-
getWorkflowContextualInfo
protected Map<String,Serializable> getWorkflowContextualInfo(CoreSession session, Task item)
-
delegateTask
public void delegateTask(CoreSession s, String taskId, List<String> delegatedActors, String comment) throws DocumentRouteException
Description copied from interface:DocumentRoutingService
Reassigns the given task to the list of actors. Grants to new delegated actors the same permissions as the task assignees on the document following the workflow .- Specified by:
delegateTask
in interfaceDocumentRoutingService
- Throws:
DocumentRouteException
-
setAclForActors
protected void setAclForActors(CoreSession s, String aclName, String permission, List<DocumentModel> docs, List<String> actors)
-
cleanupDoneAndCanceledRouteInstances
@Deprecated public void cleanupDoneAndCanceledRouteInstances(String reprositoryName, int limit)
Deprecated.Description copied from interface:DocumentRoutingService
Query for the routes 'done' or 'canceled' and delete them. The max no of the routes that will be deleted is specified by the 'limit' parameter. When the limit is '0' all the completed routes are deleted.- Specified by:
cleanupDoneAndCanceledRouteInstances
in interfaceDocumentRoutingService
-
cleanupRouteInstances
public void cleanupRouteInstances(String reprositoryName)
Description copied from interface:DocumentRoutingService
Remove the routes in state 'done' or 'canceled' of the given repository.If 'nuxeo.routing.cleanup.workflow.instances.orphan' framework property is set to true, orphan routes (for which all associated documents have been removed) will also be removed.
- Specified by:
cleanupRouteInstances
in interfaceDocumentRoutingService
- Parameters:
reprositoryName
- the repository name to clean up
-
doCleanupDoneAndCanceledRouteInstances
@Deprecated public int doCleanupDoneAndCanceledRouteInstances(String reprositoryName, int limit)
Deprecated.Description copied from interface:DocumentRoutingService
Query for the routes 'done' or 'canceled' and delete them. The max no of the routes that will be deleted is specified by the 'limit' parameter. When the limit is '0' all the completed routes are deleted. The routes to be deleted are ordered ascending by their creation date.- Specified by:
doCleanupDoneAndCanceledRouteInstances
in interfaceDocumentRoutingService
- Returns:
- always -1
-
invalidateRouteModelsCache
public void invalidateRouteModelsCache()
- Specified by:
invalidateRouteModelsCache
in interfaceDocumentRoutingService
-
getTasks
@Deprecated public List<Task> getTasks(DocumentModel document, String actorId, String workflowInstanceId, String worflowModelName, CoreSession s)
Deprecated.since 11.1 this method does not scale as it does not paginate results. UseRoutingTaskPageProvider.getCurrentPage()
instead.- Specified by:
getTasks
in interfaceDocumentRoutingService
- Since:
- 7.2
-
getDocumentRelatedWorkflows
public List<DocumentRoute> getDocumentRelatedWorkflows(DocumentModel document, CoreSession session)
- Specified by:
getDocumentRelatedWorkflows
in interfaceDocumentRoutingService
- Since:
- 7.2
-
getRunningWorkflowInstancesLaunchedByCurrentUser
public List<DocumentRoute> getRunningWorkflowInstancesLaunchedByCurrentUser(CoreSession session)
- Specified by:
getRunningWorkflowInstancesLaunchedByCurrentUser
in interfaceDocumentRoutingService
- Since:
- 7.2
-
getRunningWorkflowInstancesLaunchedByCurrentUser
public List<DocumentRoute> getRunningWorkflowInstancesLaunchedByCurrentUser(CoreSession session, String worflowModelName)
- Specified by:
getRunningWorkflowInstancesLaunchedByCurrentUser
in interfaceDocumentRoutingService
- Since:
- 7.2
-
isWorkflowModel
public boolean isWorkflowModel(DocumentRoute documentRoute)
Returns true id the document route is a model, false if it is just an instance i.e. a running workflow.- Specified by:
isWorkflowModel
in interfaceDocumentRoutingService
- Since:
- 7.2
-
canCreateInstance
public boolean canCreateInstance(CoreSession session, List<String> documentIds, String workflowModelName)
Description copied from interface:DocumentRoutingService
Returnstrue
if the workflow model can be started on the document list.- Specified by:
canCreateInstance
in interfaceDocumentRoutingService
-
getRunnableWorkflows
public List<DocumentRoute> getRunnableWorkflows(CoreSession session, List<String> documentIds)
Description copied from interface:DocumentRoutingService
Returns a list of runnable document routes for the input document IDs.- Specified by:
getRunnableWorkflows
in interfaceDocumentRoutingService
-
-