getRerunList.xsl 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2016
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  15. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  16. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  17. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  18. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  19. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  20. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  21. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  22. xmlns:ms="http://developer.cognos.com/schemas/monitorService/1"
  23. exclude-result-prefixes="xsl xts send cm xtsext SOAP-ENV SOAP-ENC ms bus xsi">
  24. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  25. <xsl:template match="/">
  26. <xts:sequence>
  27. <xts:append>
  28. <xsl:variable name="eventID">
  29. <xsl:choose>
  30. <xsl:when test="string(/root/env/param[@name='restartEventID']) != ''">
  31. <xsl:value-of select="/root/env/param[@name='restartEventID']"/>
  32. </xsl:when>
  33. <xsl:when test="string(/root/env/param[@name='eventID']) != ''">
  34. <xsl:value-of select="/root/env/param[@name='eventID']"/>
  35. </xsl:when>
  36. <xsl:when test="string(/root/cm:queryResponse/cm:queryReply[1]/cm:history/cm:restartEventID) != ''">
  37. <xsl:value-of select="/root/cm:queryResponse/cm:queryReply[1]/cm:history/cm:restartEventID"/>
  38. </xsl:when>
  39. <xsl:when test="string(/root/cm:queryResponse/cm:queryReply[1]/cm:history/cm:ownerEventID) != ''">
  40. <xsl:value-of select="/root/cm:queryResponse/cm:queryReply[1]/cm:history/cm:ownerEventID"/>
  41. </xsl:when>
  42. <xsl:otherwise>
  43. <xsl:value-of select="/root/cm:queryResponse/cm:queryReply[1]/cm:history/cm:eventID"/>
  44. </xsl:otherwise>
  45. </xsl:choose>
  46. </xsl:variable>
  47. <rerunList>
  48. <xsl:if test="$eventID!=''">
  49. <send:request provider="monitorService" responseEnvelope="true">
  50. <ms:runSpecification>
  51. <bus:specification xsi:type="bus:monitorServiceSpecification">
  52. <bus:value xsi:type="bus:specification">
  53. <xts:transform name="XMLEncode">
  54. <queryEventSpecification>
  55. <scope>
  56. <xsl:choose>
  57. <!-- for agents and jobs we need to the information about the steps -->
  58. <xsl:when test="contains(' jobDefinition agentDefinition agentDefinitionView ',concat(' ',/root/env/param[@name='m_class'],' '))">
  59. <restartParentEventID>
  60. <xsl:value-of select="$eventID"/>
  61. </restartParentEventID>
  62. </xsl:when>
  63. <xsl:otherwise>
  64. <restartEventID>
  65. <xsl:value-of select="$eventID"/>
  66. </restartEventID>
  67. </xsl:otherwise>
  68. </xsl:choose>
  69. </scope>
  70. <filters/>
  71. </queryEventSpecification>
  72. </xts:transform>
  73. </bus:value>
  74. </bus:specification>
  75. <bus:parameterValues xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:parameterValue[]"/>
  76. <bus:options SOAP-ENC:arrayType="bus:option[]" xsi:type="SOAP-ENC:Array">
  77. <item xsi:type="bus:asynchOptionInt">
  78. <bus:name xsi:type="bus:asynchOptionEnum">primaryWaitThreshold</bus:name>
  79. <bus:value xsi:type="xsd:int">0</bus:value>
  80. </item>
  81. <item xsi:type="bus:pagingOptionInt">
  82. <bus:name xsi:type="bus:pagingOptionEnum">maximumObjects</bus:name>
  83. <bus:value xsi:type="xsd:int">0</bus:value>
  84. </item>
  85. </bus:options>
  86. </ms:runSpecification>
  87. </send:request>
  88. </xsl:if>
  89. </rerunList>
  90. </xts:append>
  91. <!--
  92. release the conversation we just started since the UI doesn't support paging so
  93. there's no need to keep the conversation alive.
  94. -->
  95. <xts:append>
  96. <releasedConversation>
  97. <xts:request href="bus://dispatcher" faultBlock="eatFault" protocol="BUS" soapAction="http://www.ibm.com/xmlns/prod/cognos/monitorService/201610/.absolute" responseEnvelope="false" outputHeader="false">
  98. <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  99. <SOAP-ENV:Header>
  100. <bus:biBusHeader xsi:type="bus:biBusHeader" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  101. <!-- copy in the tracking info from the runSpecification response -->
  102. <xts:queryNode select="/root/rerunList/*[local-name()='Envelope']/*[local-name()='Header']/*[local-name()='biBusHeader']/*[local-name() = 'tracking']"/>
  103. <xsl:apply-templates select="/root/header/bus:biBusHeader/*[local-name()!='tracking']"/>
  104. </bus:biBusHeader>
  105. </SOAP-ENV:Header>
  106. <SOAP-ENV:Body>
  107. <xsl:element name="release" namespace="http://developer.cognos.com/schemas/monitorService/1">
  108. <conversation xsi:type="bus:asynchRequest">
  109. <!-- copy the primaryRequest returned in the runSpecification response -->
  110. <xts:queryNode select="/root/rerunList/*[local-name()='Envelope']/*[local-name()='Body']/*/*[local-name()='result']/*[local-name()='primaryRequest']/*"/>
  111. </conversation>
  112. </xsl:element>
  113. </SOAP-ENV:Body>
  114. </SOAP-ENV:Envelope>
  115. </xts:request>
  116. </releasedConversation>
  117. </xts:append>
  118. <xts:delete select="/root/rerunList/*[local-name()='Envelope']/*[local-name()='Header']"/>
  119. </xts:sequence>
  120. </xsl:template>
  121. <!-- used to copy the bus header stuff - see "apply-templates" above. -->
  122. <xsl:template match="*">
  123. <xsl:copy>
  124. <xsl:copy-of select="@*"/>
  125. <xsl:apply-templates/>
  126. </xsl:copy>
  127. </xsl:template>
  128. </xsl:stylesheet>