Wednesday, November 09, 2011

Parallel group workflow

Parallel group workflow :
  1. customworkflow-context.xml
  2. parallel-messages-updated.properties
  3. parallelreview_processdefinition_updated.xml
  4. parallel-workflowModel_updated.xml
  5. web-client-config-custom.xml


1) customworkflow-context.xml
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

  <!-- Load message bundle for custom group based workflow -->

  <bean id="customWorkflows.resourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">

    <property name="resourceBundles">

      <list>

        <value>alfresco.extension.workflow.serialar-messages</value>

        <value>alfresco.extension.workflow.parallel-messages-updated</value>

      </list>

    </property>

  </bean>

  <!-- Load custom group based workflow -->

  <bean id="customWorkflows.workflowBootstrap" parent="workflowDeployer">

    <property name="workflowDefinitions">

      <list>

        <props>

          <prop key="engineId">jbpm</prop>

          <prop key="location">alfresco/extension/workflow/serialar_processdefinition.xml</prop>

          <prop key="mimetype">text/xml</prop>

          <prop key="redeploy">true</prop>

        </props>

         <props>

          <prop key="engineId">jbpm</prop>

          <prop key="location">alfresco/extension/workflow/parallelreview_processdefinition_updated.xml</prop>

          <prop key="mimetype">text/xml</prop>

          <prop key="redeploy">true</prop>

        </props>

      </list>

    </property>

    <property name="models">

      <list>

        <value>alfresco/extension/workflow/serialar-content-model.xml</value>

        <value>alfresco/extension/workflow/parallel-workflowModel_updated.xml</value>

      </list>

    </property>

  </bean>

</beans>
====================================
2) parallel-messages-updated.properties

# Display labels for out-of-the-box Content-oriented Workflows

#

# Review & Approve Workflow

#

pwf_review.workflow.title=Review & Approve

pwf_review.workflow.description=Review & approval of content

# Review & Approve Task Definitions
pwf_workflowmodel.type.pwf_submitReviewTask.title=Start Review
pwf_workflowmodel.type.pwf_submitReviewTask.description=Submit documents for review & approval
pwf_workflowmodel.type.pwf_reviewTask.title=Review Task
pwf_workflowmodel.type.pwf_reviewTask.description=Review Documents to Approve or Reject them
pwf_workflowmodel.type.pwf_rejectedTask.title=Rejected
pwf_workflowmodel.type.pwf_rejectedTask.description=Rejected
pwf_workflowmodel.type.pwf_approvedTask.title=Approved
pwf_workflowmodel.type.pwf_approvedTask.description=Approved
# Review & Approve Process Definitions
pwf_review.node.start.title=Start
pwf_review.node.start.description=Start
pwf_review.node.review.transition.reject.title=Reject
pwf_review.node.review.transition.reject.description=Reject
pwf_review.node.review.transition.approve.title=Approve
pwf_review.node.review.transition.approve.description=Approve
pwf_review.node.rejected.title=Rejected
pwf_review.node.rejected.description=Rejected
pwf_review.task.pwf_rejectedTask.title=Rejected
pwf_review.task.pwf_rejectedTask.description=Rejected
pwf_review.node.approved.title=Approved
pwf_review.node.approved.description=Approved
pwf_review.task.pwf_approvedTask.title=Approved
pwf_review.task.pwf_approvedTask.description=Approved
pwf_review.node.end.title=End
pwf_review.node.end.description=End
#
# Parallel Review Workflow
#
pwf_parallelreview.workflow.title=Rasel Parallel Workflow
pwf_parallelreview.workflow.description=Rasel Parallel Review & approval of content
# Parallel Review & Approve Task Definitions
pwf_workflowmodel.type.pwf_submitParallelReviewTask.title=Start Parallel Review
pwf_workflowmodel.type.pwf_submitParallelReviewTask.description=Submit documents for review & approval to a list of people
pwf_workflowmodel.property.pwf_requiredApprovePercent.title=Required approval percentage
pwf_workflowmodel.property.pwf_requiredApprovePercent.description=Percentage of reviewers who must approve for approval
pwf_workflowmodel.type.pwf_rejectedParallelTask.title=Rejected
pwf_workflowmodel.type.pwf_rejectedParallelTask.description=Rejected
pwf_workflowmodel.type.pwf_approvedParallelTask.title=Approved
pwf_workflowmodel.type.pwf_approvedParallelTask.description=Approved
pwf_workflowmodel.property.pwf_reviewerCount.title=Number of reviewers
pwf_workflowmodel.property.pwf_reviewerCount.description=Number of reviewers
pwf_workflowmodel.property.pwf_requiredPercent.title=Required approval percentage
pwf_workflowmodel.property.pwf_requiredPercent.description=Required approval percentage
pwf_workflowmodel.property.pwf_approveCount.title=Reviewers who approved
pwf_workflowmodel.property.pwf_approveCount.description=Reviewers who approved
pwf_workflowmodel.property.pwf_actualPercent.title=Actual approval percentage
pwf_workflowmodel.property.pwf_actualPercentdescription=Actual approval percentage
# Group Review & Approve Process Definitions
pwf_parallelreview.node.review.transition.reject.title=Reject
pwf_parallelreview.node.review.transition.reject.description=Reject
pwf_parallelreview.node.review.transition.approve.title=Approve
pwf_parallelreview.node.review.transition.approve.description=Approve
#
# Pooled Review Workflow
#
pwf_reviewpooled.workflow.title=Pooled Review & Approve
pwf_reviewpooled.workflow.description=Pooled review & approval of content
pwf_workflowmodel.type.pwf_submitGroupReviewTask.title=Start Group Review
pwf_workflowmodel.type.pwf_submitGroupReviewTask.description=Submit documents for review & approval to a group of people
pwf_reviewpooled.node.review.transition.reject.title=Reject
pwf_reviewpooled.node.review.transition.reject.description=Reject
pwf_reviewpooled.node.review.transition.approve.title=Approve
pwf_reviewpooled.node.review.transition.approve.description=Approve
#
# Parallel Group Review Workflow
#
pwf_parallelgroupreview.workflow.title=Group Review & Approve
pwf_parallelgroupreview.workflow.description=Group review & approval of content
pwf_parallelgroupreview.node.review.transition.reject.title=Reject
pwf_parallelgroupreview.node.review.transition.reject.description=Reject
pwf_parallelgroupreview.node.review.transition.approve.title=Approve
pwf_parallelgroupreview.node.review.transition.approve.description=Approve
#
# Adhoc Task Workflow
#
pwf_adhoc.workflow.title=Adhoc Task
pwf_adhoc.workflow.description=Assign task to colleague
# Adhoc Task Definitions
pwf_workflowmodel.type.pwf_submitAdhocTask.title=Start Adhoc Task
pwf_workflowmodel.type.pwf_submitAdhocTask.description=Allocate task to colleague
pwf_workflowmodel.property.pwf_notifyMe.title=Notify Me
pwf_workflowmodel.property.pwf_notifyMe.description=Notify me when task is complete
pwf_workflowmodel.type.pwf_adhocTask.title=Adhoc Task
pwf_workflowmodel.type.pwf_adhocTask.description=Adhoc Task allocated by colleague
pwf_workflowmodel.type.pwf_completedAdhocTask.title=Adhoc Task Completed
pwf_workflowmodel.type.pwf_completedAdhocTask.description=Adhoc Task Completed
====================================
3) parallelreview_processdefinition_updated.xml
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="pwf:parallelreview">
    <swimlane name="initiator"></swimlane>
    <start-state name="start">
        <task name="pwf:submitParallelReviewTask" swimlane="initiator" />
        <transition name="startTask" to="startreview">
        </transition>
    </start-state>
    <node name="startreview">    
       <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
           <foreach>#{bpm_assignees}</foreach>
            <var>reviewer</var>
        </action>   
        <event type="node-enter">
            <script>    
                <variable name="pwf_rejectFlag" access="read,write" />
                <expression>
                   pwf_rejectFlag=false;
                </expression>
            </script>
        </event>
        <transition name="review" to="review" /> 
    </node>
    <task-node name="review">
        <task name="pwf:reviewTask">
            <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
               <actor>#{reviewer}</actor>
            </assignment>
        </task>  
         <transition name="approve" to="endreview">   
        <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
        <script>
        executionContext.setVariable(&quot;status&quot;,"approve");
        </script>
        </action>
        </transition>  
        <transition name="reject" to="endreview">
        <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
             executionContext.setVariable(&quot;status&quot;,"reject");
 <variable name="pwf_rejectFlag" access="read,write" />
                   <expression>
          pwf_rejectFlag=true; 
                 </expression>
            </script>
            </action>
 </transition>     
    </task-node>
    <join name="endreview">
        <transition to="isapproved" />
    </join>
    <decision name="isapproved">
        <event type="node-enter">   
        </event>
 <transition name="rejected" to="resubmit" >
 </transition>
        <transition name="approved" to="approved">
 <condition>#{pwf_rejectFlag!=true}</condition>           
        </transition>
    </decision>       
    <task-node name="resubmit">
        <task name="pwf:rejectedParallelTask" swimlane="initiator" />
        <transition  name="resubmit" to="startreview"> 
          </transition>
    </task-node>
    <task-node name="approved">
        <task name="pwf:approvedParallelTask" swimlane="initiator" />
        <transition to="end" />
    </task-node>
    <end-state name="end"/>
</process-definition>
====================================
4) parallel-workflowModel_updated.xml

<?xml version="1.0" encoding="UTF-8"?>
<model name="pwf:workflowmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
  <imports>
 <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
 <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm" />
 <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
 </imports>
   <namespaces>
      <namespace uri="http://www.rasel.com/custommodel/workflow/1.0" prefix="pwf"/>
   </namespaces>
   <types>
      <!--                               -->
      <!--  Basic Review & Approve Tasks -->               
      <!--                               -->
      <type name="pwf:submitReviewTask">
         <parent>bpm:startTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>
      <type name="pwf:submitConcurrentReviewTask">
         <parent>bpm:startTask</parent>
      </type>
      <!--  Submit review to multiple people (explicit list) -->
      <type name="pwf:submitParallelReviewTask">
    <parent>bpm:startTask</parent>
    <mandatory-aspects>
            <aspect>bpm:assignees</aspect>
         </mandatory-aspects>
   </type>
      <!--  Submit review to multiple people (as included in a group) -->
      <type name="pwf:submitGroupReviewTask">
         <parent>pwf:submitConcurrentReviewTask</parent>
         <mandatory-aspects>
            <aspect>bpm:groupAssignee</aspect>
         </mandatory-aspects>
      </type>
      <type name="pwf:reviewTask">
<parent>pwf:submitParallelReviewTask</parent>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
      </type>
      <type name="pwf:approvedTask">
         <parent>pwf:submitParallelReviewTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>
      <type name="pwf:rejectedTask">
         <parent>pwf:submitParallelReviewTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>
      <type name="pwf:rejectedParallelTask">
         <parent>pwf:submitParallelReviewTask</parent>
       </type>
      <type name="pwf:approvedParallelTask">
         <parent>pwf:submitParallelReviewTask</parent>
      </type>
      <!--  Adhoc Tasks -->               
      <type name="pwf:submitAdhocTask">
         <parent>bpm:startTask</parent>
         <properties>
            <property name="pwf:notifyMe">
               <type>d:boolean</type>
               <default>false</default>
            </property>
         </properties>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>
      <type name="pwf:adhocTask">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageActionGroup">
               <default>add_package_item_actions</default>
            </property>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
      </type>
      <type name="pwf:completedAdhocTask">
         <parent>bpm:workflowTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>
   </types> 
   <aspects>
      <aspect name="pwf:parallelReviewStats">
         <properties>
            <property name="pwf:reviewerCount">
               <type>d:int</type>
            </property>
            <property name="pwf:requiredPercent">
               <type>d:int</type>
            </property>
            <property name="pwf:approveCount">
               <type>d:int</type>
            </property>
            <property name="pwf:actualPercent">
               <type>d:int</type>
            </property>
 <property name="pwf:totalCount">
               <type>d:int</type>
               <default>0</default>
            </property>
 <property name="pwf:rejectFlag">
               <type>d:boolean</type>
               <default>false</default>
            </property>
 </properties> 
      </aspect>
   </aspects>
</model>
====================================
5) web-client-config-custom.xml
<alfresco-config>
<config evaluator="node-type" condition="pwf:submitParallelReviewTask"
 replace="true">
 <property-sheet>
 <separator name="sep1" display-label-id="general"
 component-generator="HeaderSeparatorGenerator" />
 <show-property name="bpm:workflowDescription"
 component-generator="TextAreaGenerator" />
 <show-property name="bpm:workflowPriority"
 display-label-id="wf_review_priority" />
 <show-property name="bpm:workflowDueDate"
 display-label-id="wf_review_due_date" />
 <separator name="sep2" display-label-id="users_and_roles"
component-generator="HeaderSeparatorGenerator" />
 <show-association name="bpm:assignees"
 display-label-id="pwf_asignees" />
 <separator name="sep3" display-label-id="wf_reviewers"
 component-generator="HeaderSeparatorGenerator" />
 <show-property name="bpm:priority" read-only="true" />
 </property-sheet>
 <condition-handlers>
 <show-association name="bpm:package" read-only="true" />
 </condition-handlers>
 </config>
</alfresco-config>

No comments:

Post a Comment