Alfresco: Показать поля задачи в другой задаче (просмотреть их)

Я развертываю новый рабочий процесс на 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 в своей форме. Что не так и как мне поступить?


person amir.sh    schedule 30.04.2013    source источник


Ответы (2)


Вы не можете видеть эти свойства, потому что вы поместили их в поле свойства 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>

Then, you should bind that as this:

<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>
person Teqnology    schedule 30.04.2013
comment
Хорошо, я добавил этот аспект и к своей второй задаче, после этого я мог видеть поля, однако они были редактируемыми, и я использовал информационный шаблон для их просмотра, и теперь он работает. Спасибо большое. - person amir.sh; 01.05.2013

Во втором задании нужно сделать:

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

Это унаследует поле первой формы/задачи.

person Itamar Ribeiro    schedule 04.05.2016