generateCMQueriesForContentTaskInfo.xslt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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, 2013
  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. <!--
  13. NOTE: The logic to determine the order of the queries MUST match the logic found in dt:generateInitialUIHelpers
  14. if checkUIHelpers is true, then only build the CM query if the associated UIHelper is empty.
  15. -->
  16. <xsl:stylesheet version="1.0"
  17. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  18. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  19. xmlns:set="http://exslt.org/sets"
  20. exclude-result-prefixes="xsl cm set">
  21. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  22. <xsl:key name="option-value" match="/root/*[local-name()='options']/*[local-name()='value']/*[local-name()='item']/*[local-name()='value']" use="../*[local-name()='name']"/>
  23. <xsl:template match="*[local-name()='root']" priority="1">
  24. <xsl:variable name="contextSearchPaths" select="set:distinct(/root/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and (./*[local-name()='name']='upgradeClassesContext' or ./*[local-name()='name']='upgradeClassesReferenceContext' or ./*[local-name()='name']='cleanupContentContext')]/*[local-name()='value']/*[local-name()='item'])"/>
  25. <xsl:variable name="isCleanupContentVarient" select="key('option-value','cleanupContent')='true'"/>
  26. <xsl:variable name="willNotWriteToRepository" select="key('option-value','cleanupContentDoNotWriteToRepository')='true'"/>
  27. <xsl:variable name="willUpdateContextObjects" select="key('option-value','cleanupContentUpdateContextObjects') = 'true'"/>
  28. <xsl:variable name="isConsistencyCheck" select="key('option-value','checkSecurityReferences') = 'true' or key('option-value','repairSecurityReferences') = 'true' or key('option-value','checkInternalInconsistencies') = 'true' or key('option-value','repairInternalInconsistencies') = 'true'"/>
  29. <xsl:variable name="contentTaskType">
  30. <xsl:choose>
  31. <xsl:when test="$isConsistencyCheck">consistency</xsl:when>
  32. <xsl:when test="key('option-value', 'upgradeClasses')">reportUpgrade</xsl:when>
  33. <xsl:when test="$isCleanupContentVarient and $willUpdateContextObjects and $willNotWriteToRepository">retentionRuleUpdate</xsl:when>
  34. <xsl:when test="$isCleanupContentVarient and not($willNotWriteToRepository) and not($willUpdateContextObjects)">contentArchival</xsl:when>
  35. <xsl:when test="$isCleanupContentVarient and $willNotWriteToRepository and not($willUpdateContextObjects)">contentRemoval</xsl:when>
  36. <xsl:when test="key('option-value','createContentStoreUtilizationInfo')!=''">createContentUtilizationInfo</xsl:when>
  37. <xsl:otherwise>unknown</xsl:otherwise>
  38. </xsl:choose>
  39. </xsl:variable>
  40. <xsl:choose>
  41. <!-- reportUpgrade -->
  42. <xsl:when test="$contentTaskType='reportUpgrade'">
  43. <env>
  44. <param name="contentTaskType">reportUpgrade</param>
  45. <!-- upgradeClassesContext -->
  46. <xsl:for-each select="key('option-value','upgradeClassesContext')/*[local-name()='item']">
  47. <param name="ctro_checkbox_upgradeClassesContext">
  48. <xsl:value-of select="."/>
  49. </param>
  50. </xsl:for-each>
  51. <!-- upgradeClassesReferenceContext -->
  52. <xsl:for-each select="key('option-value', 'upgradeClassesReferenceContext')/*[local-name()='item']">
  53. <param name="ctro_checkbox_upgradeClassesReferenceContext">
  54. <xsl:value-of select="."/>
  55. </param>
  56. </xsl:for-each>
  57. </env>
  58. </xsl:when>
  59. <xsl:otherwise>
  60. <env>
  61. <param name="contentTaskType"><xsl:value-of select="$contentTaskType"/></param>
  62. </env>
  63. </xsl:otherwise>
  64. </xsl:choose>
  65. <xsl:for-each select="$contextSearchPaths">
  66. <cm:query>
  67. <cm:search><xsl:value-of select="."/></cm:search>
  68. <cm:properties>
  69. <cm:property name="defaultName"/>
  70. <cm:property name="searchPath"/>
  71. <cm:property name="searchPathForURL"/>
  72. <cm:property name="storeID"/>
  73. <cm:property name="userInterfaces"/>
  74. <cm:property name="ancestors"/>
  75. <cm:property name="hidden"/>
  76. </cm:properties>
  77. </cm:query>
  78. </xsl:for-each>
  79. <xsl:if test="$contentTaskType='createContentUtilizationInfo'">
  80. <cm:query>
  81. <cm:search>/directory/tenants[@name='Tenants']/*</cm:search>
  82. <cm:properties>
  83. <cm:property name="defaultName"/>
  84. <cm:property name="tenantID"/>
  85. </cm:properties>
  86. </cm:query>
  87. </xsl:if>
  88. </xsl:template>
  89. <xsl:template match="text()" priority="0"/>
  90. </xsl:stylesheet>