validatePreviewRequest.xts 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  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, 2009
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/AGS.xml,messages/portal.xml" includeConfig="true" requiredCapability="canUseEventStudio">
  9. <!--
  10. ================================================================================
  11. decodeAgentDefinition
  12. a block which takes all the saved actions in the index and expands them into individual blocks
  13. ===============================================================================================
  14. -->
  15. <xts:block id="decodeAgentDefinition" processor="XSLT" type="exec">
  16. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  17. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  18. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  19. <xsl:template match="/root">
  20. <xts:sequence>
  21. <xts:append>
  22. <xts:transform src="ags/iFrmCmd/common/decodeAgentDefinition.xslt" processor="XSLT">
  23. <root>
  24. <xts:transform src="ags/iFrmCmd/common/decodeAgentDefinitionBlob.xslt" processor="XSLT">
  25. <root>
  26. <xsl:if test="/root/env/param[@name='agent_definition_blob']">
  27. <agent_definition_blob>
  28. <xsl:value-of select="/root/env/param[@name='agent_definition_blob']"/>
  29. </agent_definition_blob>
  30. </xsl:if>
  31. </root>
  32. </xts:transform>
  33. <!-- copy the environment in there too -->
  34. <xsl:copy-of select="/root/env/param"/>
  35. </root>
  36. </xts:transform>
  37. </xts:append>
  38. </xts:sequence>
  39. </xsl:template>
  40. </xsl:stylesheet>
  41. </xts:block>
  42. <!--
  43. ================================================================================
  44. decodeReportOptions
  45. A helper block to expand the report options and place them under /root/agent_item
  46. The reportOptions node is stripped out to make '/root/agent_item/options' which can then be saved to CM
  47. ================================================================================
  48. -->
  49. <xts:block id="decodeReportOptions" dependency="decodeAgentDefinition" path="/ags/iFrmCmd/common/decodeReportOptions.xslt" processor="XSLT" type="exec" mandatory="false" condition=".[/root/agent_item[@type='report'] and /root/agent_item/param[@name='reportOptions']]">
  50. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  51. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  52. <xts:logicsheet path="logicsheets/portal.xsl"/>
  53. </xts:block>
  54. <!--
  55. ================================================================================
  56. extract and clean up the parameters
  57. ===============================================================================================
  58. -->
  59. <xts:block id="extractTaskParams" path="/ags/iFrmCmd/common/extractTaskParams.xslt" dependency="decodeReportOptions" processor="XSLT" type="exec" mode="interpret">
  60. </xts:block>
  61. <!--
  62. a block which decodes the information email options
  63. ==============================================================================================
  64. -->
  65. <xts:block id="decodeTaskOptions" path="/ags/iFrmCmd/common/decodeTaskOptions.xslt" dependency="extractTaskParams" processor="XSLT" type="exec" condition="/root/agent_item" mandatory="false">
  66. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  67. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  68. </xts:block>
  69. <!--
  70. ================================================================================
  71. take all the saved parameter data and whip it out
  72. ===============================================================================================
  73. -->
  74. <xts:block id="extractSavedParameters" mode="interpret" processor="XSLT" type="exec" dependency="decodeTaskOptions">
  75. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  76. <xsl:template match="/root">
  77. <xts:sequence>
  78. <xsl:for-each select="/root/agent_item">
  79. <xsl:if test="./param[@name='taskParameters']">
  80. <xts:append select="/root/agent_item[@id = '{@id}']">
  81. <xsl:value-of select="xtsext:web64decode( string(./param[@name='taskParameters']), true() )" disable-output-escaping="yes"/>
  82. </xts:append>
  83. </xsl:if>
  84. </xsl:for-each>
  85. </xts:sequence>
  86. </xsl:template>
  87. </xsl:stylesheet>
  88. </xts:block>
  89. <!--
  90. ===============================================================================================
  91. doCreateAgent
  92. A block to take care of the creation of the Agent - this is an agentDefinition Object in CM
  93. ===============================================================================================
  94. -->
  95. <xts:block id="doCreateAgentDefinition" dependency="extractSavedParameters" processor="XSLT" type="exec">
  96. <xts:logicsheet path="ags/logicsheets/cm-save.xsl"/>
  97. <xts:logicsheet path="logicsheets/portal.xsl"/>
  98. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  99. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="cms xts send cm pf xtsext">
  100. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  101. <pf:variables/>
  102. <xsl:template match="/root/env">
  103. <!-- this is the class of the new object -->
  104. <xts:sequence>
  105. <!-- prepare and send the add request -->
  106. <xts:append select="/root">
  107. <agentDefinition>
  108. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  109. <cm:objects xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  110. <cm:agentDefinition>
  111. <cm:searchPath>
  112. <xsl:value-of select="/root/agent_definition/agentDefinition"/>
  113. </cm:searchPath>
  114. <!-- apply templates to define the screen tips and descriptions -->
  115. <xsl:apply-templates/>
  116. <!-- set the sequencing - this is part of the agent_definition -->
  117. <cm:sequencing>
  118. <xsl:value-of select="/root/agent_definition/sequencing"/>
  119. </cm:sequencing>
  120. <cm:allowNotification>
  121. <xsl:value-of select="/root/agent_definition/allowNotification"/>
  122. </cm:allowNotification>
  123. <!-- have to store the event key items -->
  124. <cm:eventKey>
  125. <xsl:call-template name="build_keyItems">
  126. <xsl:with-param name="keyItems">
  127. <xsl:value-of select="/root/agent_definition/summaryEventKey"/>
  128. </xsl:with-param>
  129. </xsl:call-template>
  130. </cm:eventKey>
  131. <!-- create the default agent options -->
  132. <cm:options>
  133. <xsl:copy-of select="/root/agent_definition/agentOptions/options/value"/>
  134. </cm:options>
  135. </cm:agentDefinition>
  136. </cm:objects>
  137. </xts:transform>
  138. </agentDefinition>
  139. </xts:append>
  140. </xts:sequence>
  141. </xsl:template>
  142. <!-- template to create an item - and alter the name of the object -->
  143. <xsl:template match="param[starts-with(@name,'m_p_')]">
  144. <!-- create an element for each property passed in -->
  145. <xsl:element name="{substring-after(@name, 'm_p_')}" xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  146. <!-- name is the on CM property that must be encoded *before* giving to CM -->
  147. <xsl:value-of select="."/>
  148. </xsl:element>
  149. </xsl:template>
  150. <cms:prop-save/>
  151. <xsl:template match="text()"/>
  152. <!-- template to make the key items into something which pre-process can make -->
  153. <cms:build_keyItems/>
  154. </xsl:stylesheet>
  155. </xts:block>
  156. <!--
  157. ===============================================================================================
  158. doCreateAgentDefinitionReport
  159. A block which creates the report which provides the datasource for the agent. This is a subObject of the agentDefinition
  160. ===============================================================================================
  161. -->
  162. <xts:block id="doCreateAgentDefinitionReport" dependency="doCreateAgentDefinition" processor="XSLT" type="exec">
  163. <xts:logicsheet path="ags/logicsheets/cm-save.xsl"/>
  164. <xts:logicsheet path="logicsheets/portal.xsl"/>
  165. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  166. <xts:logicsheet path="ags/logicsheets/agentDefinition.xsl"/>
  167. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:agsad="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agentDefinition/" 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:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="agsad cms xts send cm pf xtsext">
  168. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  169. <pf:variables/>
  170. <!-- global application variables -->
  171. <xsl:template match="/root/env">
  172. <xts:sequence>
  173. <!-- prepare and send the add request -->
  174. <xts:append select="/root">
  175. <agentDefinitionReport xmlns:xts="http://developer.cognos.com/schemas/xts/">
  176. <objects 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:cm="http://developer.cognos.com/schemas/contentManagerService/1" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseClass[1]">
  177. <item xsi:type="bus:report">
  178. <defaultDescription xsi:type="bus:stringProp">
  179. <value xsi:type="xsd:string">
  180. <xsl:call-template name="conditionDisplayLogic">
  181. <xsl:with-param name="p1">
  182. <xsl:value-of select="/root/agent_definition/condition/text()"/>
  183. </xsl:with-param>
  184. </xsl:call-template>
  185. </value>
  186. </defaultDescription>
  187. <specification xsi:type="bus:anyTypeProp">
  188. <value xsi:type="xsd:string">
  189. <xsl:value-of select="param[@name='inlineSpec']"/>
  190. </value>
  191. </specification>
  192. <metadataModel xsi:type="bus:baseClassArrayProp">
  193. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:baseClass[1]">
  194. <item xsi:type="bus:nil">
  195. <searchPath xsi:type="bus:stringProp">
  196. <value xsi:type="xsd:string">
  197. <!-- put the path to the model spec in -->
  198. <xsl:value-of select="param[@name='model']"/>
  199. </value>
  200. </searchPath>
  201. </item>
  202. </value>
  203. </metadataModel>
  204. <metadataModelPackage xsi:type="bus:baseClassArrayProp">
  205. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:baseClass[1]">
  206. <item xsi:type="bus:nil">
  207. <searchPath xsi:type="bus:stringProp">
  208. <value xsi:type="xsd:string">
  209. <xsl:value-of select="substring-before(param[@name='model'],'/model[')"/>
  210. </value>
  211. </searchPath>
  212. </item>
  213. </value>
  214. </metadataModelPackage>
  215. <xsl:choose>
  216. <xsl:when test="/root/env/param[@name='parameterValues']">
  217. <xsl:value-of select="string(/root/env/param[@name='parameterValues'])" disable-output-escaping="yes"/>
  218. </xsl:when>
  219. <xsl:otherwise>
  220. <parameters xsi:type="bus:parameterValueArrayProp">
  221. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:parameterValue[0]"/>
  222. </parameters>
  223. </xsl:otherwise>
  224. </xsl:choose>
  225. </item>
  226. </objects>
  227. </agentDefinitionReport>
  228. </xts:append>
  229. </xts:sequence>
  230. </xsl:template>
  231. <!-- template to create the default description for the agent condition report-->
  232. <xsl:template name="addDefaultDescription">
  233. <!-- create an element for each property passed in -->
  234. <xsl:element name="defaultDescription" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  235. <!-- transform the condition -->
  236. <xsl:call-template name="conditionDisplayLogic">
  237. <xsl:with-param name="p1">
  238. <xsl:value-of select="/root/agent_definition/condition/text()"/>
  239. </xsl:with-param>
  240. </xsl:call-template>
  241. </xsl:element>
  242. </xsl:template>
  243. <cms:prop-save/>
  244. <agsad:conditionDisplayLogic/>
  245. <xsl:template match="text()"/>
  246. </xsl:stylesheet>
  247. </xts:block>
  248. <!--
  249. ================================================================================
  250. doCreateAgentSubObjects
  251. a block which creates all the subobjects which are allowed to be under the agent - sqlTask/WebTask
  252. ===============================================================================================
  253. -->
  254. <xts:block id="doCreateAgentSubObjects" dependency="doCreateAgentDefinition" processor="XSLT" type="exec" condition="/root/agent_item" mandatory="false">
  255. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  256. <xts:logicsheet path="ags/logicsheets/agsCmHelper.xsl"/>
  257. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  258. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:agsh="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agsCmHelper/" exclude-result-prefixes="cm send xtsext agsh">
  259. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  260. <xsl:template match="/">
  261. <xts:sequence>
  262. <xsl:for-each select="/root/agent_definition/items/item">
  263. <!--give a dummy id if there is no real one -->
  264. <xsl:variable name="id" select="./id"/>
  265. <!--use the real search path for newsitems if there is one
  266. to determine the state of the generated newsitems-->
  267. <xsl:variable name="search_path">
  268. <xsl:choose>
  269. <xsl:when test="./targetStoreID and ./targetStoreID != ''">
  270. <xsl:value-of select="./targetStoreID"/>
  271. </xsl:when>
  272. <xsl:otherwise>
  273. <xsl:value-of select="concat($id, '-', position())"/>
  274. </xsl:otherwise>
  275. </xsl:choose>
  276. </xsl:variable>
  277. <xsl:choose>
  278. <xsl:when test="/root/agent_definition/items/item[./id = $id]/type = 'sql'">
  279. <xts:append select="/root/agent_item[@id = '{$id}']">
  280. <agentTaskTarget>
  281. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  282. <cm:objects xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  283. <cm:storedProcedureTask>
  284. <cm:searchPath>
  285. <!--these are internal to the agent..... so we dont validate the sub object existence
  286. give them a dummy sp-->
  287. <xsl:value-of select="concat($id, '-', position())"/>
  288. </cm:searchPath>
  289. <!-- give the memo the name of the task -->
  290. <cm:defaultName>
  291. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/name"/>
  292. </cm:defaultName>
  293. <cm:storedProcedureName>
  294. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='sql_procedure_name']"/>
  295. </cm:storedProcedureName>
  296. <xsl:if test="/root/agent_item[@id = $id]/param[@name='sql_model']!=''">
  297. <cm:metadataModel>
  298. <cm:model>
  299. <cm:searchPath>
  300. <!-- put the path to the model spec in -->
  301. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='sql_model']"/>
  302. </cm:searchPath>
  303. </cm:model>
  304. </cm:metadataModel>
  305. </xsl:if>
  306. <xsl:if test="/root/agent_item[@id = $id]/param[@name='sql_package']!=''">
  307. <cm:metadataModelPackage>
  308. <cm:package>
  309. <cm:searchPath>
  310. <!-- put the path to the model spec in -->
  311. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='sql_package']"/>
  312. </cm:searchPath>
  313. </cm:package>
  314. </cm:metadataModelPackage>
  315. </xsl:if>
  316. <!-- just copy the options that we've got -->
  317. <xsl:copy-of select="/root/agent_item[@id = $id]/options"/>
  318. </cm:storedProcedureTask>
  319. </cm:objects>
  320. </xts:transform>
  321. </agentTaskTarget>
  322. </xts:append>
  323. </xsl:when>
  324. <xsl:when test="/root/agent_definition/items/item[./id = $id]/type = 'web'">
  325. <xts:append select="/root/agent_item[@id = '{$id}']">
  326. <agentTaskTarget>
  327. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  328. <cm:objects xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  329. <cm:webServiceTask>
  330. <cm:searchPath>
  331. <!--these are internal to the agent..... so we dont validate the sub object existence
  332. give them a dummy sp-->
  333. <xsl:value-of select="concat($id, '-', position())"/>
  334. </cm:searchPath>
  335. <!-- give the memo the name of the task -->
  336. <cm:defaultName>
  337. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/name"/>
  338. </cm:defaultName>
  339. <cm:uri>
  340. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='url_wsdl']"/>
  341. </cm:uri>
  342. <cm:operationName>
  343. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='url_operation']"/>
  344. </cm:operationName>
  345. <cm:serviceName>
  346. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='url_serviceName']"/>
  347. </cm:serviceName>
  348. <cm:inputMessageName/>
  349. <cm:outputMessageName/>
  350. <cm:bindingName>
  351. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='url_port']"/>
  352. </cm:bindingName>
  353. <!-- just copy the options that we've got -->
  354. <xsl:copy-of select="/root/agent_item[@id = $id]/options"/>
  355. </cm:webServiceTask>
  356. </cm:objects>
  357. </xts:transform>
  358. </agentTaskTarget>
  359. </xts:append>
  360. </xsl:when>
  361. <xsl:when test="/root/agent_definition/items/item[./id = $id]/type = 'url'">
  362. <!-- only create a url for the url objects -->
  363. <xts:append select="/root/agent_item[@id = '{$id}']">
  364. <agentTaskTarget>
  365. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  366. <cm:objects xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  367. <xsl:call-template name="rssTaskObject">
  368. <xsl:with-param name="task" select="/root/agent_item[@id = $id]"/>
  369. <!-- put the search path which was returned from the creation of the agentDefinition -->
  370. <xsl:with-param name="path" select="$search_path"/>
  371. <xsl:with-param name="name" select="/root/agent_definition/items/item[./id=$id]/name"/>
  372. </xsl:call-template>
  373. </cm:objects>
  374. </xts:transform>
  375. </agentTaskTarget>
  376. </xts:append>
  377. </xsl:when>
  378. <xsl:when test="/root/agent_definition/items/item[./id = $id]/type = 'message' ">
  379. <xts:append select="/root/agent_item[@id = '{$id}']">
  380. <agentTaskTarget>
  381. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  382. <cm:objects xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  383. <cm:memo>
  384. <cm:searchPath>
  385. <!--these are internal to the agent..... so we dont validate the sub object existence
  386. give them a dummy sp-->
  387. <xsl:value-of select="concat($id, '-', position())"/>
  388. </cm:searchPath>
  389. <!-- give the memo the name of the task -->
  390. <cm:defaultName>
  391. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/name"/>
  392. </cm:defaultName>
  393. <!-- just copy the options that we've got -->
  394. <xsl:copy-of select="/root/agent_item[@id=$id]/options"/>
  395. </cm:memo>
  396. </cm:objects>
  397. </xts:transform>
  398. </agentTaskTarget>
  399. </xts:append>
  400. </xsl:when>
  401. <!-- handle a human task -->
  402. <xsl:when test="/root/agent_definition/items/item[./id = $id]/type = 'notification' or /root/agent_definition/items/item[./id = $id]/type = 'approval' ">
  403. <!-- only create a url for the url objects -->
  404. <xts:append select="/root/agent_item[@id = '{$id}']">
  405. <agentTaskTarget>
  406. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  407. <cm:objects>
  408. <cm:humanTask>
  409. <cm:searchPath>
  410. <!--these are internal to the agent..... so we dont validate the sub object existence
  411. give them a dummy sp-->
  412. <xsl:value-of select="concat($id, '-', position())"/>
  413. </cm:searchPath>
  414. <!-- give the memo the name of the task -->
  415. <cm:defaultName>
  416. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/name"/>
  417. </cm:defaultName>
  418. <!-- set the type of the task into the object - we need to know what type to resurrect it -->
  419. <cm:operationName>
  420. <xsl:value-of select="/root/agent_definition/items/item[./id = $id]/type"/>
  421. </cm:operationName>
  422. <cm:parameters>
  423. <cm:parameterValue>
  424. <cm:name>hts</cm:name>
  425. <cm:simpleParmValueItem>
  426. <cm:inclusive>false</cm:inclusive>
  427. <cm:display>hts</cm:display>
  428. <cm:use>
  429. <xts:transform name="XMLEncode">
  430. <xts:transform src="ags/transforms/getChildren.xslt" processor="XSLT">
  431. <xts:transform name="XMLDecode">
  432. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap',string(/root/agent_item[@id = $id]/param[@name='taskOptions'])), true())"/>
  433. </xts:transform>
  434. </xts:transform>
  435. </xts:transform>
  436. </cm:use>
  437. </cm:simpleParmValueItem>
  438. </cm:parameterValue>
  439. <!-- this parameter holds the task count -->
  440. <cm:parameterValue>
  441. <cm:name>taskCount</cm:name>
  442. <cm:simpleParmValueItem>
  443. <cm:inclusive>false</cm:inclusive>
  444. <cm:display>taskCount</cm:display>
  445. <cm:use><xsl:value-of select="count(/root/agent_definition/items/item)"/></cm:use>
  446. </cm:simpleParmValueItem>
  447. </cm:parameterValue>
  448. </cm:parameters>
  449. </cm:humanTask>
  450. </cm:objects>
  451. </xts:transform>
  452. </agentTaskTarget>
  453. </xts:append>
  454. </xsl:when>
  455. </xsl:choose>
  456. </xsl:for-each>
  457. </xts:sequence>
  458. </xsl:template>
  459. <!--write a template to create the rss objects -->
  460. <agsh:rssTaskObject/>
  461. </xsl:stylesheet>
  462. </xts:block>
  463. <!--
  464. ===============================================================================================
  465. doCreateAgentTasks
  466. A block which creates the report steps associated with the report actions
  467. ===============================================================================================
  468. -->
  469. <xts:block id="doCreateAgentTasks" dependency="doCreateAgentDefinitionReport doCreateAgentSubObjects" processor="XSLT" type="exec" condition="/root/agent_item" mandatory="false">
  470. <xts:logicsheet path="ags/logicsheets/cm-save.xsl"/>
  471. <xts:logicsheet path="logicsheets/portal.xsl"/>
  472. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  473. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" 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:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:x="x" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xtscm cms send pf bus x SOAP-ENC xsi xts xtsext">
  474. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  475. <!-- Handle any agentTaskDefinition adds that are required -->
  476. <pf:variables/>
  477. <xsl:template match="/">
  478. <xts:sequence>
  479. <xsl:for-each select="/root/agent_definition/items/item">
  480. <xsl:variable name="id" select="./id"/>
  481. <xsl:variable name="position" select="position()"/>
  482. <xts:append select="/root/agent_item[@id = '{$id}']">
  483. <agentTask>
  484. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  485. <xtscm:objects>
  486. <xtscm:agentTaskDefinition>
  487. <!-- we can save the taskName too -->
  488. <xtscm:defaultName>
  489. <xsl:choose>
  490. <xsl:when test="./type='sql' or ./type='web' or ./type='url' or ./type='message' or ./type='notification' or ./type= 'approval'">
  491. <xsl:value-of select="concat('Task-' , /root/agent_definition/items/item[./id=$id]/name)"/>
  492. </xsl:when>
  493. <xsl:otherwise>
  494. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/name"/>
  495. </xsl:otherwise>
  496. </xsl:choose>
  497. </xtscm:defaultName>
  498. <xtscm:searchPath>
  499. <!-- give the internal id of the agent which identifies the task to ES -->
  500. <xsl:value-of select="$id"/>
  501. </xtscm:searchPath>
  502. <xtscm:displaySequence>
  503. <xsl:value-of select="$position"/>
  504. </xtscm:displaySequence>
  505. <xtscm:taskObject>
  506. <!-- we already have the object..... just add a place holder-->
  507. </xtscm:taskObject>
  508. <!-- build the options - runOptions are normally in the env - the deliveryOptions are in a blob -->
  509. <xtscm:options>
  510. <!-- build the agent run options-->
  511. <xsl:variable name="taskId" select="./id"/>
  512. <xsl:variable name="agentItem" select="/root/agent_item[@id = $taskId]"/>
  513. <runOptions>
  514. <xsl:if test="$agentItem/options != ''">
  515. <xsl:copy-of select="$agentItem/options/*[local-name()='value']/*[local-name()='item']"/>
  516. </xsl:if>
  517. </runOptions>
  518. </xtscm:options>
  519. <!-- can save the filter values in a real place now -->
  520. <xtscm:eventTypes>
  521. <xsl:for-each select="./suppression/param[starts-with(@name, 'Filter_')]">
  522. <xtscm:item>
  523. <xsl:value-of select="."/>
  524. </xtscm:item>
  525. </xsl:for-each>
  526. </xtscm:eventTypes>
  527. <!-- this is the query item list that filters in conjunction with Filter_changed
  528. or Filter_unchanged not well named as event key -->
  529. <xtscm:eventKey>
  530. <xsl:call-template name="build_keyItems">
  531. <xsl:with-param name="keyItems">
  532. <xsl:value-of select="./suppression/param[@name='Action_topic_filter']"/>
  533. </xsl:with-param>
  534. </xsl:call-template>
  535. </xtscm:eventKey>
  536. <xtscm:filterDataItemName>
  537. <xsl:value-of select="./taskLevelFilter"/>
  538. </xtscm:filterDataItemName>
  539. <xtscm:runCondition>
  540. <xsl:value-of select="./runCondition"/>
  541. </xtscm:runCondition>
  542. <!-- build the parameters -->
  543. <xsl:call-template name="build_parameters">
  544. <xsl:with-param name="id" select="$id"/>
  545. </xsl:call-template>
  546. <!--build the assignments prop for the agent task by id this is a bit roundabout... specially to a form used by preprocess.xslt-->
  547. <xsl:if test="/root/agent_items_params/agent_item_params[@id = $id]/parameterData/parameterAssignments">
  548. <xtscm:parameterAssignments>
  549. <xsl:for-each select="/root/agent_items_params/agent_item_params[@id = $id]/parameterData/parameterAssignments/parameterAssignment">
  550. <xtscm:parameterAssignmentDataItem>
  551. <xtscm:parameterName>
  552. <xsl:value-of select="./parameterName"/>
  553. </xtscm:parameterName>
  554. <xtscm:dataItemName>
  555. <xsl:value-of select="./dataItemName"/>
  556. </xtscm:dataItemName>
  557. </xtscm:parameterAssignmentDataItem>
  558. </xsl:for-each>
  559. </xtscm:parameterAssignments>
  560. </xsl:if>
  561. </xtscm:agentTaskDefinition>
  562. </xtscm:objects>
  563. </xts:transform>
  564. </agentTask>
  565. </xts:append>
  566. </xsl:for-each>
  567. </xts:sequence>
  568. </xsl:template>
  569. <!-- Single template to make the parameters instead of just copying it -->
  570. <xsl:template name="build_parameters">
  571. <xsl:param name="id"/>
  572. <parameters xmlns="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  573. <xsl:for-each select="/root/agent_items_params/agent_item_params[@id = $id]/parameterData/parameterValues/item">
  574. <xsl:variable name="parameterName" select="./name"/>
  575. <!-- only copy the item if there's not a corresponding assignment -->
  576. <xsl:if test="not(/root/agent_items_params/agent_item_params[@id = $id]/parameterData/parameterAssignments/parameterAssignment[./parameterName=$parameterName])">
  577. <xsl:copy-of select="."/>
  578. </xsl:if>
  579. </xsl:for-each>
  580. </parameters>
  581. </xsl:template>
  582. <!-- pull in any templates to handle "special" properties on CM objects -->
  583. <cms:prop-save/>
  584. <xsl:template match="text()"/>
  585. <cms:build_keyItems/>
  586. </xsl:stylesheet>
  587. </xts:block>
  588. <!--
  589. ===============================================================================================
  590. add the pre built task objects where the current empty value of taskObject is
  591. ===============================================================================================
  592. -->
  593. <xts:block id="mergeTaskObjects" dependency="doCreateAgentTasks" processor="XSLT" type="exec" mandatory="false">
  594. <xts:logicsheet path="ags/logicsheets/cm-save.xsl"/>
  595. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="cm SOAP-ENC xsi xtsext">
  596. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  597. <xsl:template match="/">
  598. <xts:sequence>
  599. <xsl:for-each select="/root/agent_definition/items/item">
  600. <xsl:variable name="id" select="./id"/>
  601. <xsl:variable name="objectClass" select="/root/agent_item[@id = $id]/param[@name='objectClass']"/>
  602. <xts:replace select="/root/agent_item[@id = '{$id}']/agentTask /objects/item/taskObject/value">
  603. <xsl:choose>
  604. <xsl:when test="/root/agent_item[@id = $id]/agentTaskTarget/objects/item">
  605. <!-- currently only one target per task -->
  606. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseClass[1]">
  607. <xsl:copy-of select="/root/agent_item[@id = $id]/agentTaskTarget/objects/item"/>
  608. </value>
  609. </xsl:when>
  610. <xsl:otherwise>
  611. <!--we dont own the object, just the path -->
  612. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseClass[1]">
  613. <item>
  614. <xsl:attribute name="xsi:type"><xsl:call-template name="getCMType"><xsl:with-param name="type" select="./type"/><xsl:with-param name="objectClass" select="$objectClass"/></xsl:call-template></xsl:attribute>
  615. <searchPath xsi:type="cm:stringProp">
  616. <value xsi:type="xsd:string">
  617. <xsl:value-of select="./targetStoreID"/>
  618. </value>
  619. </searchPath>
  620. </item>
  621. </value>
  622. </xsl:otherwise>
  623. </xsl:choose>
  624. </xts:replace>
  625. </xsl:for-each>
  626. </xts:sequence>
  627. </xsl:template>
  628. <xsl:template name="getCMType">
  629. <xsl:param name="type"/>
  630. <xsl:param name="objectClass"/>
  631. <xsl:choose>
  632. <xsl:when test="type = 'report'">
  633. <xsl:value-of select="'cm:report'"/>
  634. </xsl:when>
  635. <xsl:when test="type = 'agent'">
  636. <xsl:value-of select="'cm:agentDefinition'"/>
  637. </xsl:when>
  638. <xsl:when test="type = 'job'">
  639. <xsl:value-of select="'cm:jobDefinition'"/>
  640. </xsl:when>
  641. <xsl:when test="type = 'import'">
  642. <xsl:value-of select="'cm:importDeployment'"/>
  643. </xsl:when>
  644. <xsl:when test="type = 'export'">
  645. <xsl:value-of select="'cm:exportDeployment'"/>
  646. </xsl:when>
  647. <xsl:when test="type = 'content'">
  648. <xsl:value-of select="'cm:contentTask'"/>
  649. </xsl:when>
  650. <xsl:when test="type = 'index'">
  651. <xsl:value-of select="'cm:indexUpdateTask'"/>
  652. </xsl:when>
  653. <xsl:when test="type = 'metric'">
  654. <xsl:value-of select="concat('cm:',$objectClass)"/>
  655. </xsl:when>
  656. <xsl:when test="type = 'planningMacro'">
  657. <xsl:value-of select="'cm:planningMacroTask'"/>
  658. </xsl:when>
  659. <xsl:when test="type = 'migration'">
  660. <xsl:value-of select="'cm:migrationTask'"/>
  661. </xsl:when>
  662. </xsl:choose>
  663. </xsl:template>
  664. </xsl:stylesheet>
  665. </xts:block>
  666. <!--
  667. ===============================================================================================
  668. build the request xml for the validate to be sent to the server
  669. using cm to prefix bus namespace as were borrowing cm-preprocess.xslt to convert our agent for the validate and pre process turns
  670. out cm prefixed stuff
  671. ===============================================================================================
  672. -->
  673. <xts:block id="doBuildRequest" dependency="mergeTaskObjects" processor="XSLT" type="exec" mode="output" mimeType="text/xml">
  674. <xts:logicsheet path="ags/logicsheets/cm-save.xsl"/>
  675. <xsl:stylesheet version="1.0" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="SOAP-ENV SOAP-ENC xsd xs xsi bus xsl cm xtsext">
  676. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  677. <xsl:variable name="ifrmcmd" select="/root/env/param[@name='ifrmcmd']"/>
  678. <xsl:variable name="tabSelected" select="/root/env/param[@name='tabSelectedID']"/>
  679. <xsl:attribute-set name="cm">
  680. <xsl:attribute name="xmlns:cm">http://developer.cognos.com/schemas/bibus/3/</xsl:attribute>
  681. </xsl:attribute-set>
  682. <xsl:template match="/">
  683. <!-- save search path values of the attachments of memo objects -->
  684. <!-- the value of this variable will be used to add the report tasks which output are attachments of an email or memo -->
  685. <xsl:variable name="attachedReportSearchPaths">
  686. <xsl:for-each select="/root/agent_item[@type='message'][./@id = $tabSelected]/agentTask/objects/item/taskObject/value/item/options/value/item/value/parts/item/searchPath">
  687. <xsl:value-of select="concat(., ' ')"/>
  688. </xsl:for-each>
  689. </xsl:variable>
  690. <xsl:choose>
  691. <xsl:when test="contains($ifrmcmd, 'validate')">
  692. <cm:root xmlns:cm="http://developer.cognos.com/schemas/bibus/3/">
  693. <agent xsi:type="cm:agentDefinition">
  694. <xsl:copy-of select="/root/agentDefinition/objects/item/*"/>
  695. </agent>
  696. <report xsi:type="cm:report">
  697. <xsl:copy-of select="/root/agentDefinitionReport/objects/item/*"/>
  698. </report>
  699. <agentTasks xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:agentTaskDefinition[]">
  700. <!-- validating attachments of email tasks requires corresponding report tasks -->
  701. <xsl:for-each select="/root/agent_item">
  702. <xsl:choose>
  703. <xsl:when test="not($ifrmcmd = 'validate_task')">
  704. <item xsi:type="cm:agentTaskDefinition">
  705. <xsl:copy-of select="./agentTask/objects/item/*"/>
  706. </item>
  707. </xsl:when>
  708. <xsl:when test="$ifrmcmd = 'validate_task' and ./@id = $tabSelected">
  709. <item xsi:type="cm:agentTaskDefinition">
  710. <xsl:copy-of select="./agentTask/objects/item/*"/>
  711. </item>
  712. </xsl:when>
  713. <xsl:when test="./@type = 'report' and contains($attachedReportSearchPaths, ./@id)">
  714. <item xsi:type="cm:agentTaskDefinition">
  715. <xsl:copy-of select="./agentTask/objects/item/*"/>
  716. </item>
  717. </xsl:when>
  718. </xsl:choose>
  719. </xsl:for-each>
  720. </agentTasks>
  721. </cm:root>
  722. </xsl:when>
  723. <xsl:when test="contains($ifrmcmd, 'preview')">
  724. <cm:root xmlns:cm="http://developer.cognos.com/schemas/bibus/3/">
  725. <agent xsi:type="cm:agentDefinition">
  726. <xsl:copy-of select="/root/agentDefinition/objects/item/*"/>
  727. </agent>
  728. <report xsi:type="cm:report">
  729. <xsl:copy-of select="/root/agentDefinitionReport/objects/item/*"/>
  730. </report>
  731. <agentTasks xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:agentTaskDefinition[]">
  732. <!-- preview attachments of email tasks requires corresponding report tasks -->
  733. <xsl:for-each select="/root/agent_item">
  734. <xsl:choose>
  735. <xsl:when test="not($ifrmcmd = 'preview_task')">
  736. <item xsi:type="cm:agentTaskDefinition">
  737. <xsl:copy-of select="./agentTask/objects/item/*"/>
  738. </item>
  739. </xsl:when>
  740. <xsl:when test="$ifrmcmd = 'preview_task' and ./@id = $tabSelected">
  741. <item xsi:type="cm:agentTaskDefinition">
  742. <xsl:copy-of select="./agentTask/objects/item/*"/>
  743. </item>
  744. </xsl:when>
  745. <xsl:when test="./@type = 'report' and contains($attachedReportSearchPaths, ./@id)">
  746. <item xsi:type="cm:agentTaskDefinition">
  747. <xsl:copy-of select="./agentTask/objects/item/*"/>
  748. </item>
  749. </xsl:when>
  750. </xsl:choose>
  751. </xsl:for-each>
  752. </agentTasks>
  753. </cm:root>
  754. </xsl:when>
  755. </xsl:choose>
  756. </xsl:template>
  757. </xsl:stylesheet>
  758. </xts:block>
  759. </xts:morphlet>