cancel
Showing results for 
Search instead for 
Did you mean: 

Checkout in a Workflow

bclarke
Champ in-the-making
Champ in-the-making
Hi,
I try to modify a given workflow (lifecycle_definition.xml).
My aim is to extract a working copy of the attached document in the personnal folder of the workflow assignee.
I've modified the following code in lifecycle_definition.xml :

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wfl:lifecycleapproval">
    <swimlane name="initiator" />
    <start-state name="start">
        <task name="wf:submitReviewTask" swimlane="initiator" />
        <event type="node-leave">
            <!– Call script once the workflow package exists i.e. on node-leave –>
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <!– Apply the Workflow Lifecycle Aspect (wfl:status) if not set already. Note: The default wfl:status property is draft –>
                <script>
                    for (var i = 0; i &lt; bpm_package.children.length; i++)
                    {
                       if (!bpm_package.children[i].hasAspect("wfl:status"))
                       {
                          bpm_package.children[i].addAspect("wfl:status");
                          bpm_package.children[i].checkout(bpm_context);
                       }
                    }
I get a org.alfresco.service.cmr.lock.NodeLockedException
The document seems to be locked. Is it possible to unlock it? how?
Does someone can help me?
3 REPLIES 3

seshu
Champ in-the-making
Champ in-the-making
Hi,

try cancelCheckout method. I didn't test it but it should work

bpm_package.children.cancelCheckout (bpm_context);

bclarke
Champ in-the-making
Champ in-the-making
Thank you for the response.
bpm_package.children.cancelCheckout (bpm_context);
returns
org.alfresco.repo.jscript.Node.cancelCheckout(org.alfresco.repo.workflow.jbpm.JBPMNode) method not found

bpm_package.children.cancelCheckout ();
throws an
org.alfresco.repo.security.permissions.AccessDeniedException

How can I manage this permission difficulty?

Thanks

bclarke
Champ in-the-making
Champ in-the-making
I call an Action class in the <event type="node-leave">
In that bean, I use setSystemUserAsCurrentUser() to bypass permissions errors.

It works!