11-12-2012 10:59 AM
<?xml version="1.0" encoding="UTF-8" ?>
<model name="test:wfmodel" 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/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm" />
</imports>
<namespaces>
<namespace uri="http://www.alfresco.org/model/testworkflow/content/1.0" prefix="test" />
</namespaces>
<types>
<type name="test:generateDraft">
<parent>bpm:startTask</parent>
<mandatory-aspects>
<aspect>bpm:groupAssignee</aspect>
<aspect>test:percents</aspect>
</mandatory-aspects>
</type>
<type name="test:reviewTask">
<parent>bpm:activitiOutcomeTask</parent>
<properties>
<property name="test:reviewTaskOutcome">
<type>d:text</type>
<default>Reject</default>
<constraints>
<constraint name="test:reviewTaskOutcomeOption" type="LIST">
<parameter name="allowedValues">
<list>
<value>Approve</value>
<value>Reject</value>
</list>
</parameter>
</constraint>
</constraints>
</property>
</properties>
</type>
</types>
<aspects>
<aspect name="test:percents">
<properties>
<property name="test:requiredApprovePercent">
<type>d:int</type>
<mandatory>true</mandatory>
<default>100</default>
<constraints>
<constraint type="MINMAX">
<parameter name="minValue">
<value>0</value>
</parameter>
<parameter name="maxValue">
<value>100</value>
</parameter>
</constraint>
</constraints>
</property>
<property name="test:currentPercent">
<type>d:int</type>
<mandatory>true</mandatory>
<default>0</default>
<constraints>
<constraint type="MINMAX">
<parameter name="minValue">
<value>0</value>
</parameter>
<parameter name="maxValue">
<value>100</value>
</parameter>
</constraint>
</constraints>
</property>
</properties>
</aspect>
</aspects>
</model>
<?xml version="1.0" encoding="UTF-8" ?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://alfresco.org">
<process id="harmonization" name="Harmonizates test documents">
<extensionElements>
<activiti:executionListener event="start"
class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
<activiti:field name="script">
<activiti:string>
var authNode = "";
var memberNames = new java.util.ArrayList();
for each (permission in bpm_package.children[0].permissions) {
var valuesList = permission.split(";");
if (valuesList[0].toUpperCase().indexOf("ALLOWED") >= 0) {
authNode = people.getGroup(valuesList[1]);
if (authNode != null) {
var cont = 0;
for each (member in people.getMembers(authNode, true)) {
for (var i=0; i<memberNames.size(); i++) {
if ( memberNames.get(i) == member.properties.userName) {
cont++;
}
}
if (cont == 0) {
memberNames.add(member.properties.userName);
}
}
}
}
}
if (memberNames.size() == 0) {
logger.error("No group found");
}
execution.setVariable('testwf_approveCount', 0);
execution.setVariable('testwf_currentPercent', 0);
execution.setVariable('testwf_requiredApprovePercent', 100);
execution.setVariable('testwf_groupMembers', memberNames);
execution.setVariable('testwf_reviewerCount', memberNames.size());
</activiti:string>
</activiti:field>
</activiti:executionListener>
</extensionElements>
<startEvent id="start" activiti:formKey="testwf:generateDraft" />
<sequenceFlow id='flow1' sourceRef='start' targetRef='reviewTask' />
<userTask id="reviewTask" name="Review Task" activiti:formKey="testwf:reviewTask">
<extensionElements>
<activiti:taskListener event="complete"
class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="runAs">
<activiti:string>admin</activiti:string>
</activiti:field>
<activiti:field name="script">
<activiti:string>
if(task.getVariableLocal('testwf_reviewTaskOutcome') == 'Approve') {
var newApprovedCount = testwf_approveCount + 1;
var newApprovedPercentage = (newApprovedCount / testwf_reviewerCount) * 100;
execution.setVariable('testwf_approveCount', newApprovedCount);
execution.setVariable('testwf_currentPercent', newApprovedPercentage);
if (bpm_package.children[0].type.equals("{test.model}annexeFile")) {
bpm_package.children[0].properties["test:annexeFileHarmonize"] = newApprovedPercentage;
}
if (bpm_package.children[0].type.equals("{test.model}bookFile")) {
bpm_package.children[0].properties["test:bookFileHarmonize"] = newApprovedPercentage;
}
if (bpm_package.children[0].type.equals("{test.model}issueFile")) {
bpm_package.children[0].properties["test:issueFileHarmonize"] = newApprovedPercentage;
}
bpm_package.children[0].save();
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${reviewAssignee}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
<multiInstanceLoopCharacteristics isSequential="false">
<loopDataInputRef>testwf_groupMembers</loopDataInputRef>
<inputDataItem name="reviewAssignee" />
<completionCondition>${testwf_currentPercent >= testwf_requiredApprovePercent}</completionCondition>
</multiInstanceLoopCharacteristics>
</userTask>
<sequenceFlow id='flow2' sourceRef='reviewTask' targetRef='reviewDecision' />
<exclusiveGateway id="reviewDecision" name="Review Decision" />
<sequenceFlow id='flow3' sourceRef='reviewDecision' targetRef='end'>
<conditionExpression xsi:type="tFormalExpression">
${testwf_currentPercent >= testwf_requiredApprovePercent}
</conditionExpression>
</sequenceFlow>
<sequenceFlow id='flow4' sourceRef='reviewDecision' targetRef='start' />
<endEvent id="end" />
</process>
<!– Graphical representaion of diagram –>
<bpmndi:BPMNDiagram id="BPMNDiagram_harmonization">
<bpmndi:BPMNPlane bpmnElement="harmonization" id="BPMNPlane_harmonization">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="35" width="35" x="30" y="200"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="reviewTask" id="BPMNShape_reviewTask">
<omgdc:Bounds height="55" width="105" x="125" y="190"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="reviewDecision" id="BPMNShape_reviewDecision">
<omgdc:Bounds height="40" width="40" x="290" y="197"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
<omgdc:Bounds height="35" width="35" x="560" y="200"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="65" y="217"></omgdi:waypoint>
<omgdi:waypoint x="125" y="217"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="230" y="217"></omgdi:waypoint>
<omgdi:waypoint x="290" y="217"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="330" y="217"></omgdi:waypoint>
<omgdi:waypoint x="560" y="217"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="310" y="237"></omgdi:waypoint>
<omgdi:waypoint x="310" y="324"></omgdi:waypoint>
<omgdi:waypoint x="47" y="324"></omgdi:waypoint>
<omgdi:waypoint x="47" y="235"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
<alfresco-config>
<config evaluator="string-compare" condition="activiti$harmonization">
<forms>
<form>
<field-visibility>
<show id="bpm:workflowDescription" />
<show id="packageItems" />
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.general" />
<set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
<set id="assignee" appearance="title" label-id="workflow.set.assignee" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="other" appearance="title" label-id="workflow.set.other" />
<field id="bpm:workflowDescription" label-id="workflow.field.message">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 95%</control-param>
</control>
</field>
<field id="packageItems" set="items" />
</appearance>
</form>
</forms>
</config>
<config evaluator="task-type" condition="testwf:generateDraft">
<forms>
<form id="workflow-details">
<field-visibility>
<show id="testwf:requiredApprovePercent" />
<show id="testwf:currentPercent" />
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.workflow.more_info" />
</appearance>
</form>
</forms>
</config>
<config evaluator="task-type" condition="testwf:reviewTask">
<forms>
<form>
<field-visibility>
<show id="message" />
<show id="taskOwner" />
<show id="bpm:taskId" />
<show id="packageItems" />
<show id="testwf:reviewTaskOutcome" />
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.task.info" />
<set id="info" appearance="" template="/org/alfresco/components/form/3-column-set.ftl" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="response" appearance="title" label-id="workflow.set.response" />
<field id="message">
<control template="/org/alfresco/components/form/controls/info.ftl" />
</field>
<field id="taskOwner" set="info" />
<field id="bpm:taskId" set="info">
<control template="/org/alfresco/components/form/controls/info.ftl" />
</field>
<field id="packageItems" set="items" />
<field id="testwf:reviewTaskOutcome" label-id="workflow.field.outcome" set="response">
<control template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
</alfresco-config>
11-12-2012 01:12 PM
11-13-2012 02:00 AM
04-30-2013 12:41 PM
10-08-2013 07:58 AM
10-09-2013 04:17 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.