metadataRequest.xts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2008
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xts:morphlet resolverBase="prompting" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml" requiredCapability="canUseEventStudio">
  9. <!-- place the specificiation we want into the DOM -->
  10. <xts:block id="buildSpecification" processor="XSLT" type="exec">
  11. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  12. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  13. <xsl:template match="/">
  14. <xts:sequence>
  15. <xts:append>
  16. <specification>
  17. <xsl:choose>
  18. <xsl:when test="/root/env/param[@name='memberRequest'] and /root/env/param[@name='memberRequest'] != ''">
  19. <xsl:call-template name="buildMemberRequest"/>
  20. </xsl:when>
  21. <xsl:otherwise>
  22. <xsl:call-template name="buildMetadataRequest"/>
  23. </xsl:otherwise>
  24. </xsl:choose>
  25. </specification>
  26. </xts:append>
  27. </xts:sequence>
  28. </xsl:template>
  29. <xsl:template name="buildMetadataRequest">
  30. &lt;metadataRequest connection=&quot;<xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='model']))"/>&quot;&gt;
  31. &lt;Metadata authoringLocale=&quot;<xsl:value-of select="/root/env/param[@name='el']"/>&quot; xml:lang=&quot;<xsl:value-of select="/root/env/param[@name='pl']"/>&quot; start_at=&quot;<xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='startAtPath']))"/>&quot; Depth=&quot;<xsl:value-of select="/root/env/param[@name='depth']"/>&quot; no_collections=&quot;1&quot; _enumLabels=&quot;1&quot; &gt;
  32. &lt;Properties&gt;
  33. &lt;Property name=&quot;/@decimalSeparator&quot;/&gt;
  34. &lt;Property name=&quot;/@listSeparator&quot;/&gt;
  35. &lt;Property name=&quot;*/@name&quot;/&gt;
  36. &lt;Property name=&quot;*/@_path&quot;/&gt;
  37. &lt;Property name=&quot;*/@_ref&quot;/&gt;
  38. &lt;Property name=&quot;*/@isNamespace&quot;/&gt;
  39. &lt;Property name=&quot;*/@screenTip&quot;/&gt;
  40. &lt;Property name=&quot;./folder&quot;/&gt;
  41. &lt;Property name=&quot;./measureFolder&quot;/&gt;
  42. &lt;Property name=&quot;./calculation&quot;/&gt;
  43. &lt;Property name=&quot;./filter&quot;/&gt;
  44. &lt;Property name=&quot;./querySubject&quot;/&gt;
  45. &lt;Property name=&quot;./queryItem&quot;/&gt;
  46. &lt;Property name=&quot;./queryItemFolder&quot;/&gt;
  47. &lt;Property name=&quot;*/@datatype&quot;/&gt;
  48. &lt;Property name=&quot;*/@usage&quot;/&gt;
  49. &lt;Property name=&quot;*/@regularAggregate&quot;/&gt;
  50. &lt;Property name=&quot;*/@promptType&quot;/&gt;
  51. &lt;Property name=&quot;*/@promptFilterItemRef&quot;/&gt;
  52. &lt;Property name=&quot;*/@promptDisplayItemRef&quot;/&gt;
  53. &lt;Property name=&quot;*/@promptCascadeOnRef&quot;/&gt;
  54. &lt;Property name=&quot;*/@displayType&quot;/&gt;
  55. &lt;Property name=&quot;*/@semiAggregate&quot;/&gt;
  56. &lt;Property name=&quot;*/@sortOnRef&quot;/&gt;
  57. &lt;Property name=&quot;*/@_IntrinsicPropertiesOff&quot;/&gt;
  58. &lt;Property name=&quot;*/@parentChild&quot;/&gt;
  59. &lt;Property name=&quot;*/@calcType&quot;/&gt;
  60. &lt;Property name=&quot;measure/@isHierarchical&quot;/&gt;
  61. &lt;Property name=&quot;dimension/@type&quot;/&gt;
  62. &lt;Property name=&quot;./dimension&quot;/&gt;
  63. &lt;Property name=&quot;./hierarchy&quot;/&gt;
  64. &lt;Property name=&quot;./hierarchyFolder&quot;/&gt;
  65. &lt;Property name=&quot;./level&quot;/&gt;
  66. &lt;Property name=&quot;./measure&quot;/&gt;
  67. &lt;/Properties&gt;
  68. &lt;/Metadata&gt;
  69. &lt;/metadataRequest&gt;
  70. </xsl:template>
  71. <!-- build the member request -->
  72. <xsl:template name="buildMemberRequest">
  73. <xsl:variable name="case_sensitive">
  74. <xsl:choose>
  75. <xsl:when test="/root/env/param[@name='case_sensitive'] and /root/env/param[@name='case_sensitive']='true'">
  76. <xsl:text>true</xsl:text>
  77. </xsl:when>
  78. <xsl:otherwise>
  79. <xsl:text>false</xsl:text>
  80. </xsl:otherwise>
  81. </xsl:choose>
  82. </xsl:variable>
  83. &lt;metadataRequest connection=&quot;<xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='model']))"/>&quot;&gt;
  84. &lt;Metadata authoringLocale=&quot;<xsl:value-of select="/root/env/param[@name='cl']"/>&quot; xml:lang=&quot;<xsl:value-of select="/root/env/param[@name='pl']"/>&quot; Depth=&quot;<xsl:value-of select="/root/env/param[@name='depth']"/>&quot; start_atPath=&quot;<xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='startAtPath']))"/>&quot; ResultStart=&quot;0&quot; ResultCount=&quot;<xsl:value-of select="string(number(/root/env/param[@name='memberDisplayCountLimit'])+1)"/>&quot;&gt;
  85. &lt;Properties&gt;
  86. &lt;Property name=&quot;./dimension&quot;/&gt;
  87. &lt;Property name=&quot;./hierarchy&quot;/&gt;
  88. &lt;Property name=&quot;./level&quot;/&gt;
  89. &lt;Property name=&quot;./member&quot;/&gt;
  90. &lt;Property name=&quot;./folder&quot;/&gt;
  91. &lt;Property name=&quot;./@_RootMembers&quot;/&gt;
  92. &lt;Property name=&quot;*/@name&quot;/&gt;
  93. &lt;Property name=&quot;*/@_path&quot;/&gt;
  94. &lt;Property name=&quot;*/@_ref&quot;/&gt;
  95. &lt;Property name=&quot;*/@memberUniqueName&quot;/&gt;
  96. &lt;Property name=&quot;*/@memberCaption&quot;/&gt;
  97. &lt;Property name=&quot;*/@levelUniqueName&quot;/&gt;
  98. &lt;Property name=&quot;*/@levelNumber&quot;/&gt;
  99. &lt;Property name=&quot;*/@levelLabel&quot;/&gt;
  100. &lt;Property name=&quot;*/@parentUniqueName&quot;/&gt;
  101. &lt;Property name=&quot;*/@currencyCode&quot;/&gt;
  102. &lt;/Properties&gt;
  103. <!-- build the filter if there is one -->
  104. <xsl:if test="/root/env/param[@name='filter'] and not(/root/env/param[@name='filter'] = '')">
  105. &lt;Constraints&gt;
  106. <xsl:choose>
  107. <xsl:when test="/root/env/param[@name='filter_type'] = 'equals' ">
  108. &lt;Constraint Condition=&quot;[@memberCaption=&apos;<xsl:value-of select="xtsext:xmlencode(/root/env/param[@name='filter'])"/>&apos;]&quot; CaseSensitive=&quot;<xsl:value-of select="$case_sensitive"/>&quot;/&gt;
  109. </xsl:when>
  110. <xsl:otherwise>
  111. &lt;Constraint Condition=&quot;[<xsl:value-of select="/root/env/param[@name='filter_type']"/>(@memberCaption,&apos;<xsl:value-of select="xtsext:xmlencode(/root/env/param[@name='filter'])"/>&apos;)]&quot; CaseSensitive=&quot;<xsl:value-of select="$case_sensitive"/>&quot;/&gt;
  112. </xsl:otherwise>
  113. </xsl:choose>
  114. &lt;/Constraints&gt;
  115. </xsl:if>
  116. &lt;/Metadata&gt;
  117. &lt;/metadataRequest&gt;
  118. </xsl:template>
  119. </xsl:stylesheet>
  120. </xts:block>
  121. <!--call the getExternalRequest to see if the request came from the /ext entry point -->
  122. <xts:block id="getExternalRequest" dependency="buildSpecification" processor="XSLT" type="exec">
  123. <xts:logicsheet path="logicsheets/portal.xsl"/>
  124. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" exclude-result-prefixes="pf">
  125. <pf:variables/>
  126. <xsl:template match="/">
  127. <xts:sequence>
  128. <xts:append>
  129. <externalRequest>
  130. <xts:function name="getRequestExternal" xmlns:xts="http://developer.cognos.com/schemas/xts/">
  131. <xts:param name="passport">
  132. <xsl:value-of select="$passport"/>
  133. </xts:param>
  134. <xts:param name="secureState">
  135. <xsl:value-of select="/root/header/*[local-name()='biBusHeader']/*[local-name()='CAF']/*[local-name()='secureState']"/>
  136. </xts:param>
  137. </xts:function>
  138. </externalRequest>
  139. </xts:append>
  140. </xts:sequence>
  141. </xsl:template>
  142. </xsl:stylesheet>
  143. </xts:block>
  144. <!-- depending on the output of the getExternalRequest request - sign the request -->
  145. <xts:block id="signSpecification" dependency="getExternalRequest" processor="XSLT" type="exec">
  146. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  147. <xsl:template match="/">
  148. <xts:sequence>
  149. <xts:append>
  150. <signedSpec>
  151. <xsl:choose>
  152. <xsl:when test="/root/getRequestExternalResponse">
  153. <xts:function name="signReportSpec" xmlns:xts="http://developer.cognos.com/schemas/xts/">
  154. <xts:param name="source">
  155. <xsl:value-of select="/root/specification"/>
  156. </xts:param>
  157. </xts:function>
  158. </xsl:when>
  159. <xsl:otherwise>
  160. <xsl:value-of select="/root/specification"/>
  161. </xsl:otherwise>
  162. </xsl:choose>
  163. </signedSpec>
  164. </xts:append>
  165. </xts:sequence>
  166. </xsl:template>
  167. </xsl:stylesheet>
  168. </xts:block>
  169. <xts:block id="makeRequest" dependency="signSpecification" mode="output" mimeType="text/xml" processor="XSLT" type="exec">
  170. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  171. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  172. <!-- build the metadata request -->
  173. <xsl:template match="/">
  174. <xsl:call-template name="buildMetadataRequest"/>
  175. </xsl:template>
  176. <!-- call the template which is going to make the function tree request -->
  177. <xsl:template name="buildMetadataRequest">
  178. <bus:value xsi:type="bus:specification" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  179. <xsl:value-of select="/root/signedSpec"/>
  180. </bus:value>
  181. </xsl:template>
  182. </xsl:stylesheet>
  183. </xts:block>
  184. </xts:morphlet>