cancel
Showing results for 
Search instead for 
Did you mean: 

Add aspect name

irene08
Champ in-the-making
Champ in-the-making
Hi!

Good Day!

I have read this link and have some questions. Maybe you can help me with this.

http://techblog.zabuchy.net/2012/alfresco-workflow-copy-files-attached-to-a-folder/comment-page-1/#c...

In what path should I set the aspect name, constraint name? What file is it? Below is the content of the link above.

————————————————————————————————————————————————————————
Creation of new workflow

This section describes how to create new workflow that depending on whether task was approved or rejected is going to add appropriate aspect to all the files attached to the workflow. Let’s call the aspect ‘workflowOutcomeAspect’ and allow it to have two values: ‘approved’ or ‘rejected’. The definition of new aspect is presented below.

<constraint name="wf:allowedOutcome" type="LIST">
      <parameter name="allowedValues">
          <list>
              <value></value>
         <value>approved</value>
         <value>rejected</value>
          </list>
      </parameter>
       </constraint>

      <aspect name="wf:workflowOutcomeAspect">
         <title>Workflow Outcome</title>

         <properties>
            <property name="wf:workflowOutcome">
               <title>Workflow Outcome</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
               <default></default>
               <constraints>
                   <constraint ref="wf:allowedOutcome" />
               </constraints>
            </property>
         </properties>

      </aspect>

Following that let’s modify the initial workflow (‘Review and Approve’) to add ‘workflowOutcomeAspect’ to all the child nodes of package node and set property ‘workflowOutcome’ of that aspect to ‘approved’ or ‘rejected’ depending on user action. To note, ‘Review and Approve’ workflow is one of the standard workflows available with Alfresco deployment. The package is available in JavaScript under ‘bpm_package’ variable and its children can be obtained by invocation of ‘bpm_package.children’. More information about creation and management of workflows can be found in my post Creation of workflow in Alfresco using Activiti step by step.

       <userTask id="approved" name="Document Approved"
            activiti:formKey="wf:approvedTask" >
            <documentation>
                The document was reviewed and approved.
            </documentation>
            <extensionElements>
               <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>
                        if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
          <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>   
             if (bpm_package != null &amp;&amp; bpm_package.children != null) {
             var i = 0;
             for (i = 0; i &lt; bpm_package.children.length; i++) {
            var document = bpm_package.children;
            document.addAspect("wf:workflowOutcomeAspect");
            document.properties["wf:workflowOutcome"] = "approved";
            document.save();
             }
         }
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
            </extensionElements>
            <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${initiator.exists() ? initiator.properties.userName : 'admin'}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
        </userTask>

        <userTask id="rejected" name="Document Rejected"
            activiti:formKey="wf:rejectedTask" >
            <documentation>
                The document was reviewed and rejected.
            </documentation>
            <extensionElements>
               <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>
                        if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
          <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>
             if (bpm_package != null &amp;&amp; bpm_package.children != null) {
             var i = 0;
             for (i = 0; i &lt; bpm_package.children.length; i++) {
            var document = bpm_package.children;
            document.addAspect("wf:workflowOutcomeAspect");
            document.properties["wf:workflowOutcome"] = "rejected";
            document.save();
             }
         }
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
            </extensionElements>
            <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${initiator.exists() ? initiator.properties.userName : 'admin'}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
        </userTask>
1 REPLY 1

irene08
Champ in-the-making
Champ in-the-making
Thank you,

Irene Smiley Happy