Alfresco:在另一个任务中显示任务字段(查看它们)

时间:2013-04-30 13:19:52

标签: workflow alfresco activiti alfresco-share

我正在为alfresco 4.0.e部署新的工作流程。 我有一个formkey =“cwf:submitLeaveTask”的任务 这是代码:

    <type name="cwf:submitLeaveTask">
        <parent>bpm:startTask</parent>
        <properties>
            <property name="cwf:leaveDescription">
                <type>d:text</type>
            </property>
            <property name="cwf:duration">
                <type>d:int</type>
                <mandatory>true</mandatory>
            </property>
            <property name="cwf:startDate">
                <type>d:date</type>
                <mandatory>true</mandatory>
            </property>
            <property name="cwf:leaveType">
                <type>d:text</type>
                <mandatory>true</mandatory>
                <constraints>
                    <constraint name="cwf:leaveType" type="LIST">
                        <parameter name="allowedValues">
                            <list>
                                <value>paid leave</value>
                                <value>sick leave</value>
                            </list>
                        </parameter>
                    </constraint>
                </constraints>
            </property>
        </properties>
    </type>

此任务使用formkey连接到另一个任务:“cwf:submitSubstitutinUSer”

    <type name="cwf:submitSubstitutingUser">
        <parent>bpm:activitiOutcomeTask</parent>
        <properties>
            <property name="cwf:substitutingDecisionForLeaveOutcome">
                <type>d:text</type>
                <default>Reject</default>
                <constraints>
                    <constraint name="cwf:substitutingDecisionForLeaveOutcomeOptions"
                        type="LIST">
                        <parameter name="allowedValues">
                            <list>
                                <value>Approve</value>
                                <value>Reject</value>
                            </list>
                        </parameter>
                    </constraint>
                </constraints>
            </property>
        </properties>
        <overrides>
            <property name="bpm:packageItemActionGroup">
                <default>edit_package_item_actions</default>
            </property>
            <property name="bpm:outcomePropertyName">
                <default>{custom.workflow.model}submitSubstitutingUserDecisionForLeaveOutcome
                </default>
            </property>
        </overrides>
    </type>

我需要在第二个任务中显示cwf:startDate和cwf:duration。 我在share-workflow-form-config.xml

中有这个代码
<config evaluator="task-type" condition="cwf:submitSubstitutingUser">
    <forms>
        <form>
            <field-visibility>
                <show id="taskOwner" />
                <show id="cwf:startDate"  /> 
                <show id="cwf:duration" /> 
                <show id="cwf:substitutingDecisionForLeaveOutcome" />
            </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="response" appearance="title" />

                <field id="taskOwner" set="info"></field>
                <field id="cwf:startDate" set="info"></field>
                <field id="cwf:duration" set="info"></field>
                <field id="cwf:substitutingDecisionForLeaveOutcome" label-id="workflow.field.outcome"
                    set="response">
                    <control
                        template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl" />
                </field>

            </appearance>
        </form>
    </forms>

</config>

但我无法在我的表单中看到cwf:startDate和cwf:duration。 有什么不对,我应该怎么做?

2 个答案:

答案 0 :(得分:4)

您无法看到这些属性,因为您将它们放在工作流模型的属性xml字段中,并附加到另一个任务类型(cwf:submitLeaveTask)。 您应该使用方面而不是属性。 Alfresco中的方面就像您可以在特定模型中的每种类型中重用的对象,而不是一次只能绑定到一个类型的属性:

 <aspects>
  <aspect name="cwf:myAspect">
     <title>My Aspect</title>
     <properties>
        <property name="cwf:startDate">
           <type>d:date</type>
        </property>
        <property name="cwf:duration">
           <type>d:int</type>
        </property>
     </properties>
  </aspect>

然后,你应该将其绑定为:

<type name="cwf:submitLeaveTask">
        <parent>bpm:startTask</parent>
        <properties>
            <property name="cwf:leaveDescription">
                <type>d:text</type>
            </property>
            <property name="cwf:leaveType">
                <type>d:text</type>
                <mandatory>true</mandatory>
                <constraints>
                    <constraint name="cwf:leaveType" type="LIST">
                        <parameter name="allowedValues">
                            <list>
                                <value>paid leave</value>
                                <value>sick leave</value>
                            </list>
                        </parameter>
                    </constraint>
                </constraints>
            </property>
        </properties>
        <mandatory-aspects>
           <aspect>cwf:myAspect</aspect>
        </mandatory-aspects>
    </type>

答案 1 :(得分:1)

在第二个任务中,你必须这样做:

<parent>bpm:cwf:submitLeaveTask</parent>

这将继承第一个表单/任务的字段。