public class DocumentRoutingServiceImpl extends DefaultComponent implements DocumentRoutingService
Modifier and Type | Field and Description |
---|---|
static String |
CHAINS_TO_TYPE_XP |
static String |
PERSISTER_XP |
Constructor and Description |
---|
DocumentRoutingServiceImpl() |
Modifier and Type | Method and Description |
---|---|
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.
|
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
|
DocumentRoute |
createNewInstance(DocumentRoute model,
List<String> documentIds,
CoreSession session) |
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) |
DocumentRoute |
createNewInstance(DocumentRoute model,
String documentId,
CoreSession session,
boolean startInstance) |
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 |
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.
|
boolean |
isLockedByCurrentUser(DocumentRoute routeModel,
CoreSession session)
Verify is this
DocumentRoute is already locked by the current
user. |
void |
lockDocumentRoute(DocumentRoute routeModel,
CoreSession session)
Locks this
DocumentRoute if not already locked by the current
user. |
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
void |
removeRouteElement(DocumentRouteElement routeElement,
CoreSession session)
Remove the given route element
|
DocumentRoute |
saveRouteAsNewModel(DocumentRoute instance,
CoreSession session)
Save a route instance as a new model of route.
|
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 |
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. |
activate, applicationStarted, deactivate, getAdapter, registerExtension, unregisterContribution, unregisterExtension
public static final String CHAINS_TO_TYPE_XP
public static final String PERSISTER_XP
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) throws Exception
registerContribution
in class DefaultComponent
Exception
public 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.startInstance
- if the DocumentRoute
is automatically
started.DocumentRoute
instance.public DocumentRoute createNewInstance(DocumentRoute model, String documentId, CoreSession session, boolean startInstance)
createNewInstance
in interface DocumentRoutingService
with
only one document attached.
public DocumentRoute createNewInstance(DocumentRoute model, List<String> documentIds, CoreSession session)
createNewInstance
in interface DocumentRoutingService
with
startInstance true
public DocumentRoute createNewInstance(DocumentRoute model, String documentId, CoreSession session)
createNewInstance
in interface DocumentRoutingService
with
startInstance true
and only one document attached.
public 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.Copyright © 2011 Nuxeo SA. All Rights Reserved.