Sei sulla pagina 1di 12

Dynamic deployment of Alfresco Custom Workflow

1. Dynamic Deployment of Workflow Model

Custom Workflow/Content models are stored in Models Space Company Home > Data Dictionary > Models . Upload a custom XML Upload a custom XML model file to the Models space.
Create one custom workflow model CustomWorkflowModel.xml

<?xml version="1.0" encoding="UTF-8"?> <model name="claim:workflowmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0"> <description>Custom Claim Model</description> <author>Ganesh Kolhe</author> <version>1.0</version> <imports> <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/> <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/> <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm"/> <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" /> </imports> <namespaces> <namespace uri="com.claim.workflow.model" prefix="claim"/> </namespaces> <types> <type name="claim:reviewTask"> <parent>bpm:startTask</parent> <properties> <property name="claim:claim_id"> <title>Claim Id</title> <type>d:int</type> </property> <property name="claim:claim_amount"> <title>Claim Amount</title> <type>d:int</type> </property> <property name="claim:customer_name"> <title>Customer Name</title> <type>d:text</type>

</property> <property name="claim:interest_rate"> <title>Interest Rate</title> <type>d:float</type> </property> <property name="claim:balance_amount"> <title>Balance Amount</title> <type>d:int</type> </property> <property name="claim:settlement_amount"> <title>Settlement Amount</title> <type>d:int</type> </property> <property name="claim:wfDescription"> <type>d:text</type> </property> </properties> <mandatory-aspects> <aspect>bpm:assignee</aspect> </mandatory-aspects> </type> <type name="claim:submitReviewTask"> <parent>claim:reviewTask</parent> <overrides> <property name="claim:claim_id"></property> <property name="claim:claim_amount"></property> <property name="claim:customer_name"></property> <property name="claim:interest_rate"></property> <property name="claim:balance_amount"></property> <property name="claim:settlement_amount"></property> <property name="claim:wfDescription"></property> </overrides> </type> </types> </model>

While uploading custom XML model file Enble checkbox Modify all properties when this page closes so that you can fill custom properties and select Model Active check box to Activate model as you are uploading.

Note. If you forget to enable Model Activecheck box dont worry Alfreso has given admin UI to activate your model Go to http://<server_name>:<port>/alfresco/faces/jsp/admin/repoadmin-console.jsp Use the command activate model CustomWorkflowModel.xml.

1. Dynamic Deployment of Workflow Resource Bundle (Workflow Message Properties for Client)

Custom Workflow Resource Bundle are stored in Messages Space Company Home > Data Dictionary > Messages . Upload a custom workflow resource bundle file to the Messages space # Filename: custom-workflow-messages # Description: Specity labels of the property for the custom Workflow # Author: Ganesh Kolhe claim_claimReview.workflow.title=Review, Approval of content claim_claimReview.workflow.description=Review, Approval of content claim_workflowmodel.type.claim_reviewTask.title=Start Review claim_workflowmodel.type.claim_reviewTask.description=Submit documents for review & approval claim_workflowmodel.type.claim_submitReviewTask.title=Review claim_workflowmodel.type.claim_submitReviewTask.description=Review Documents to Approve or Reject them

2. Dynamic Deployment of Workflow Process Definition Custom Workflow Definition are stored in Messages Space Company Home > Data Dictionary > Workflow Definitions . Upload a custom workflow resource bundle file to the Workflow Definitions space. Create customworkflow-processdefinition.xml <?xml version="1.0" encoding="UTF-8"?> <!-- Author Ganesh Kolhe -->

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="claim:claimReview"> <swimlane name="initiator"></swimlane> <swimlane name="assignee"> <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment"> <actor>#{bpm_assignee}</actor> </assignment> </swimlane> <start-state name="start"> <task name="claim:reviewTask" swimlane="initiator" /> <transition name="" to="startreview"/> </start-state> <node name="startreview" > <event type="node-enter"> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> <variable name="startDate" access="write,read"/> <expression> new Date(); </expression> </script> </action> </event> <transition name="review" to="review" > </transition> </node> <task-node name="review"> <task name="claim:submitReviewTask" swimlane="assignee"> <event type="task-create"> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> <variable name="createReviewDate" access="write,read"/> <expression> new Date(); </expression> </script> </action> </event>

<event type="task-end"> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> <variable name="endReviewDate" access="write,read"/> <expression> new Date(); </expression> </script> </action> </event> </task> <transition name="Reject" to="end" > </transition> <transition name="Approve" to="end"> </transition> </task-node> <end-state name="end"/>

</process-definition> Add the process definition file to Workflow Definitions Space

3. Dynamic Deployment of Workflow task dialog (Web-Client-Config-Custom) Dynamic Alfresco Explorer Customization is stored in Space Company Home > Data Dictionary > Web Client Extension . Upload a custom definition of task-dialog in Web Client Extension space. Create web-client-config-custom.xml and upload in this space <alfresco-config> <config evaluator="node-type" condition="claim:reviewTask" replace="true"> <property-sheet> <show-property name="claim:claim_id" display-label="Claim Id" /> <show-property name="claim:claim_amount" display-label="Claim Amount" />

<show-property name="claim:customer_name" display-label="Customer Name" /> <show-property name="claim:interest_rate" display-label="Interest Rate" /> <show-property name="claim:balance_amount" display-label="Balance Amount" /> <show-property name="claim:settlement_amount" display-label="Settlement Amount" /> <show-property name="claim:wfDescription" display-label="Description" /> <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" /> <show-association name="bpm:assignee" display-label-id="wf_reviewers" /> </property-sheet> </config> <config evaluator="node-type" condition="claim:submitReviewTask" replace="true"> <property-sheet> <show-property name="claim:claim_id" display-label="Claim Id" /> <show-property name="claim:claim_amount" display-label="Claim Amount" /> <show-property name="claim:customer_name" display-label="Customer Name" />

<show-property name="claim:interest_rate" display-label="Interest Rate" /> <show-property name="claim:balance_amount" display-label="Balance Amount" /> <show-property name="claim:settlement_amount" display-label="Settlement Amount" /> <show-property name="claim:wfDescription" display-label="Description" /> </property-sheet> </config> </alfresco-config>

Goto - http://<server-name>:<port>/alfresco/faces/jsp/admin/webclientconfig-console.jsp And type command reload which causes this customization to be reloaded.

Test your CustomWokflow 1. First Create Claims Space under Company Home Space 2. Create two user using admin console a. claim_maker b. settlement_approver 3. Login with claim_maker 4. Add Content to space Claims 5. Right Click on Content and select Start Advanced Workflow

6. Login with settlement_approver under My Alfresco Custom workflow task can be viewed.

Potrebbero piacerti anche