public class DocumentRoutingServiceImpl extends DefaultComponent implements DocumentRoutingService
Modifier and Type | Field and Description |
---|---|
static String |
CHAINS_TO_TYPE_XP |
static String |
PERSISTER_XP |
static String |
ROUTE_MODELS_IMPORTER_XP |
Constructor and Description |
---|
DocumentRoutingServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
activate(ComponentContext context)
Activates the component.
|
void |
addRouteElementToRoute(DocumentRef parentDocumentRef,
int idx,
DocumentRouteElement routeElement,
CoreSession session)
Add a route element in another route element.
|
void |
addRouteElementToRoute(DocumentRef parentDocumentRef,
String sourceName,
DocumentRouteElement routeElement,
CoreSession session)
Add a route element in another route element.
|
void |
cancelTask(CoreSession session,
String taskId)
Cancels an open task.
|
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
route
|
void |
cleanupDoneAndCanceledRouteInstances(String reprositoryName,
int limit)
Query for the routes 'done' or 'canceled' and delete them.
|
void |
completeTask(String routeId,
String taskId,
Map<String,Object> data,
String status,
CoreSession session)
Completes a task on a give node.
|
DocumentRoute |
createNewInstance(DocumentRoute model,
List<String> documentIds,
CoreSession session)
Deprecated.
|
DocumentRoute |
createNewInstance(DocumentRoute model,
List<String> docIds,
CoreSession session,
boolean startInstance)
Create a new
DocumentRoute instance from this
DocumentRoute model. |
DocumentRoute |
createNewInstance(DocumentRoute model,
String documentId,
CoreSession session)
Deprecated.
|
DocumentRoute |
createNewInstance(DocumentRoute model,
String documentId,
CoreSession session,
boolean startInstance)
Deprecated.
|
String |
createNewInstance(String routeModelId,
List<String> docIds,
CoreSession session,
boolean startInstance)
Creates a new route instance and optionally starts it.
|
String |
createNewInstance(String routeModelId,
List<String> docIds,
Map<String,Serializable> map,
CoreSession session,
boolean startInstance)
Creates a new route instance and optionally starts it.
|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
void |
delegateTask(CoreSession session,
String taskId,
List<String> delegatedActors,
String comment)
Reassigns the given task to the list of actors.
|
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.
|
List<DocumentRoute> |
getAvailableDocumentRouteModel(CoreSession session)
Return the list of available
DocumentRoute model the user can
start. |
List<DocumentRoute> |
getDocumentRoutesForAttachedDocument(CoreSession session,
String attachedDocId) |
List<DocumentRoute> |
getDocumentRoutesForAttachedDocument(CoreSession session,
String attachedDocId,
List<DocumentRouteElement.ElementLifeCycleState> states)
Return the list of related
DocumentRoute in a state for a given
attached document. |
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.
|
List<DocumentRouteTableElement> |
getRouteElements(DocumentRoute route,
CoreSession session)
Computes the list of elements
DocumentRouteTableElement for this
DocumentRoute . |
String |
getRouteModelDocIdWithId(CoreSession session,
String id)
Returns the doc id of the route model with the given id
|
List<URL> |
getRouteModelTemplateResources()
Returns all the route models resource templates.
|
DocumentRoute |
getRouteModelWithId(CoreSession session,
String id)
Returns the route model with the given id
|
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.
|
List<DocumentModel> |
getWorkflowInputDocuments(CoreSession session,
Task task)
Gets the documents following the workflow to which the given task belongs
|
void |
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.
|
DocumentRoute |
importRouteModel(URL modelToImport,
boolean overwrite,
CoreSession session)
Creates a route model in the root models folder defined by the current
persister.
|
boolean |
isLockedByCurrentUser(DocumentRoute routeModel,
CoreSession session)
Verify is this
DocumentRoute is already locked by the current
user. |
boolean |
isRoutable(DocumentModel doc)
Checks if the given document can be associated to a DocumentRoute.
|
void |
lockDocumentRoute(DocumentRoute routeModel,
CoreSession session)
Locks this
DocumentRoute if not already locked by the current
user. |
void |
makeRoutingTasks(CoreSession coreSession,
List<Task> tasks)
Marks the tasks as Routing tasks.
|
void |
reassignTask(CoreSession session,
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 session,
List<DocumentModel> docs,
Task task)
Removes on these documents the specified assignees permissions for this
task.
|
void |
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 delegated
|
void |
removeRouteElement(DocumentRouteElement routeElement,
CoreSession session)
Remove the given route element
|
void |
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 the
searchString . |
void |
startInstance(String routeInstanceId,
List<String> docIds,
Map<String,Serializable> map,
CoreSession session)
Starts an instance that was created with
DocumentRoutingService.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
with startInstance = false . |
void |
unlockDocumentRoute(DocumentRoute routeModel,
CoreSession session)
Unlocks this
DocumentRoute .If the document is not locked throws a
DocumentRouteNotLockedException |
DocumentRoute |
unlockDocumentRouteUnrestrictedSession(DocumentRoute routeModel,
CoreSession userSession)
Unlock the given
DocumentRoute model under unrestricted session. |
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
void |
updateRouteElement(DocumentRouteElement routeElement,
CoreSession session)
Update the given route element
|
DocumentRoute |
validateRouteModel(DocumentRoute routeModel,
CoreSession userSession)
Validates the given
DocumentRoute model by changing its lifecycle
state and setting it and all its children in ReadOnly. |
applicationStarted, getAdapter, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, unregisterExtension
public static final String CHAINS_TO_TYPE_XP
public static final String PERSISTER_XP
public static final String ROUTE_MODELS_IMPORTER_XP
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) throws Exception
registerContribution
in class DefaultComponent
Exception
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) throws Exception
unregisterContribution
in class DefaultComponent
Exception
public String createNewInstance(String routeModelId, List<String> docIds, Map<String,Serializable> map, CoreSession session, boolean startInstance)
DocumentRoutingService
If startInstance = false
, then the route can be started later by
calling DocumentRoutingService.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)
.
createNewInstance
in interface DocumentRoutingService
routeModelId
- the route model iddocIds
- the list of document bound to the instancemap
- the values to pass as initial workflow variablessession
- the sessionstartInstance
- if the route is automatically startedpublic String createNewInstance(String routeModelId, List<String> docIds, CoreSession session, boolean startInstance)
DocumentRoutingService
If startInstance = false
, then the route can be started later by
calling DocumentRoutingService.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)
.
createNewInstance
in interface DocumentRoutingService
routeModelId
- the route model iddocIds
- The list of document bound to the instance.session
- the sessionstartInstance
- if the route is automatically startedpublic DocumentRoute createNewInstance(DocumentRoute model, List<String> docIds, CoreSession session, boolean startInstance)
DocumentRoutingService
DocumentRoute
instance from this
DocumentRoute
model.createNewInstance
in interface DocumentRoutingService
model
- The model used to create the instance.docIds
- The list of document bound to the instance.startInstance
- if the DocumentRoute
is automatically
started.DocumentRoute
instance.@Deprecated public DocumentRoute createNewInstance(DocumentRoute model, String documentId, CoreSession session, boolean startInstance)
createNewInstance
in interface DocumentRoutingService
@Deprecated public DocumentRoute createNewInstance(DocumentRoute model, List<String> documentIds, CoreSession session)
createNewInstance
in interface DocumentRoutingService
@Deprecated public DocumentRoute createNewInstance(DocumentRoute model, String documentId, CoreSession session)
createNewInstance
in interface DocumentRoutingService
public void startInstance(String routeInstanceId, List<String> docIds, Map<String,Serializable> map, CoreSession session)
DocumentRoutingService
DocumentRoutingService.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
with startInstance = false
.startInstance
in interface DocumentRoutingService
routeInstanceId
- the route instance iddocIds
- the list of document bound to the instancemap
- the values to pass as initial workflow variablessession
- the sessionpublic void resumeInstance(String routeId, String nodeId, Map<String,Object> data, String status, CoreSession session)
DocumentRoutingService
resumeInstance
in interface DocumentRoutingService
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 sessionpublic void completeTask(String routeId, String taskId, Map<String,Object> data, String status, CoreSession session)
DocumentRoutingService
completeTask
in interface DocumentRoutingService
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 sessionpublic List<DocumentRoute> getAvailableDocumentRouteModel(CoreSession session)
DocumentRoutingService
DocumentRoute
model the user can
start.getAvailableDocumentRouteModel
in interface DocumentRoutingService
session
- The session of the user.DocumentRoute
public String getOperationChainId(String documentType)
DocumentRoutingService
chainsToType
extension point to contribute new mapping.getOperationChainId
in interface DocumentRoutingService
documentType
- The document typepublic String getUndoFromRunningOperationChainId(String documentType)
DocumentRoutingService
chainsToType
extension point to contribute new mapping.getUndoFromRunningOperationChainId
in interface DocumentRoutingService
public String getUndoFromDoneOperationChainId(String documentType)
DocumentRoutingService
chainsToType
extension point to contribute new mapping.getUndoFromDoneOperationChainId
in interface DocumentRoutingService
public DocumentRoute unlockDocumentRouteUnrestrictedSession(DocumentRoute routeModel, CoreSession userSession) throws ClientException
DocumentRoutingService
DocumentRoute
model under unrestricted session.unlockDocumentRouteUnrestrictedSession
in interface DocumentRoutingService
ClientException
public DocumentRoute validateRouteModel(DocumentRoute routeModel, CoreSession userSession) throws DocumentRouteNotLockedException, ClientException
DocumentRoutingService
DocumentRoute
model by changing its lifecycle
state and setting it and all its children in ReadOnly.validateRouteModel
in interface DocumentRoutingService
DocumentRouteNotLockedException
ClientException
public List<DocumentRouteTableElement> getRouteElements(DocumentRoute route, CoreSession session)
DocumentRoutingService
DocumentRouteTableElement
for this
DocumentRoute
.getRouteElements
in interface DocumentRoutingService
session
- The session used to query the DocumentRoute
.public List<DocumentRoute> getDocumentRoutesForAttachedDocument(CoreSession session, String attachedDocId)
getDocumentRoutesForAttachedDocument
in interface DocumentRoutingService
for
route running or ready.
public List<DocumentRoute> getDocumentRoutesForAttachedDocument(CoreSession session, String attachedDocId, List<DocumentRouteElement.ElementLifeCycleState> states)
DocumentRoutingService
DocumentRoute
in a state for a given
attached document.getDocumentRoutesForAttachedDocument
in interface DocumentRoutingService
session
- The session used to query the DocumentRoute
.states
- the list of states.DocumentRoute
public boolean canUserValidateRoute(NuxeoPrincipal currentUser)
DocumentRoutingService
canUserValidateRoute
in interface DocumentRoutingService
public boolean canValidateRoute(DocumentModel documentRoute, CoreSession coreSession) throws ClientException
DocumentRoutingService
canValidateRoute
in interface DocumentRoutingService
ClientException
public void addRouteElementToRoute(DocumentRef parentDocumentRef, int idx, DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException, ClientException
DocumentRoutingService
addRouteElementToRoute
in interface DocumentRoutingService
parentDocumentRef
- The DocumentRef of the parent document.idx
- The position of the document in its container.routeElement
- The document to add.ClientException
DocumentRouteNotLockedException
public void addRouteElementToRoute(DocumentRef parentDocumentRef, String sourceName, DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException, ClientException
DocumentRoutingService
addRouteElementToRoute
in interface DocumentRoutingService
parentDocumentRef
- The DocumentRef of the parent document.sourceName
- the name of the previous document in the container.routeElement
- the document to add.ClientException
DocumentRouteNotLockedException
public void removeRouteElement(DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException, ClientException
DocumentRoutingService
removeRouteElement
in interface DocumentRoutingService
ClientException
DocumentRouteNotLockedException
public DocumentModelList getOrderedRouteElement(String routeElementId, CoreSession session) throws ClientException
DocumentRoutingService
getOrderedRouteElement
in interface DocumentRoutingService
ClientException
public void lockDocumentRoute(DocumentRoute routeModel, CoreSession session) throws DocumentRouteAlredayLockedException, ClientException
DocumentRoutingService
DocumentRoute
if not already locked by the current
user. If the document is already locked by another user and
DocumentRouteAlredayLockedException
is thrownlockDocumentRoute
in interface DocumentRoutingService
session
- The session used to lock the DocumentRoute
.ClientException
DocumentRouteAlredayLockedException
public void unlockDocumentRoute(DocumentRoute routeModel, CoreSession session) throws DocumentRouteNotLockedException, ClientException
DocumentRoutingService
DocumentRoute
.If the document is not locked throws a
DocumentRouteNotLockedException
unlockDocumentRoute
in interface DocumentRoutingService
session
- The session used to lock the DocumentRoute
.DocumentRouteNotLockedException
ClientException
public boolean isLockedByCurrentUser(DocumentRoute routeModel, CoreSession session) throws ClientException
DocumentRoutingService
DocumentRoute
is already locked by the current
user.isLockedByCurrentUser
in interface DocumentRoutingService
ClientException
public void updateRouteElement(DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException, ClientException
DocumentRoutingService
updateRouteElement
in interface DocumentRoutingService
ClientException
DocumentRouteNotLockedException
public DocumentRoute saveRouteAsNewModel(DocumentRoute instance, CoreSession session)
DocumentRoutingService
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.saveRouteAsNewModel
in interface DocumentRoutingService
instance
- the instance from which we create a new model.public boolean isRoutable(DocumentModel doc)
DocumentRoutingService
isRoutable
in interface DocumentRoutingService
doc
- the documenttrue
if the document can be routedpublic DocumentRoute importRouteModel(URL modelToImport, boolean overwrite, CoreSession session) throws ClientException
DocumentRoutingService
importRouteModel
in interface DocumentRoutingService
ClientException
public void activate(ComponentContext context) throws Exception
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextException
- if an error occurs during activationpublic void deactivate(ComponentContext context) throws Exception
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextException
- if an error occurs during activationpublic List<URL> getRouteModelTemplateResources() throws ClientException
DocumentRoutingService
routeModelImporter
extension point to contribute new
resources.getRouteModelTemplateResources
in interface DocumentRoutingService
ClientException
public List<DocumentModel> searchRouteModels(CoreSession session, String searchString) throws ClientException
DocumentRoutingService
searchString
.searchRouteModels
in interface DocumentRoutingService
ClientException
public void registerRouteResource(RouteModelResourceType res, RuntimeContext context)
DocumentRoutingService
registerRouteResource
in interface DocumentRoutingService
res
- the resourcepublic DocumentRoute getRouteModelWithId(CoreSession session, String id) throws ClientException
DocumentRoutingService
getRouteModelWithId
in interface DocumentRoutingService
ClientException
public String getRouteModelDocIdWithId(CoreSession session, String id) throws ClientException
DocumentRoutingService
getRouteModelDocIdWithId
in interface DocumentRoutingService
ClientException
public void makeRoutingTasks(CoreSession coreSession, List<Task> tasks) throws ClientException
DocumentRoutingService
This allows the related documents to be adapted to RoutingTask
.
makeRoutingTasks
in interface DocumentRoutingService
coreSession
- the sessiontasks
- the tasksClientException
public void endTask(CoreSession session, Task task, Map<String,Object> data, String status) throws ClientException
DocumentRoutingService
endTask
in interface DocumentRoutingService
status
- name of the button clicked to submit the task formClientException
public List<DocumentModel> getWorkflowInputDocuments(CoreSession session, Task task) throws ClientException
DocumentRoutingService
getWorkflowInputDocuments
in interface DocumentRoutingService
ClientException
public void grantPermissionToTaskAssignees(CoreSession session, String permission, List<DocumentModel> docs, Task task) throws ClientException
DocumentRoutingService
grantPermissionToTaskAssignees
in interface DocumentRoutingService
session
- the sessionpermission
- the permissiondocs
- the documentstask
- the taskClientException
public void grantPermissionToTaskDelegatedActors(CoreSession session, String permission, List<DocumentModel> docs, Task task) throws ClientException
DocumentRoutingService
grantPermissionToTaskDelegatedActors
in interface DocumentRoutingService
session
- the sessionpermission
- the permissiondocs
- the documentstask
- the taskClientException
public void removePermissionFromTaskAssignees(CoreSession session, List<DocumentModel> docs, Task task) throws ClientException
DocumentRoutingService
removePermissionFromTaskAssignees
in interface DocumentRoutingService
session
- the sessiondocs
- the documentstask
- the taskClientException
public void removePermissionsForTaskActors(CoreSession session, List<DocumentModel> docs, Task task) throws ClientException
DocumentRoutingService
removePermissionsForTaskActors
in interface DocumentRoutingService
session
- the sessiondocs
- the documentstask
- the taskClientException
public void finishTask(CoreSession session, DocumentRoute route, Task task, boolean delete) throws DocumentRouteException
DocumentRoutingService
completeTask
method. Not executed using an
unrestricted session.finishTask
in interface DocumentRoutingService
DocumentRouteException
public void cancelTask(CoreSession session, String taskId) throws DocumentRouteException
DocumentRoutingService
completeTask
method.cancelTask
in interface DocumentRoutingService
DocumentRouteException
public void reassignTask(CoreSession session, String taskId, List<String> actors, String comment) throws DocumentRouteException
DocumentRoutingService
reassignTask
in interface DocumentRoutingService
DocumentRouteException
public void delegateTask(CoreSession session, String taskId, List<String> delegatedActors, String comment) throws DocumentRouteException
DocumentRoutingService
delegateTask
in interface DocumentRoutingService
DocumentRouteException
public void cleanupDoneAndCanceledRouteInstances(String reprositoryName, int limit) throws ClientException
DocumentRoutingService
cleanupDoneAndCanceledRouteInstances
in interface DocumentRoutingService
ClientException
Copyright © 2013 Nuxeo SA. All Rights Reserved.