How to directly change lifecycle state
Before our customers can work with Nuxeo DM we must import all the xml files and set them to a lifecycle state which is not the initial state. How can we do it ?
We tried setting the property ecm:currentLifeCycleState and using followTransition method but without any success (exceptions encountered).
When creating a document through the
CoreSession.createDocument(DocumentModel) method, you can set in the
DocumentModel context data an indication of which initial lifecycle state it should be in instead of the default.
BUT note that this is only possible for lifecycle states that have been marked as
initial="true" in the lifecycle state definition.
CoreSession expose the following method: reinitLifeCycleState that move the document to the initial state. Lifecycle is specifically design to manage it through available transitions.
But for mass import I suggest you to use our framework for import explain here. The github repository is here and you can look the project that is well explained.
You can create importer with the number of thread and the frequency for committing , etc…
Hope this will help.