Alfresco工作流程分配不起作用

时间:2016-06-22 03:57:50

标签: java alfresco alfresco-share

在Alfresco社区版5.1.x中使用自定义工作流程在工作流任务分配给团体或个人不工作时请帮帮我

我的Bpmn20.xml代码

<?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:xsd="http://www.w3.org/2001/XMLSchema" 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://www.activiti.org/test">
  <process id="mentoraTraining" name="TrainingRequest" isExecutable="true">
    <startEvent id="start" activiti:formKey="mentoratraining:start"></startEvent>
    <sequenceFlow id="sequenceFlow1" sourceRef="start" targetRef="userTask1"></sequenceFlow>
    <userTask id="userTask1" name="Operations" activiti:formKey="mentoratraining:operations" activiti:candidateGroups="${bpm_groupAssignee.properties.authorityName}">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
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><![CDATA[
if (typeof task.getVariableLocal('mentoratraining_needtocoverprerequisites') != undefined) execution.setVariable('mentoratraining_needtocoverprerequisites', task.getVariableLocal('mentoratraining_needtocoverprerequisites'));
if (typeof task.getVariableLocal('mentoratraining_desiredoutcomesforstudents') != undefined) execution.setVariable('mentoratraining_desiredoutcomesforstudents', task.getVariableLocal('mentoratraining_desiredoutcomesforstudents'));

]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sequenceFlow2" sourceRef="userTask1" targetRef="userTask2"></sequenceFlow>
    <userTask id="userTask2" name="Recruitment " activiti:formKey="mentoratraining:recruitment">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
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><![CDATA[
if (typeof task.getVariableLocal('mentoratraining_trainername') != undefined) execution.setVariable('mentoratraining_trainername', task.getVariableLocal('mentoratraining_trainername'));
if (typeof task.getVariableLocal('mentoratraining_rateperhour') != undefined) execution.setVariable('mentoratraining_rateperhour', task.getVariableLocal('mentoratraining_rateperhour'));
if (typeof task.getVariableLocal('mentoratraining_coursedurationhours') != undefined) execution.setVariable('mentoratraining_coursedurationhours', task.getVariableLocal('mentoratraining_coursedurationhours'));
if (typeof task.getVariableLocal('mentoratraining_costoftrainer') != undefined) execution.setVariable('mentoratraining_costoftrainer', task.getVariableLocal('mentoratraining_costoftrainer'));

]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sequenceFlow3" sourceRef="userTask2" targetRef="serviceTask1"></sequenceFlow>

  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_mentoraTraining">
    <bpmndi:BPMNPlane bpmnElement="mentoraTraining" id="BPMNPlane_mentoraTraining">
      <bpmndi:BPMNShape bpmnElement="event1" id="BPMNShape_event1">
        <omgdc:Bounds height="30.0" width="30.0" x="1075.0" y="140.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusiveGateway2" id="BPMNShape_exclusiveGateway2">
        <omgdc:Bounds height="40.0" width="40.0" x="1070.0" y="0.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusiveGateway1" id="BPMNShape_exclusiveGateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="980.0" y="65.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="serviceTask1" id="BPMNShape_serviceTask1">
        <omgdc:Bounds height="60.0" width="100.0" x="380.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="30.0" width="30.0" x="0.0" y="70.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="userTask1" id="BPMNShape_userTask1">
        <omgdc:Bounds height="60.0" width="100.0" x="80.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="userTask3" id="BPMNShape_userTask3">
        <omgdc:Bounds height="60.0" width="100.0" x="530.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="serviceTask2" id="BPMNShape_serviceTask2">
        <omgdc:Bounds height="60.0" width="100.0" x="680.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="30.0" width="30.0" x="1160.0" y="5.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="userTask2" id="BPMNShape_userTask2">
        <omgdc:Bounds height="60.0" width="100.0" x="230.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="userTask4" id="BPMNShape_userTask4">
        <omgdc:Bounds height="60.0" width="100.0" x="830.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow5" id="BPMNEdge_sequenceFlow5">
        <omgdi:waypoint x="630.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="680.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow6" id="BPMNEdge_sequenceFlow6">
        <omgdi:waypoint x="780.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="830.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow3" id="BPMNEdge_sequenceFlow3">
        <omgdi:waypoint x="330.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="380.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow4" id="BPMNEdge_sequenceFlow4">
        <omgdi:waypoint x="480.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="530.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow1" id="BPMNEdge_sequenceFlow1">
        <omgdi:waypoint x="30.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="80.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow2" id="BPMNEdge_sequenceFlow2">
        <omgdi:waypoint x="180.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="230.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow10" id="BPMNEdge_sequenceFlow10">
        <omgdi:waypoint x="1110.0" y="20.0"></omgdi:waypoint>
        <omgdi:waypoint x="1122.0" y="20.0"></omgdi:waypoint>
        <omgdi:waypoint x="1122.0" y="20.000000000000004"></omgdi:waypoint>
        <omgdi:waypoint x="1160.0" y="20.000000000000004"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow9" id="BPMNEdge_sequenceFlow9">
        <omgdi:waypoint x="1020.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="1032.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="1032.0" y="20.000000000000004"></omgdi:waypoint>
        <omgdi:waypoint x="1070.0" y="20.000000000000004"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow7" id="BPMNEdge_sequenceFlow7">
        <omgdi:waypoint x="930.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="980.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow8" id="BPMNEdge_sequenceFlow8">
        <omgdi:waypoint x="1020.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="1032.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="1032.0" y="155.0"></omgdi:waypoint>
        <omgdi:waypoint x="1075.0" y="155.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

和我的model.xml文件

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" name="mentoratraining:model">
    <imports>
        <import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0"/>
        <import prefix="cm" uri="http://www.alfresco.org/model/content/1.0"/>
        <import prefix="bpm" uri="http://www.alfresco.org/model/bpm/1.0"/>
    </imports>
    <namespaces>
        <namespace prefix="mentoratraining" uri="http://www.alfresco.org/model/dynamic-workflow/mentoratraining/1.0"/>
    </namespaces>

    <types>
        <type name="mentoratraining:operations">
            <parent>bpm:workflowTask</parent>
             <properties/>
            <associations/>
            <overrides>
                <property name="bpm:packageActionGroup">
                    <default>add_package_item_actions</default>
                </property>
                <property name="bpm:packageItemActionGroup">
                    <default>edit_and_remove_package_item_actions</default>
                </property>
            </overrides>
            <mandatory-aspects>
                <aspect>mentoratraining:requestdate</aspect>
                <aspect>mentoratraining:requestorcompany</aspect>
                <aspect>mentoratraining:requestorname</aspect>
                <aspect>mentoratraining:requestoremail</aspect>
                <aspect>mentoratraining:trainingtopic</aspect>
                <aspect>mentoratraining:modeoftraining</aspect>
                <aspect>mentoratraining:country</aspect>
                <aspect>mentoratraining:traininglocation</aspect>
                <aspect>mentoratraining:requestedstartdate</aspect>
                <aspect>mentoratraining:expecteddurationinhoursperday</aspect>
                <aspect>mentoratraining:expecteddurationtotalhours</aspect>
                <aspect>mentoratraining:timingrestrictionsifany</aspect>
                <aspect>mentoratraining:classtimingincludingtimezone</aspect>
                <aspect>mentoratraining:numberofstudents</aspect>
                <aspect>mentoratraining:needtocoverprerequisites</aspect>
                <aspect>mentoratraining:desiredoutcomesforstudents</aspect>
                <aspect>mentoratraining:mlpoc</aspect>
                <aspect>mentoratraining:trainingbudget</aspect>
                <aspect>mentoratraining:requestedcurriculumtopics</aspect>
                <aspect>mentoratraining:requiredoperatingsystem</aspect>
                <aspect>mentoratraining:requiredsoftware</aspect>
                <aspect>mentoratraining:requiredhardware</aspect>
                <aspect>mentoratraining:hardwaredetails</aspect>
                <aspect>mentoratraining:softwaredetails</aspect>
                <aspect>mentoratraining:operatingsystemdetails</aspect>
                <aspect>mentoratraining:details</aspect>
                <aspect>mentoratraining:selectgroup</aspect>
                <aspect>bpm:groupAssignee</aspect>
            </mandatory-aspects>
        </type>

</model>

最后是我的share-config-custom.xml代码

<config >
   <forms>
      <form>
         <field-visibility>
            <show id="bpm:groupAssignee" />
             </field-visibility>
      </form>
   </forms>
</config>

1 个答案:

答案 0 :(得分:1)

尝试在您的任务中添加<aspect>bpm:groupAssignee</aspect>

      <type name="mentoratraining:operations">
            <parent>bpm:workflowTask</parent>
             <properties/>
            <associations/>
            <overrides>
                <property name="bpm:packageActionGroup">
                    <default>add_package_item_actions</default>
                </property>
                <property name="bpm:packageItemActionGroup">
                    <default>edit_and_remove_package_item_actions</default>
                </property>
            </overrides>
            <mandatory-aspects>
                  <!-- Your existing aspects goes here -->
                <aspect>bpm:groupAssignee</aspect>                
            </mandatory-aspects>
        </type>