create.xts 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ASV
  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. ===============================================================================================
  10. Creates an agent in CM based on parameters passed in.
  11. Structure:
  12. AgentDefinition (createAgentDefinition) _______ agentTaskDefinition(createAgentTaskDefinitions) _______ N x AgentActions
  13. Agent(AgentDefinition) is what takes the schedule - and also holds the condition for the agent
  14. AgentTaskDefinition is the definition of the actions for the agent
  15. ===============================================================================================
  16. -->
  17. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" requiredCapability="canUseConditionalSubscriptions">
  18. <!--
  19. ===============================================================================================
  20. doCreateAgent
  21. A block to take care of the creation of the Agent - this is an agentDefinition Object in CM
  22. ===============================================================================================
  23. -->
  24. <xts:block id="doCreateAgentDefinition" processor="XSLT" type="exec">
  25. <xts:logicsheet path="portal/iFrmCmd/logicsheets/cm-save.xsl"/>
  26. <xts:logicsheet path="logicsheets/portal.xsl"/>
  27. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  28. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:form="http://developer.cognos.com/schemas/xts/subscribe/iFrmCmd/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="cms xts send cm pf form xtsext bus">
  29. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  30. <pf:variables/>
  31. <!-- global application variables -->
  32. <xsl:template match="/">
  33. <xsl:apply-templates select="root/command/form:create/form:env"/>
  34. </xsl:template>
  35. <xsl:template match="form:env">
  36. <!-- this is the class of the new object -->
  37. <xts:sequence>
  38. <!-- prepare and send the add request -->
  39. <xts:append select="/root">
  40. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  41. <send:request provider="cm" faultBlock="createFault">
  42. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  43. <cm:add>
  44. <cm:search>
  45. <xsl:value-of select="form:param[@name='m_p_path']"/>
  46. </cm:search>
  47. <cm:objects>
  48. <cm:reportDataServiceAgentDefinition>
  49. <!-- apply templates to define the screen tips and descriptions -->
  50. <xsl:apply-templates/>
  51. <!-- create the report property -->
  52. <cm:report>
  53. <xts:transform name="XMLEncode">
  54. <xts:transform src="subscribe/transforms/assembleSelectionSpec.xslt" processor="XSLT">
  55. <root>
  56. <env>
  57. <xsl:copy-of select="/root/env/param[starts-with(@name, 'm_sub')]"/>
  58. </env>
  59. <xts:transform name="XMLDecode">
  60. <xsl:value-of select="/root/env/param[@name='m_subData_report']"/>
  61. </xts:transform>
  62. </root>
  63. </xts:transform>
  64. </xts:transform>
  65. </cm:report>
  66. <!-- set the sequencing - this is part of the agent_definition -->
  67. </cm:reportDataServiceAgentDefinition>
  68. </cm:objects>
  69. <cm:options>
  70. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  71. </cm:options>
  72. </cm:add>
  73. </xts:transform>
  74. </send:request>
  75. </xts:transform>
  76. </xts:append>
  77. <xts:append select="/root/env">
  78. <param name="m_schedule_owner_reset">
  79. <xsl:text>true</xsl:text>
  80. </param>
  81. </xts:append>
  82. </xts:sequence>
  83. </xsl:template>
  84. <!-- template to create an item - and alter the name of the object -->
  85. <xsl:template match="form:param[starts-with(@name,'m_p_')]">
  86. <!-- create an element for each property passed in -->
  87. <xsl:element name="{substring-after(@name, 'm_p_')}" xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  88. <!-- name is the on CM property that must be encoded *before* giving to CM -->
  89. <xsl:value-of select="."/>
  90. </xsl:element>
  91. </xsl:template>
  92. <cms:prop-save/>
  93. <xsl:template match="text()"/>
  94. <!-- template to make the key items into something which pre-process can make -->
  95. <cms:build_keyItems/>
  96. </xsl:stylesheet>
  97. </xts:block>
  98. <!--
  99. ===============================================================================================
  100. doCreateAgentSchedule
  101. A block to take care of the creation of the schedule which needs to be added to the Agent
  102. ===============================================================================================
  103. -->
  104. <xts:block id="doCreateAgentSchedule" dependency="doCreateAgentDefinition" condition=".[not(root/copyFault) and not(root/fault)]" processor="XSLT" type="exec" mandatory="false">
  105. <xts:logicsheet path="portal/iFrmCmd/logicsheets/cm-save.xsl"/>
  106. <xts:logicsheet path="logicsheets/portal.xsl"/>
  107. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  108. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:form="http://developer.cognos.com/schemas/xts/subscribe/iFrmCmd/1/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" exclude-result-prefixes="xsl SOAP-ENC xsi cms send cm form bus xtsext pf">
  109. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  110. <pf:variables/>
  111. <xsl:template match="/">
  112. <xsl:apply-templates select="root/command/form:create/form:env"/>
  113. </xsl:template>
  114. <xsl:template match="form:env">
  115. <xts:sequence>
  116. <xts:append select="/root">
  117. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  118. <send:request provider="cm" faultBlock="createFault">
  119. <bus:add>
  120. <search xsi:type="xsd:string">
  121. <!-- attach the schedule onto the anget - not the report -->
  122. <xsl:value-of select="/root/cm:addResponse/cm:reportDataServiceAgentDefinition/cm:searchPath"/>
  123. </search>
  124. <objects xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:baseClass[1]">
  125. <item xsi:type="bus:schedule">
  126. <!-- build the normal schedule params -->
  127. <xsl:call-template name="build_jsm_schedule">
  128. <xsl:with-param name="env" select="."/>
  129. </xsl:call-template>
  130. <periodicalProducer xsi:type="cm:baseClassArrayProp">
  131. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseClass[1]">
  132. <item xsi:type="cm:report">
  133. <searchPath xsi:type="cm:stringProp">
  134. <value xsi:type="xsd:string">
  135. <xsl:value-of select="form:param[@name='m_sp_periodicalProducer']"/>
  136. </value>
  137. </searchPath>
  138. </item>
  139. </value>
  140. </periodicalProducer>
  141. </item>
  142. </objects>
  143. </bus:add>
  144. </send:request>
  145. </xts:transform>
  146. </xts:append>
  147. </xts:sequence>
  148. </xsl:template>
  149. <!-- pull in any templates to handle "special" properties on CM objects -->
  150. <cms:prop-save/>
  151. <xsl:template match="text()"/>
  152. </xsl:stylesheet>
  153. </xts:block>
  154. <!--
  155. ================================================================================
  156. doCreateAgentMemoSubObjects
  157. a block which creates memo subobjects which are allowed to be under the agent
  158. ===============================================================================================
  159. -->
  160. <xts:block id="doCreateAgentMemoSubObjects" dependency="doCreateAgentSchedule" processor="XSLT" type="exec" mandatory="false" condition=".[not(root/copyFault) and not(root/fault) and ((/root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and @name='m_sub_type']='nonMetric' and /root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and @name = 'm_subData_emailCB']) or (/root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and @name='m_sub_type']='metric' and /root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and starts-with(@name, 'm_subData_emailCB_')])) ]">
  161. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  162. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  163. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:form="http://developer.cognos.com/schemas/xts/subscribe/iFrmCmd/1/" exclude-result-prefixes="send xtsext form">
  164. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  165. <xsl:template match="/">
  166. <xsl:apply-templates select="root/command/form:create/form:env"/>
  167. </xsl:template>
  168. <xsl:template match="form:env">
  169. <xts:sequence>
  170. <xts:append select="/root">
  171. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  172. <send:request provider="cm" faultBlock="createFault">
  173. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  174. <cm:add xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  175. <cm:objects>
  176. <cm:memo>
  177. <cm:searchPath>
  178. <!-- attach the memo to the agent - not the report -->
  179. <xsl:value-of select="/root/cm:addResponse/cm:reportDataServiceAgentDefinition/cm:searchPath"/>
  180. </cm:searchPath>
  181. <cm:defaultName>
  182. <xsl:value-of select="form:param[@name='taskName']"/>
  183. </cm:defaultName>
  184. <!-- just copy the options that we've got -->
  185. <xts:transform name="XMLDecode">
  186. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(form:param[@name='deliveryOptions'])), true())"/>
  187. </xts:transform>
  188. </cm:memo>
  189. </cm:objects>
  190. </cm:add>
  191. </xts:transform>
  192. </send:request>
  193. </xts:transform>
  194. </xts:append>
  195. <xts:append select="/root">
  196. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  197. <send:request provider="cm" faultBlock="createFault">
  198. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  199. <cm:add xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  200. <cm:objects>
  201. <cm:agentTaskDefinition>
  202. <cm:searchPath>
  203. <!-- attach the memo to the agent - not the report -->
  204. <xsl:value-of select="/root/cm:addResponse/cm:reportDataServiceAgentDefinition/cm:searchPath"/>
  205. </cm:searchPath>
  206. <!-- we can save the taskName too -->
  207. <cm:taskObject>
  208. <cm:memo>
  209. <cm:searchPath>
  210. <!-- put the path into the report that we selected as the action,
  211. queryValue decodes the search path so we must explicitly encode it -->
  212. <xts:function name="xmlencode">
  213. <xts:param name="source">
  214. <xts:queryValue select="/root/*[local-name()='addResponse']/*[local-name()='memo']/*[local-name()='searchPath']"/>
  215. </xts:param>
  216. </xts:function>
  217. </cm:searchPath>
  218. </cm:memo>
  219. </cm:taskObject>
  220. <!-- define the filter data item name -->
  221. <cm:filterDataItemName>
  222. <xsl:if test="/root/env/param[starts-with(@name,'m_subData_emailCB_')]">
  223. <xsl:variable name="max" select="count(/root/env/param[starts-with(@name,'m_subData_emailCB_')])"/>
  224. <xsl:text>[</xsl:text>
  225. <xsl:for-each select="/root/env/param[starts-with(@name,'m_subData_emailCB_')]">
  226. <xsl:sort select="@name"/>
  227. <xsl:value-of select="substring-after(@name,'m_subData_emailCB_')"/>
  228. <xsl:if test="position() &lt; $max">
  229. <xsl:text>OR</xsl:text>
  230. </xsl:if>
  231. </xsl:for-each>
  232. <xsl:text>]</xsl:text>
  233. </xsl:if>
  234. </cm:filterDataItemName>
  235. </cm:agentTaskDefinition>
  236. </cm:objects>
  237. </cm:add>
  238. </xts:transform>
  239. </send:request>
  240. </xts:transform>
  241. </xts:append>
  242. </xts:sequence>
  243. </xsl:template>
  244. </xsl:stylesheet>
  245. </xts:block>
  246. <!--
  247. ================================================================================
  248. doCreateNewsItemSubObject
  249. a block which creates newsitem for
  250. ===============================================================================================
  251. -->
  252. <xts:block id="doCreateNewsItemSubObject" dependency="doCreateAgentMemoSubObjects" processor="XSLT" type="exec" mandatory="false" condition=".[not(root/copyFault) and not(root/fault) and ((/root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and @name='m_sub_type']='nonMetric' and /root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and @name = 'm_subData_newsitemCB']) or (/root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and @name='m_sub_type']='metric' and /root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and starts-with(@name, 'm_subData_newsitemCB_')])) ]">
  253. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  254. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  255. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:form="http://developer.cognos.com/schemas/xts/subscribe/iFrmCmd/1/" exclude-result-prefixes="send xtsext form">
  256. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  257. <xsl:template match="/">
  258. <xsl:apply-templates select="root/command/form:create/form:env"/>
  259. </xsl:template>
  260. <xsl:template match="form:env">
  261. <xsl:variable name="user_locale">
  262. <xsl:choose>
  263. <xsl:when test="/root/session/param[@name='contentLocale']">
  264. <xsl:value-of select="/root/session/param[@name='contentLocale']"/>
  265. </xsl:when>
  266. <xsl:otherwise>
  267. <xsl:value-of select="/root/system/param[@name='contentLocale']"/>
  268. </xsl:otherwise>
  269. </xsl:choose>
  270. </xsl:variable>
  271. <xts:sequence>
  272. <xts:append select="/root">
  273. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  274. <send:request provider="cm" faultBlock="createFault">
  275. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  276. <cm:add xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  277. <cm:objects>
  278. <cm:shortcutRSSTask>
  279. <cm:searchPath>
  280. <!-- attach the memo to the agent - not the report -->
  281. <xsl:value-of select="/root/cm:addResponse/cm:reportDataServiceAgentDefinition/cm:searchPath"/>
  282. </cm:searchPath>
  283. <cm:defaultName>
  284. <xsl:value-of select="form:param[@name='m_subData_newsitem_taskName']"/>
  285. </cm:defaultName>
  286. <cm:defaultScreenTip>
  287. <xsl:value-of select="form:param[@name='m_subData_newsitem_screentip']"/>
  288. </cm:defaultScreenTip>
  289. <cm:defaultDescription>
  290. <xsl:value-of select="form:param[@name='m_subData_newsitem_text']"/>
  291. </cm:defaultDescription>
  292. <!--the title is destined for the name of the url -->
  293. <cm:title>
  294. <cm:value>
  295. <xsl:attribute name="locale"><xsl:value-of select="$user_locale"/></xsl:attribute>
  296. <xsl:value-of select="form:param[@name='m_subData_newsitem_headline']"/>
  297. </cm:value>
  298. </cm:title>
  299. <cm:channel>
  300. <cm:baseClass>
  301. <cm:searchPath>
  302. <xsl:value-of select="form:param[@name='m_subData_newsitem_path']"/>
  303. </cm:searchPath>
  304. </cm:baseClass>
  305. </cm:channel>
  306. </cm:shortcutRSSTask>
  307. </cm:objects>
  308. </cm:add>
  309. </xts:transform>
  310. </send:request>
  311. </xts:transform>
  312. </xts:append>
  313. <xts:append select="/root">
  314. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  315. <send:request provider="cm" faultBlock="createFault">
  316. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  317. <cm:add xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  318. <cm:objects>
  319. <cm:agentTaskDefinition>
  320. <cm:searchPath>
  321. <!-- attach the memo to the agent - not the report -->
  322. <xsl:value-of select="/root/cm:addResponse/cm:reportDataServiceAgentDefinition/cm:searchPath"/>
  323. </cm:searchPath>
  324. <!-- we can save the taskName too -->
  325. <cm:taskObject>
  326. <cm:shortcutRSSTask>
  327. <cm:searchPath>
  328. <!-- put the path into the report that we selected as the action -->
  329. <xts:function name="xmlencode">
  330. <xts:param name="source">
  331. <xts:queryValue select="/root/*[local-name()='addResponse']/*[local-name()='shortcutRSSTask']/*[local-name()='searchPath']"/>
  332. </xts:param>
  333. </xts:function>
  334. </cm:searchPath>
  335. </cm:shortcutRSSTask>
  336. </cm:taskObject>
  337. <!-- define the filter data item name -->
  338. <cm:filterDataItemName>
  339. <xsl:if test="/root/env/param[starts-with(@name,'m_subData_newsitemCB_')]">
  340. <xsl:variable name="max" select="count(/root/env/param[starts-with(@name,'m_subData_newsitemCB_')])"/>
  341. <xsl:text>[</xsl:text>
  342. <xsl:for-each select="/root/env/param[starts-with(@name,'m_subData_newsitemCB_')]">
  343. <xsl:sort select="@name"/>
  344. <xsl:value-of select="substring-after(@name,'m_subData_newsitemCB_')"/>
  345. <xsl:if test="position() &lt; $max">
  346. <xsl:text>OR</xsl:text>
  347. </xsl:if>
  348. </xsl:for-each>
  349. <xsl:text>]</xsl:text>
  350. </xsl:if>
  351. </cm:filterDataItemName>
  352. </cm:agentTaskDefinition>
  353. </cm:objects>
  354. </cm:add>
  355. </xts:transform>
  356. </send:request>
  357. </xts:transform>
  358. </xts:append>
  359. </xts:sequence>
  360. </xsl:template>
  361. </xsl:stylesheet>
  362. </xts:block>
  363. <!--
  364. ================================================================================
  365. doCreateNotificationTaskSubObject
  366. a block which creates newsitem for
  367. ===============================================================================================
  368. -->
  369. <xts:block id="doCreateNotificationTaskSubObject" dependency="doCreateNewsItemSubObject" processor="XSLT" type="exec" mandatory="false" condition=".[not(root/copyFault) and not(root/fault) and ((/root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and @name='m_sub_type']='nonMetric' and /root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and @name = 'm_subData_taskCB']) or (/root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and @name='m_sub_type']='metric' and /root/command/*[local-name()='create']/*[local-name()='env']/*[local-name()='param' and starts-with(@name, 'm_subData_taskCB_')])) ]">
  370. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  371. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  372. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:form="http://developer.cognos.com/schemas/xts/subscribe/iFrmCmd/1/" exclude-result-prefixes="send xtsext form">
  373. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  374. <xsl:template match="/">
  375. <xsl:apply-templates select="root/command/form:create/form:env"/>
  376. </xsl:template>
  377. <xsl:template match="form:env">
  378. <xsl:variable name="user_locale">
  379. <xsl:choose>
  380. <xsl:when test="/root/session/param[@name='contentLocale']">
  381. <xsl:value-of select="/root/session/param[@name='contentLocale']"/>
  382. </xsl:when>
  383. <xsl:otherwise>
  384. <xsl:value-of select="/root/system/param[@name='contentLocale']"/>
  385. </xsl:otherwise>
  386. </xsl:choose>
  387. </xsl:variable>
  388. <xts:sequence>
  389. <xts:append select="/root">
  390. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  391. <send:request provider="cm" faultBlock="createFault">
  392. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  393. <cm:add xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  394. <cm:objects>
  395. <cm:humanTask>
  396. <cm:searchPath>
  397. <!-- attach the human task to the agent - not the report -->
  398. <xsl:value-of select="/root/cm:addResponse/cm:reportDataServiceAgentDefinition/cm:searchPath"/>
  399. </cm:searchPath>
  400. <cm:defaultName>
  401. <xsl:value-of select="form:param[@name='humanTaskName']"/>
  402. </cm:defaultName>
  403. <cm:parameters>
  404. <cm:parameterValue>
  405. <cm:name>hts</cm:name>
  406. <cm:simpleParmValueItem>
  407. <cm:inclusive>false</cm:inclusive>
  408. <cm:display>hts</cm:display>
  409. <cm:use>
  410. <xts:transform name="XMLEncode">
  411. <xts:transform src="subscribe/transforms/getChildren.xslt" processor="XSLT">
  412. <xts:transform name="XMLDecode">
  413. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(form:param[@name='taskOptions'])), true())"/>
  414. </xts:transform>
  415. </xts:transform>
  416. </xts:transform>
  417. </cm:use>
  418. </cm:simpleParmValueItem>
  419. </cm:parameterValue>
  420. </cm:parameters>
  421. <cm:iconURI>./ps/portal/images/icon_notification.gif</cm:iconURI>
  422. </cm:humanTask>
  423. </cm:objects>
  424. </cm:add>
  425. </xts:transform>
  426. </send:request>
  427. </xts:transform>
  428. </xts:append>
  429. <xts:append select="/root">
  430. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  431. <send:request provider="cm" faultBlock="createFault">
  432. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  433. <cm:add xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  434. <cm:objects>
  435. <cm:agentTaskDefinition>
  436. <cm:searchPath>
  437. <!-- attach the memo to the agent - not the report -->
  438. <xsl:value-of select="/root/cm:addResponse/cm:reportDataServiceAgentDefinition/cm:searchPath"/>
  439. </cm:searchPath>
  440. <!-- we can save the taskName too -->
  441. <cm:taskObject>
  442. <cm:humanTask>
  443. <cm:searchPath>
  444. <!-- put the path into the report that we selected as the action -->
  445. <xts:function name="xmlencode">
  446. <xts:param name="source">
  447. <xts:queryValue select="/root/*[local-name()='addResponse']/*[local-name()='humanTask']/*[local-name()='searchPath']"/>
  448. </xts:param>
  449. </xts:function>
  450. </cm:searchPath>
  451. </cm:humanTask>
  452. </cm:taskObject>
  453. <!-- define the filter data item name -->
  454. <cm:filterDataItemName>
  455. <xsl:if test="/root/env/param[starts-with(@name,'m_subData_taskCB_')]">
  456. <xsl:variable name="max" select="count(/root/env/param[starts-with(@name,'m_subData_taskCB_')])"/>
  457. <xsl:text>[</xsl:text>
  458. <xsl:for-each select="/root/env/param[starts-with(@name,'m_subData_taskCB_')]">
  459. <xsl:sort select="@name"/>
  460. <xsl:value-of select="substring-after(@name,'m_subData_taskCB_')"/>
  461. <xsl:if test="position() &lt; $max">
  462. <xsl:text>OR</xsl:text>
  463. </xsl:if>
  464. </xsl:for-each>
  465. <xsl:text>]</xsl:text>
  466. </xsl:if>
  467. </cm:filterDataItemName>
  468. </cm:agentTaskDefinition>
  469. </cm:objects>
  470. </cm:add>
  471. </xts:transform>
  472. </send:request>
  473. </xts:transform>
  474. </xts:append>
  475. </xts:sequence>
  476. </xsl:template>
  477. </xsl:stylesheet>
  478. </xts:block>
  479. <!--
  480. ================================================================================
  481. do the commandResults ???
  482. ================================================================================
  483. -->
  484. <xts:block id="commandResults" processor="XSLT" type="exec" mode="output" mimeType="text/xml" dependency="doCreateNotificationTaskSubObject">
  485. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  486. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" version="1.0">
  487. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  488. <xsl:template match="/root">
  489. <response xmlns="http://developer.cognos.com/schemas/xts/subscribe/iFrmCmd/1/">
  490. <xsl:choose>
  491. <xsl:when test="cm:addResponse/cm:reportDataServiceAgentDefinition">
  492. <xsl:copy-of select="cm:addResponse/cm:reportDataServiceAgentDefinition"/>
  493. </xsl:when>
  494. <xsl:when test="./copyFault or ./fault">
  495. <error>
  496. <errorCode>
  497. <xsl:value-of select="./copyFault/fault/*[local-name()='exception']/*[local-name()='exceptionDetail']/*[local-name()='exception']/*[local-name()='errorCode']"/>
  498. </errorCode>
  499. <errorMessage>
  500. <xsl:value-of select="./copyFault/fault/*[local-name()='exception']/*[local-name()='exceptionDetail']/*[local-name()='exception']/*[local-name()='message']/*[local-name()='messageString']"/>
  501. </errorMessage>
  502. <!-- copy the whole of the fault detail out too -->
  503. <xsl:copy-of select="*[local-name()='copyFault' or local-name()='fault']"/>
  504. </error>
  505. </xsl:when>
  506. </xsl:choose>
  507. </response>
  508. </xsl:template>
  509. <xsl:template match="text()"/>
  510. </xsl:stylesheet>
  511. </xts:block>
  512. <!--
  513. ===============================================================================================
  514. faultHandler
  515. ===============================================================================================
  516. -->
  517. <xts:block id="createFault" type="fault" processor="XSLT">
  518. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  519. <xsl:output method="xml"/>
  520. <xsl:template match="/root/fault">
  521. <xsl:choose>
  522. <xsl:when test="./*[local-name() = 'exception']/*[local-name() = 'exceptionDetail']/*[local-name() = 'exception']/*[local-name()='errorCode'] = 'cmDuplicateName'">
  523. <copyFault>
  524. <xsl:copy-of select="."/>
  525. </copyFault>
  526. </xsl:when>
  527. <xsl:otherwise>
  528. <xsl:copy-of select="."/>
  529. </xsl:otherwise>
  530. </xsl:choose>
  531. </xsl:template>
  532. <xsl:template match="text()"/>
  533. </xsl:stylesheet>
  534. </xts:block>
  535. </xts:morphlet>