AnsweredAssumed Answered

Adding/Removing aspects on document

Question asked by doblek on Jun 8, 2007
Latest reply on Jul 19, 2008 by hogarth503
Hi all,

I'm trying to add (and remove) some custom aspects on a document which is involved in an "approved/rejected workflow"…

So I've modified the "review_processDefinition.xml" (see code below) in order to add the new aspects defined in a new custom model. I think the model is properly registered in the repository (since the aspects are available in the web client), but when I click on "Start Advanced Workflow » Review & Approve", fill out the form displayed and click on "Finish", no aspect is applied to the document. No exception arises, but the workflow behavior is the same as if I would make no modifications… =(

Can anybody tell me where is my error?? Should I import my model from the workflow model??

Any help appreciated.

Regards,
Enrique


PS: here is my new "review_processDefinition.xml"

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:review">

    <swimlane name="initiator" />

    <start-state name="start">
        <task name="wf:submitReviewTask" swimlane="initiator" />
        <transition name="" to="review">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               bpm_package.children[0].addAspect("dsm:docStatus_PendingApproval");
               bpm_package.children[0].save();
            </script>
         </action>
      </transition>
    </start-state>

    <swimlane name="reviewer">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{bpm_assignee}</actor>
        </assignment>   
    </swimlane>

    <task-node name="review">
        <task name="wf:reviewTask" swimlane="reviewer">
            <event type="task-create">
                <script>
                    if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                    if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                </script>
            </event>
        </task>
        <transition name="reject" to="rejected">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               bpm_package.children[0].removeAspect("dsm:docStatus_PendingApproval");
               bpm_package.children[0].addAspect("dsm:docStatus_Rejected");
               bpm_package.children[0].save();
            </script>
         </action>
      </transition>
        <transition name="approve" to="approved">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               bpm_package.children[0].removeAspect("dsm:docStatus_PendingApproval");
               bpm_package.children[0].addAspect("dsm:docStatus_Approved");
               bpm_package.children[0].save();
            </script>
         </action>
      </transition>
    </task-node>

    <task-node name="rejected">
        <task name="wf:rejectedTask" swimlane="initiator" />
        <transition name="" to="end" />
    </task-node>

    <task-node name="approved">
        <task name="wf:approvedTask" swimlane="initiator" />
        <transition name="" to="end" />
    </task-node>

    <end-state name="end" />

</process-definition>

The following aspects are defined in my model:

    <aspect name="dsm:docStatus_PendingApproval">
    <aspect name="dsm:docStatus_Rejected">
    <aspect name="dsm:docStatus_Approved">

Outcomes