Wednesday, November 09, 2011

Serial group workflow

Serial workflow will execute in serial manner. One after another.
We have following files:

  1. customworkflow-context.xml
  2. serialar_processdefinition.xml
  3. serialar-content-model.xml
  4. serialar-messages.properties
  5. web-client-config-custom.xml
1. customworkflow-context.xml
<?xml version='1.0' encoding='UTF-8'?>

<!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> 

      </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>   

    </list>

    </property>

    <property name="models">

      <list>

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

      </list>

    </property>

  </bean>

</beans>
========================================
 2. serialar_processdefinition.xml

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

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

 <swimlane name="initiator" />

 <start-state name="start">

 <task name="ncm:startTask"

 description="Submit Serial Review Task" swimlane="initiator" />

 <event type="node-leave">

 <script><variable name="approveCount" access="write" /><expression>approveCount = 0;</expression></script>

 </event>

 <transition name="Send For Review" to="review"></transition>

 </start-state>

 <task-node name="review">

 <task name="ncm:reviewTask">

 <assignment

 class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">

 <actor>#{bpm_assignees.get(approveCount)}</actor>

 </assignment>

 <event type="task-create">

 <script>

 if (bpm_workflowDueDate != void)

 taskInstance.dueDate = bpm_workflowDueDate;

 if (bpm_workflowPriority != void)

 taskInstance.priority = bpm_workflowPriority;

 </script>

 </event>

 <event type="task-assign">

 </event>

 </task>

 <event type="node-enter">

 <script>

 <variable name="reviewerCount" access="write"></variable>

 <expression>

 reviewerCount = bpm_assignees.size();

 </expression>

 </script>

 </event>

 <transition name="Approve" to="isLast">

 <script>

 <variable name="approveCount" access="write" />

 <expression>approveCount = approveCount + 1  ;</expression>

 </script>

 </transition>

 <transition name="Reject" to="re_submit">

 </transition>

 </task-node>

 <decision name="isLast">

 <transition name="No" to="review">

 <condition>#{approveCount &lt; reviewerCount}</condition>

 </transition>

 <transition name="Yes" to="FinalSubmit">

 <condition>#{approveCount == reviewerCount}</condition>

 </transition>

 </decision>

 <end-state name="end" />

 <task-node name="re_submit">

 <task name="ncm:reviewTask" swimlane="initiator">

 <event type="task-create">

 <script>

 if (bpm_workflowDueDate != void)

 taskInstance.dueDate = bpm_workflowDueDate;

 if (bpm_workflowPriority != void)

 taskInstance.priority = bpm_workflowPriority;

 </script>

 </event>

 <event type="task-assign">

 </event>

 </task>

 <transition name="ReSubmit" to="review">

 <script>

 <variable name="approveCount" access="write" />

 <expression>approveCount =0 ;</expression>

 </script>

 </transition>

 <transition name="Finish" to="end"></transition>

 </task-node>

 <task-node name="FinalSubmit">

 <task name="ncm:reviewTask" swimlane="initiator">

 <event type="task-assign">

 </event>

 </task>

 <transition name="Finish" to="end"></transition>

 </task-node>

</process-definition>
========================================
3. serialar-content-model.xml

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

<model name="ncm: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"/>

   </imports>

   <namespaces>

      <namespace uri="http://www.alfresco.org/ncm/model/workflow/1.0" prefix="ncm"/>

   </namespaces>

   <types>

      <!--                               -->

      <!--  Basic Review & Approve Tasks -->             

      <!--                               -->

      <type name="ncm:startTask">

         <parent>bpm:startTask</parent>

         <mandatory-aspects>

            <aspect>bpm:assignees</aspect>

         </mandatory-aspects>

      </type>

      <type name="ncm:submitConcurrentReviewTask">

         <parent>bpm:startTask</parent>

         <properties>

            <property name="ncm:requiredApprovePercent">

                <type>d:int</type>

                <mandatory>true</mandatory>

                <default>50</default>

                <constraints>

                    <constraint type="MINMAX">

                        <parameter name="minValue"><value>1</value></parameter>

                        <parameter name="maxValue"><value>100</value></parameter>

                    </constraint>

                </constraints>

            </property>

         </properties>

      </type>

      <!--  Submit review to multiple people (explicit list) -->

      <type name="ncm:submitParallelReviewTask">

         <parent>ncm:submitConcurrentReviewTask</parent>

         <mandatory-aspects>

            <aspect>bpm:assignees</aspect>

         </mandatory-aspects>

      </type>

    <!--  Submit review to multiple people (as included in a group) -->

      <type name="ncm:submitGroupReviewTask">

         <parent>ncm:submitConcurrentReviewTask</parent>

         <mandatory-aspects>

            <aspect>bpm:groupAssignee</aspect>

         </mandatory-aspects>

      </type>

      <type name="ncm:reviewTask">

         <parent>bpm:workflowTask</parent>

         <overrides>

            <property name="bpm:packageItemActionGroup">

               <default>edit_package_item_actions</default>

            </property>

         </overrides>

      </type>

      <type name="ncm:approvedTask">

         <parent>bpm:workflowTask</parent>

         <mandatory-aspects>

            <aspect>bpm:assignee</aspect>

         </mandatory-aspects>

      </type>

      <type name="ncm:rejectedTask">

         <parent>bpm:workflowTask</parent>

         <mandatory-aspects>

            <aspect>bpm:assignee</aspect>

         </mandatory-aspects>

      </type>

      <type name="ncm:rejectedParallelTask">

         <parent>bpm:workflowTask</parent>

         <mandatory-aspects>

            <aspect>ncm:parallelReviewStats</aspect>

         </mandatory-aspects>

      </type>

      <type name="ncm:approvedParallelTask">

         <parent>bpm:workflowTask</parent>

         <mandatory-aspects>

            <aspect>ncm:parallelReviewStats</aspect>

         </mandatory-aspects>

      </type>

      <!--                               -->

      <!--  Adhoc Tasks -->             

      <!--                               --> 

      <type name="ncm:submitAdhocTask">

         <parent>bpm:startTask</parent>

         <properties>

            <property name="ncm:notifyMe">

               <type>d:boolean</type>

               <default>false</default>

            </property>

         </properties>

         <mandatory-aspects>

            <aspect>bpm:assignee</aspect>

         </mandatory-aspects>

      </type>

      <type name="ncm: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="ncm:completedAdhocTask">

         <parent>bpm:workflowTask</parent>

         <mandatory-aspects>

            <aspect>bpm:assignee</aspect>

         </mandatory-aspects>

      </type>

   </types>

   <aspects>

      <aspect name="ncm:parallelReviewStats">

         <properties>

            <property name="ncm:reviewerCount">

               <type>d:int</type>

            </property>

            <property name="ncm:requiredPercent">

               <type>d:int</type>

            </property>

            <property name="ncm:approveCount">

               <type>d:int</type>

            </property>

            <property name="ncm:actualPercent">

               <type>d:int</type>

            </property>

         </properties>

      </aspect>

   </aspects>

</model>

========================================

 4.  serialar-messages.properties
#
# Serial Workflow
#ncm_serialar.workflow.title=Rasel Serial Workflow

ncm_serialar.workflow.description=Rasel Serial Review & approval of content

ncm_serialar.node.verifybrokenlinks.transition.abort.title=Abort Submisson

ncm_serialar.node.verifybrokenlinks.transition.abort.description=Abort Submisson

ncm_serialar.node.verifybrokenlinks.transition.continue.title=Continue Submission

ncm_serialar.node.verifybrokenlinks.transition.continue.description=Continue Submisson

ncm_serialar.node.serialreview.transition.reject.title=Reject

ncm_serialar.node.serialreview.transition.reject.description=Reject

ncm_serialar.node.serialreview.transition.approve.title=Approve

ncm_serialar.node.serialreview.transition.approve.description=Approve

ncm_serialar.node.parallelreview.transition.reject.title=Reject

ncm_serialar.node.parallelreview.transition.reject.description=Reject

ncm_serialar.node.parallelreview.transition.approve.title=Approve

ncm_serialar.node.parallelreview.transition.approve.description=Approve

ncm_serialar.node.rejected.transition.abort.title=Abort Review

ncm_serialar.node.rejected.transition.abort.description=Abort Review

ncm_serialar.node.rejected.transition.resubmit.title=Resubmit for Review

ncm_serialar.node.rejected.transition.resubmit.description=Resubmit for Review

ncm_serialar.node.submitpending.transition.cancel.title=Abort Submission

ncm_serialar.node.submitpending.transition.cancel.description=Abort Submission

ncm_serialar.node.submitpending.transition.launch.title=Submit Now

ncm_serialar.node.submitpending.transition.launch.description=Submit Now

# Submit Task Definitions

ncm_workflowmodel.type.ncm_reviewTask.title=ReviewTask

ncm_workflowmodel.type.ncm_reviewTask.description=ReviewTask

ncm_workflowmodel.type.ncm_startTask.title=StartTask

ncm_workflowmodel.type.ncm_startTask.description=StartTask

ncm_workflowmodel.type.groupncm_submitReviewTask.description=Submit changes for approval by a group

ncm_workflowmodel.type.groupncm_verifyBrokenLinksTask.title=Verify Broken Links

ncm_workflowmodel.type.groupncm_verifyBrokenLinksTask.description=Verify links that do not point to a live resource

ncm_workflowmodel.type.groupncm_reviewTask.title=Review

ncm_workflowmodel.type.groupncm_reviewTask.description=Review Documents to approve or reject them

ncm_workflowmodel.type.groupncm_parallelReviewTask.title=Review

ncm_workflowmodel.type.groupncm_parallelReviewTask.description=Review Documents to approve or reject them

ncm_workflowmodel.type.groupncm_rejectedTask.title=Rejected

ncm_workflowmodel.type.groupncm_rejectedTask.description=Rejected

ncm_workflowmodel.type.groupncm_approvedTask.title=Approved

ncm_workflowmodel.type.groupncm_approvedTask.description=Approved

ncm_workflowmodel.type.groupncm_submittedTask.title=Submitted

ncm_workflowmodel.type.groupncm_submittedTask.description=Submitted

ncm_workflowmodel.type.groupncm_submitpendingTask.title=Submission Pending

ncm_workflowmodel.type.groupncm_submitpendingTask.description=Submission Pending

ncm_workflowmodel.type.groupncm_submitcancelledTask.title=Submission Aborted

ncm_workflowmodel.type.groupncm_submitcancelledTask.description=Submission Aborted

ncm_workflowmodel.property.groupncm_reviewType.title=Type of Review

ncm_workflowmodel.property.groupncm_reviewType.description=Serial or parallel review

ncm_workflowmodel.property.groupncm_submitReviewType.title=Type of Review

ncm_workflowmodel.property.groupncm_submitReviewType.description=Serial or parallel review

ncm_workflowmodel.property.groupncm_fromPath.title=Source Folder Path

ncm_workflowmodel.property.groupncm_fromPath.description=Folder Path where items have been submitted from

ncm_workflowmodel.property.groupncm_label.title=Submission Label

ncm_workflowmodel.property.groupncm_label.description=Label associated with the submission

ncm_workflowmodel.property.groupncm_launchDate.title=Launch Date

ncm_workflowmodel.property.groupncm_launchDate.description=Date the content in the submission should be committed

ncm_workflowmodel.property.groupncm_validateLinks.title=Validate Links

ncm_workflowmodel.property.groupncm_validateLinks.description=Whether links should be verified before entering the review cycle

ncm_workflowmodel.property.groupncm_webapp.title=Webapp

ncm_workflowmodel.property.groupncm_webapp.description=The webapp within the workflow store to check links for

ncm_workflowmodel.property.groupncm_reviewerCnt.title=Total Reviewed

ncm_workflowmodel.property.groupncm_reviewerCnt.description=Count of people who reviewed

ncm_workflowmodel.property.groupncm_approveCnt.title=Total Approved

ncm_workflowmodel.property.groupncm_approveCnt.description=Count of people who approved
========================================
5. web-client-config-custom.xml  
 
<alfresco-config>
<config evaluator="node-type" condition="ncm:startTask"

 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="wf_reviewers" />

 <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>

Regarding placing these all files


if one user approves, goes to other user in queue.
if all approves then approved. else resubmit.

alfresco/extension/workflow folder
===============================
1) serialar-content-model.xml
2)serialar-processdefinition.xml
3)serialar-messages.properties

alfresco/extension
================
1) web-client-config-custom.xml
2)customworkflow-context.xml


No comments:

Post a Comment