The task is used to retrieve EWM® work item attribute values. Fetch elements designate which work item attributes to retrieve and the name of the Ant property in which to return the attributes’s value. The task fetches the specified work item by workItemId and sets the specified Ant properties with the values of the work item’s attributes.
The task supports Team Build Attributes, Build Extensions Debugging Attributes, Build Extensions General Attributes, as well as, its own task specific attributes. Click on a link for more information on the common attributes.
The following table describes the task specific attributes for the task:
| Task Specific Attributes | ||
| Attribute | Description | Required |
| workItemId | The id of the work item to fetch. | Yes |
Fetch elements are specified within the element. Fetch elements designate which work item attributes to process and the name of the Ant property in which to return the attribute’s value. All Fetch elements are optional. At least one Fetch element is required. A name attribute and property attribute is required for each Fetch element. The name attribute specifies the name of an EWM work item attribute. The property attribute specifies the name of the Ant property in which to return the value of the EWM work item attribute. Some EWM work item attributes have options which are described below.
The following table describes the work item attributes that can be specified via Fetch elements, their name attribute value, their requirements, and their options:
The following table describes the Required Fetch Element Attributes and their possible values:
The following table describes the Optional Fetch Element Attributes and their possible values:
Return approvals array
<target name="task" if="run.task">
<xt:getWorkItem
epositoryAddress="${repositoryAddress}"
userId="${userId}"
passwordFile="${passwordFile}"
processAreaName="IMS_SB_IMS"
workItemId="${workitem}"
>
<xt:fetch name="approvals" property="my.approvalsArray" approvalsArray="true"/>
</xt:getWorkItem>
<echo>approvals: ${my.approvalsArray}</echo>
<ac:if>
<not><equals arg1="${my.approvalsArray}" arg2=""/></not>
<ac:then>
<ac:for begin="1" end="${my.approvalsArray}" param="index">
<sequential>
<echo>approvals: ${my.approvalsArray.approver.@{index}</echo>
<echo>approvals: ${my.approvalsArray.cumstate.@{index}</echo>
<echo>approvals: ${my.approvalsArray.duedate.@{index}</echo>
<echo>approvals: ${my.approvalsArray.name.@{index}</echo>
<echo>approvals: ${my.approvalsArray.state.@{index}</echo>
<echo>approvals: ${my.approvalsArray.type.@{index}</echo>
</sequential>
</ac:for>
</ac:then>
</ac:if>
</target>
Example log:
[echo] approvals: 7
[echo] approvals: djreilly@us.ibm.com
[echo] approvals: Pending
[echo] approvals: 2015-06-01
[echo] approvals: Tech
[echo] approvals: Pending
[echo] approvals: Review
[echo] approvals: mra@us.ibm.com
[echo] approvals: Pending
[echo] approvals: 2015-06-01
[echo] approvals: Tech
[echo] approvals: Pending
[echo] approvals: Review
[echo] approvals: tlk@us.ibm.com
[echo] approvals: Pending
[echo] approvals: 2015-06-01
[echo] approvals: Tech
[echo] approvals: Pending
[echo] approvals: Review
[echo] approvals: djreilly@us.ibm.com
[echo] approvals: Pending
[echo] approvals: 2015-06-01
[echo] approvals: Test
[echo] approvals: Pending
[echo] approvals: Review
[echo] approvals: djreilly@us.ibm.com
[echo] approvals: Pending
[echo] approvals: 2015-06-01
[echo] approvals: Doc
[echo] approvals: Pending
[echo] approvals: Review
[echo] approvals: djreilly@us.ibm.com
[echo] approvals: Pending
[echo] approvals: 2015-06-01
[echo] approvals: Japan
[echo] approvals: Pending
[echo] approvals: Review
[echo] approvals: djreilly@us.ibm.com
[echo] approvals: Pending
[echo] approvals: 2015-06-01
[echo] approvals: SSC
[echo] approvals: Pending
[echo] approvals: Approval
Return approvals JSON:
<target name="task" if="run.task">
<xt:getWorkItem
repositoryAddress="${repositoryAddress}"
userId="${userId}"
passwordFile="${passwordFile}"
processAreaName="IMS_SB_IMS"
workItemId="${workitem}"
>
<xt:fetch name="approvals" property="my.approvalsJson" approvalsJson="true"/>
</xt:getWorkItem>
<echo>approvals: ${my.approvalsJson}</echo>
</target>
Example log:
[echo] approvals: {
[echo] "Doc": [
[echo] {
[echo] "approver": "djreilly@us.ibm.com",
[echo] "cumstate": "Pending",
[echo] "duedate": "2015-06-01",
[echo] "state": "Pending",
[echo] "type": "Review"
[echo] }
[echo] ],
[echo] "Japan": [
[echo] {
[echo] "approver": "djreilly@us.ibm.com",
[echo] "cumstate": "Pending",
[echo] "duedate": "2015-06-01",
[echo] "state": "Pending",
[echo] "type": "Review"
[echo] }
[echo] ],
[echo] "SSC": [
[echo] {
[echo] "approver": "djreilly@us.ibm.com",
[echo] "cumstate": "Pending",
[echo] "duedate": "2015-06-01",
[echo] "state": "Pending",
[echo] "type": "Approval"
[echo] }
[echo] ],
[echo] "Tech": [
[echo] {
[echo] "approver": "djreilly@us.ibm.com",
[echo] "cumstate": "Pending",
[echo] "duedate": "2015-06-01",
[echo] "state": "Pending",
[echo] "type": "Review"
[echo] },
[echo] {
[echo] "approver": "mra@us.ibm.com",
[echo] "cumstate": "Pending",
[echo] "duedate": "2015-06-01",
[echo] "state": "Pending",
[echo] "type": "Review"
[echo] },
[echo] {
[echo] "approver": "tlk@us.ibm.com",
[echo] "cumstate": "Pending",
[echo] "duedate": "2015-06-01",
[echo] "state": "Pending",
[echo] "type": "Review"
[echo] }
[echo] ],
[echo] "Test": [
[echo] {
[echo] "approver": "djreilly@us.ibm.com",
[echo] "cumstate": "Pending",
[echo] "duedate": "2015-06-01",
[echo] "state": "Pending",
[echo] "type": "Review"
[echo] }
[echo] ]
[echo] }
Check APAR work item close data:
<target name="task" if="run.task">
<xt:getWorkItem
repositoryAddress="${repositoryAddress}"
userId="${userId}"
passwordFile="${passwordFile}"
processAreaName="IMS_SB_IMS"
workItemId="${workitem}"
>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftCloseCode" property="CloseCode"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftReasonCode" property="ReasonCode"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftUsersAffected" property="UsersAffected"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftAdditionalProblemSummary" property="ProblemSummary"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftProblemDescription" property="ProblemDescription"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftProblemConclusion" property="ProblemConclusion"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftRecommendation" property="Recommendation"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftSrls" property="Srls"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftCommittedFixRelease" property="FixRelease"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftFailingLvl" property="FailingLvl"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftFailingModule" property="FailingModule"/>
<xt:fetch name="custom" custom="com.ibm.sport.rtc.workItem.attribute.apar.draftSupportCode" property="SupportCode"/>
</xt:getWorkItem>
<ac:if><equals arg1="${CloseCode}" arg2="<Unassigned>"/> <ac:then><BuildActivity label="Unassigned: CloseCode"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${ReasonCode}" arg2="<Unassigned>"/> <ac:then><BuildActivity label="Unassigned: ReasonCode"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${UsersAffected}" arg2=""/> <ac:then><BuildActivity label="Null value for UsersAffected"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${ProblemSummary}" arg2=""/> <ac:then><BuildActivity label="Null value for ProblemSummary"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${ProblemDescription}" arg2=""/> <ac:then><BuildActivity label="Null value for ProblemDescription"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${ProblemConclusion}" arg2=""/> <ac:then><BuildActivity label="Null value for ProblemConclusion"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${Recommendation}" arg2=""/> <ac:then><BuildActivity label="Null value for Recommendation"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${Srls}" arg2=""/> <ac:then><BuildActivity label="Null value for Srls"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${FixRelease}" arg2=""/> <ac:then><BuildActivity label="Null value for FixRelease"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${FailingLvl}" arg2=""/> <ac:then><BuildActivity label="Null value for FailingLvl"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${FailingModule}" arg2=""/> <ac:then><BuildActivity label="Null value for FailingModule"/> <property name="error" value="true"/></ac:then></ac:if>
<ac:if><equals arg1="${SupportCode}" arg2=""/> <ac:then><BuildActivity label="Null value for CloseCode"/> <property name="error" value="true"/></ac:then></ac:if>
<fail message="Work item ${workitem} is missing some or all closing data.">
<condition>
<istrue value="${error}"/>
</condition>
</fail>
<BuildActivity label="Work Item ${workitem} closing data is complete"/>
</target>