schedule.xslt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cogadmin
  5. (C) Copyright IBM Corp. 2005, 2010
  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. <!-- This stylesheet defines variables and templates used in the schedule pages -->
  13. <xsl:stylesheet version="1.0"
  14. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  15. xmlns:out="dummy-uri"
  16. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  17. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  18. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  19. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  20. xmlns:cogadminext="xalan://com.cognos.admin.xts.ext.XTSExt"
  21. xmlns:sch="http://developer.cognos.com/schemas/xts/schedule"
  22. exclude-result-prefixes="xsl xtsext xts">
  23. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  24. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  25. <!--
  26. Template used to query histories from a list of object path
  27. It also calculates the the duration for the last successful execution
  28. It used the following var to be defined when the xsl (see out prefix) is executed
  29. - searchPath: contains the list of path to the objects with histories
  30. - noHistoryMsgForLastExcutionTime: message to be displayed when no history is found for a given path.
  31. - maxHistoryObjects: max number of objects returned by cm
  32. The following node are also required from within the block:
  33. - asyncRequestResponse: result from the JSM query,
  34. - header: used to build the cm query,
  35. - session: used to get the locales
  36. -->
  37. <xsl:template match="sch:queryHistoriesFromScheduledActvities">
  38. <xts:append select="/root">
  39. <xts:transform src="cogadmin/controls/transforms/calculate_history_duration.xslt" processor="XSLT">
  40. <activityHistory>
  41. <out:if test="count($searchPath) > 0">
  42. <productLocale><out:value-of select="/root/session/param[@name='productLocale']"/></productLocale>
  43. <contentLocale><out:value-of select="/root/session/param[@name='contentLocale']"/></contentLocale>
  44. <noHistoryForLastExcutionTime><out:value-of select="$noHistoryMsgForLastExcutionTime"/></noHistoryForLastExcutionTime>
  45. <out:for-each select="$searchPath">
  46. <schedule>
  47. <path><out:value-of select="."/></path>
  48. </schedule>
  49. </out:for-each>
  50. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  51. <send:request provider="cm">
  52. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  53. <cm:query>
  54. <cm:requests>
  55. <out:for-each select="$searchPath">
  56. <cm:query>
  57. <cm:search><out:value-of select="concat(current(),'/history')"/>[@status='succeeded']</cm:search>
  58. <cm:properties>
  59. <cm:property name="actualExecutionTime"/>
  60. <cm:property name="actualCompletionTime"/>
  61. <cm:property name="parent"/>
  62. </cm:properties>
  63. <cm:options>
  64. <cm:maxObjects><out:value-of select="$maxHistoryObjects"/></cm:maxObjects>
  65. </cm:options>
  66. <cm:sortBy>
  67. <cm:sort name="actualExecutionTime" order="descending"/>
  68. </cm:sortBy>
  69. </cm:query>
  70. </out:for-each>
  71. </cm:requests>
  72. </cm:query>
  73. </xts:transform>
  74. </send:request>
  75. </xts:transform>
  76. </out:if>
  77. </activityHistory>
  78. </xts:transform>
  79. </xts:append>
  80. </xsl:template>
  81. <xsl:template match="*">
  82. <xsl:copy>
  83. <xsl:copy-of select="@*"/>
  84. <xsl:apply-templates/>
  85. </xsl:copy>
  86. </xsl:template>
  87. </xsl:stylesheet>