save.xts 117 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494
  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, 2019
  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="canUseEventStudio">
  18. <!--
  19. ================================================================================
  20. decodeAgentDefinition
  21. a block which takes all the saved actions in the index and expands them into individual blocks
  22. ===============================================================================================
  23. -->
  24. <xts:block id="decodeAgentDefinition" processor="XSLT" type="exec">
  25. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  26. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  27. <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" xmlns:form="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" exclude-result-prefixes="xsl bus SOAP-ENV SOAP-ENC xsd form">
  28. <xsl:template match="/root">
  29. <xts:sequence>
  30. <xts:append>
  31. <xts:transform src="ags/iFrmCmd/common/decodeAgentDefinition.xslt" processor="XSLT">
  32. <root>
  33. <xts:transform src="ags/iFrmCmd/common/decodeAgentDefinitionBlob.xslt" processor="XSLT">
  34. <root>
  35. <xsl:if test="/root/command/*/form:env/form:param[@name='agent_definition_blob']">
  36. <agent_definition_blob>
  37. <xsl:value-of select="/root/command/*/form:env/form:param[@name='agent_definition_blob']"/>
  38. </agent_definition_blob>
  39. </xsl:if>
  40. </root>
  41. </xts:transform>
  42. <!-- copy in the environment too - don't want it namespaced -->
  43. <xsl:for-each select="/root/command/*/form:env/form:param">
  44. <param name="{@name}">
  45. <xsl:value-of select="."/>
  46. </param>
  47. </xsl:for-each>
  48. </root>
  49. </xts:transform>
  50. </xts:append>
  51. </xts:sequence>
  52. </xsl:template>
  53. </xsl:stylesheet>
  54. </xts:block>
  55. <!--
  56. ================================================================================
  57. decodeReportOptions
  58. A helper block to expand the report options and place them under /root/agent_item
  59. The reportOptions node is stripped out to make '/root/agent_item/options' which can then be saved to CM
  60. ================================================================================
  61. -->
  62. <xts:block id="decodeReportAndContentOptions" dependency="decodeAgentDefinition" path="/ags/iFrmCmd/common/decodeReportOptions.xslt" processor="XSLT" type="exec" mandatory="false" condition=".[/root/agent_item[@type='report'] or /root/agent_item[@type='content'] or /root/agent_item[@type='index']]">
  63. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  64. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  65. <xts:logicsheet path="logicsheets/portal.xsl"/>
  66. </xts:block>
  67. <!--
  68. ================================================================================
  69. extract and clean up the parameters for cm
  70. ===============================================================================================
  71. -->
  72. <xts:block id="extractTaskParams" path="/ags/iFrmCmd/common/extractTaskParams.xslt" dependency="decodeReportAndContentOptions" processor="XSLT" type="exec" mode="interpret"/>
  73. <!--
  74. a block which decodes the information email options
  75. ==============================================================================================
  76. -->
  77. <xts:block id="decodeTaskOptions" path="/ags/iFrmCmd/common/decodeTaskOptions.xslt" dependency="extractTaskParams" processor="XSLT" type="exec" condition="/root/agent_item" mandatory="false">
  78. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  79. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  80. </xts:block>
  81. <!--
  82. ===============================================================================================
  83. doUpdateAgentDefinition
  84. A block to update the agent definition if there is a change to condition spec or the eventKeys
  85. ===============================================================================================
  86. -->
  87. <xts:block id="doUpdateAgentDefinition" dependency="decodeTaskOptions" processor="XSLT" type="exec">
  88. <xts:logicsheet path="ags/logicsheets/cm-save.xsl"/>
  89. <xts:logicsheet path="logicsheets/portal.xsl"/>
  90. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  91. <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:xtscm="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/ags/iFrmCmd/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="cms xts send xtscm pf form xtsext">
  92. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  93. <pf:variables/>
  94. <!-- global application variables -->
  95. <xsl:template match="/">
  96. <xsl:apply-templates select="root/command/form:save/form:env"/>
  97. </xsl:template>
  98. <xsl:template match="form:env">
  99. <!-- this is the class of the new object -->
  100. <xts:sequence>
  101. <xts:append select="/root">
  102. <agentDefinition>
  103. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  104. <send:request provider="cm" requester="AGS:save">
  105. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  106. <update xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  107. <xtscm:objects>
  108. <xtscm:agentDefinition>
  109. <xtscm:searchPath>
  110. <!-- put the search path for the agent definition -->
  111. <xsl:value-of select="/root/agent_definition/agentDefinition"/>
  112. </xtscm:searchPath>
  113. <!-- set the sequencing - this is part of the agent_definition -->
  114. <xtscm:sequencing>
  115. <xsl:value-of select="/root/agent_definition/sequencing"/>
  116. </xtscm:sequencing>
  117. <xtscm:allowNotification>
  118. <xsl:value-of select="/root/agent_definition/allowNotification"/>
  119. </xtscm:allowNotification>
  120. <!-- have to store the event key items -->
  121. <xtscm:eventKey>
  122. <xsl:call-template name="build_keyItems">
  123. <xsl:with-param name="keyItems">
  124. <xsl:value-of select="/root/agent_definition/summaryEventKey"/>
  125. </xsl:with-param>
  126. </xsl:call-template>
  127. </xtscm:eventKey>
  128. <!-- set the default retention for the agentDefinition -->
  129. <!--<xtscm:retentions>
  130. <xtscm:retentionRule>
  131. <xsl:attribute name="objectClass"><xsl:value-of select="'history'"/></xsl:attribute>
  132. <xsl:attribute name="prop"><xsl:value-of select="'creationTime'"/></xsl:attribute>
  133. <xsl:attribute name="maxObjects"><xsl:value-of select="'5'"/></xsl:attribute>
  134. </xtscm:retentionRule>
  135. </xtscm:retentions>-->
  136. <!-- not sure if this is needed at the moment - but the agentDefinition does have options -->
  137. <!-- build the options - runOptions are normally in the env - the deliveryOptions are in a blob -->
  138. <xtscm:options>
  139. <!--xsl:call-template name="build_runOptions">
  140. <xsl:with-param name="env" select="."/>
  141. <xsl:with-param name="jobStep" select="false()"/>
  142. </xsl:call-template-->
  143. <xsl:copy-of select="/root/agent_definition/agentOptions/options/value"/>
  144. </xtscm:options>
  145. </xtscm:agentDefinition>
  146. </xtscm:objects>
  147. <xtscm:options>
  148. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  149. </xtscm:options>
  150. </update>
  151. </xts:transform>
  152. </send:request>
  153. </xts:transform>
  154. </agentDefinition>
  155. </xts:append>
  156. </xts:sequence>
  157. </xsl:template>
  158. <cms:build_keyItems/>
  159. <cms:prop-save/>
  160. <xsl:template match="text()"/>
  161. </xsl:stylesheet>
  162. </xts:block>
  163. <!--
  164. ===========================================================================
  165. doRemoveNotificationList
  166. ===========================================================================
  167. -->
  168. <xts:block id="doRemoveNotificationList" dependency="doUpdateAgentDefinition" processor="XSLT" type="exec">
  169. <xts:logicsheet path="logicsheets/portal.xsl"/>
  170. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  171. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:form="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/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:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 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="form send xtscm pf bus x SOAP-ENC SOAP-ENV xsi xts xtsext">
  172. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  173. <xsl:template match="/">
  174. <xts:sequence>
  175. <xts:append>
  176. <testConnection>
  177. <xsl:if test="/root/agent_definition/removeNotificationList">
  178. <xts:request href="bus://dispatcher" protocol="BUS" responseEnvelope="true" option="xml-multipart" outputHeader="true">
  179. <xsl:attribute name="soapAction"><xsl:text>http://developer.cognos.com/schemas/deliveryService/1</xsl:text></xsl:attribute>
  180. <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  181. <SOAP-ENV:Header>
  182. <bus:biBusHeader xsi:type="bus:biBusHeader">
  183. <xsl:copy-of select="/root/header/bus:biBusHeader/*"/>
  184. </bus:biBusHeader>
  185. </SOAP-ENV:Header>
  186. <SOAP-ENV:Body>
  187. <bus:clearNotifications xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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">
  188. <objectPath xsi:type="bus:searchPathSingleObject">
  189. <xsl:value-of select="/root/agent_definition/agentDefinition"/>
  190. </objectPath>
  191. </bus:clearNotifications>
  192. </SOAP-ENV:Body>
  193. </SOAP-ENV:Envelope>
  194. </xts:request>
  195. </xsl:if>
  196. </testConnection>
  197. </xts:append>
  198. </xts:sequence>
  199. </xsl:template>
  200. </xsl:stylesheet>
  201. </xts:block>
  202. <!--
  203. ===============================================================================================
  204. doUpdateAgentDefinitionReport
  205. A block which creates the report which provides the datasource for the agent. This is a subObject of the agentDefinition
  206. ===============================================================================================
  207. -->
  208. <xts:block id="doUpdateAgentDefinitionReport" dependency="doRemoveNotificationList" processor="XSLT" type="exec">
  209. <xts:logicsheet path="ags/logicsheets/cm-save.xsl"/>
  210. <xts:logicsheet path="logicsheets/portal.xsl"/>
  211. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  212. <xts:logicsheet path="ags/logicsheets/agentDefinition.xsl"/>
  213. <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:xtscm="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/ags/iFrmCmd/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="agsad cms xts send xtscm pf form xtsext">
  214. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  215. <pf:variables/>
  216. <!-- global application variables -->
  217. <xsl:template match="/">
  218. <xsl:apply-templates select="root/command/form:save/form:env"/>
  219. </xsl:template>
  220. <xsl:template match="form:env">
  221. <xsl:variable name="env" select="/root/command/form:save/form:env"/>
  222. <xts:sequence>
  223. <!-- prepare and send the add request -->
  224. <xts:append select="/root">
  225. <agentDefinitionReport>
  226. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  227. <send:request provider="cm" requester="AGS:save">
  228. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  229. <xtscm:update>
  230. <xtscm:objects>
  231. <xtscm:report>
  232. <xtscm:searchPath>
  233. <!-- attach the schedule onto the anget - not the report -->
  234. <xsl:value-of select="/root/agent_definition/agentDefinitionReport"/>
  235. </xtscm:searchPath>
  236. <xsl:call-template name="addDefaultDescription"/>
  237. <xtscm:specification>
  238. <xsl:value-of select="form:param[@name='inlineSpec']"/>
  239. </xtscm:specification>
  240. <xtscm:metadataModel>
  241. <xtscm:model>
  242. <xtscm:searchPath>
  243. <!-- put the path to the model spec in -->
  244. <xsl:value-of select="form:param[@name='metaModel']"/>
  245. </xtscm:searchPath>
  246. </xtscm:model>
  247. </xtscm:metadataModel>
  248. <xtscm:metadataModelPackage>
  249. <xtscm:package>
  250. <xtscm:searchPath>
  251. <xsl:value-of select="substring-before(form:param[@name='metaModel'],'/model[')"/>
  252. </xtscm:searchPath>
  253. </xtscm:package>
  254. </xtscm:metadataModelPackage>
  255. </xtscm:report>
  256. </xtscm:objects>
  257. <xtscm:options>
  258. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  259. </xtscm:options>
  260. </xtscm:update>
  261. </xts:transform>
  262. </send:request>
  263. </xts:transform>
  264. </agentDefinitionReport>
  265. </xts:append>
  266. </xts:sequence>
  267. </xsl:template>
  268. <!-- template to create the default description for the agent condition report-->
  269. <xsl:template name="addDefaultDescription">
  270. <!-- create an element for each property passed in -->
  271. <xsl:element name="defaultDescription" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  272. <!-- transform the condition -->
  273. <xsl:call-template name="conditionDisplayLogic">
  274. <xsl:with-param name="p1">
  275. <xsl:value-of select="/root/agent_definition/condition/text()"/>
  276. </xsl:with-param>
  277. </xsl:call-template>
  278. </xsl:element>
  279. </xsl:template>
  280. <agsad:conditionDisplayLogic/>
  281. <cms:prop-save/>
  282. <xsl:template match="text()"/>
  283. </xsl:stylesheet>
  284. </xts:block>
  285. <xts:block id="decodeScheduleParameters" type="exec" mode="interpret" processor="XSLT" dependency="doUpdateAgentDefinitionReport" mandatory="false">
  286. <!-- portal specific information-->
  287. <xts:logicsheet path="logicsheets/portal.xsl"/>
  288. <!-- Dialog specific logicsheets -->
  289. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  290. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/"
  291. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  292. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  293. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" exclude-result-prefixes="xtsext cm">
  294. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  295. <xsl:template match="/">
  296. <xsl:variable name="scheduleStoreId"><xsl:value-of select="/root/scheduleParameters/item/storeID"/></xsl:variable>
  297. <xts:sequence>
  298. <xsl:if test="/root/scheduleParameters">
  299. <xts:replace select="/root/scheduleParameters">
  300. <xts:transform name="XMLDecode">
  301. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap_settemplatename_scheduleController_settemplateid_save001',string(/root/env/param[@name='AgentTask-schedule'][last()])), true())"/>
  302. </xts:transform>
  303. </xts:replace>
  304. <xts:append select="/root/scheduleParameters/item">
  305. <storeID xsi:type="cm:guidProp" xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
  306. <value xsi:type="cm:guid"><xsl:value-of select="$scheduleStoreId"/></value>
  307. </storeID>
  308. </xts:append>
  309. </xsl:if>
  310. </xts:sequence>
  311. </xsl:template>
  312. </xsl:stylesheet>
  313. </xts:block>
  314. <!--
  315. ===============================================================================================
  316. replaceScheduleCredentials - Replace exisitng credentials with current credentials. This is becuase we need to have the
  317. Credentials correct at save time.
  318. ===============================================================================================
  319. -->
  320. <xts:block id="replaceScheduleCredentials" type="exec" path="/ags/iFrmCmd/common/replaceScheduleCredentials.xslt" mode="interpret" processor="XSLT" dependency="decodeScheduleParameters" condition=".[/root/scheduleParameters]" mandatory="false">
  321. <!-- portal specific information-->
  322. <xts:logicsheet path="logicsheets/portal.xsl"/>
  323. <!-- Dialog specific logicsheets -->
  324. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  325. </xts:block>
  326. <!--
  327. ===============================================================================================
  328. replaceScheduleCredentials - Replace exisitng credentials with current credentials. This is becuase we need to have the
  329. Credentials correct at save time.
  330. ===============================================================================================
  331. -->
  332. <xts:block id="removeScheduleOptions" dependency="replaceScheduleCredentials" processor="XSLT" type="exec">
  333. <xsl:stylesheet version="1.0"
  334. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  335. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  336. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  337. xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/"
  338. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  339. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  340. xmlns:form="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/"
  341. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  342. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  343. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  344. exclude-result-prefixes="xsl SOAP-ENC xsi cms send cm form bus xtsext pf">
  345. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  346. <pf:variables/>
  347. <xsl:key name="params" match="/root/command/*/form:env/form:param" use="@name"/>
  348. <xsl:template match="/">
  349. <xsl:if test="key('params','AgentTask-schedule')">
  350. <xts:sequence>
  351. <xts:delete select="/root/scheduleParameters/*[local-name()='item']/*[local-name()='options']"/>
  352. </xts:sequence>
  353. </xsl:if>
  354. </xsl:template>
  355. </xsl:stylesheet>
  356. </xts:block>
  357. <!--
  358. ===============================================================================================
  359. doUpdateAgentSchedule
  360. A block to update the schedule for the agent
  361. ===============================================================================================
  362. -->
  363. <xts:block id="doUpdateAgentSchedule" dependency="doUpdateAgentDefinition removeScheduleOptions" processor="XSLT" type="exec">
  364. <xts:logicsheet path="portal/iFrmCmd/logicsheets/cm-save.xsl"/>
  365. <xts:logicsheet path="logicsheets/portal.xsl"/>
  366. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  367. <xsl:stylesheet version="1.0"
  368. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  369. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  370. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  371. xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/"
  372. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  373. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  374. xmlns:form="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/"
  375. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  376. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  377. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  378. exclude-result-prefixes="xsl SOAP-ENC xsi cms send cm form bus xtsext pf">
  379. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  380. <pf:variables/>
  381. <xsl:key name="params" match="/root/command/*/form:env/form:param" use="@name"/>
  382. <xsl:template match="/">
  383. <xsl:if test="key('params','AgentTask-schedule')">
  384. <xts:sequence>
  385. <xts:append select="/root">
  386. <agentSchedule>
  387. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  388. <send:request provider="cm" requester="AGS:save">
  389. <bus:add>
  390. <search xsi:type="xsd:string">
  391. <!-- attach the schedule onto the agent -->
  392. <xsl:value-of select="/root/agent_definition/agentDefinition"/>
  393. </search>
  394. <objects xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:baseClass[1]">
  395. <item xsi:type="bus:schedule">
  396. <xsl:copy-of select="/root/scheduleParameters/*[local-name()='item']/*"/>
  397. </item>
  398. </objects>
  399. <options xsi:type="bus:addOptions">
  400. <updateAction xsi:type="bus:updateActionEnum">update</updateAction>
  401. </options>
  402. </bus:add>
  403. </send:request>
  404. </xts:transform>
  405. </agentSchedule>
  406. </xts:append>
  407. </xts:sequence>
  408. </xsl:if>
  409. </xsl:template>
  410. <!-- pull in any templates to handle "special" properties on CM objects -->
  411. <cms:prop-save/>
  412. <xsl:template match="text()"/>
  413. </xsl:stylesheet>
  414. </xts:block>
  415. <!--
  416. ===============================================================================================
  417. doDeleteAgentTasks
  418. A block which deletes tasks and target objects
  419. ===============================================================================================
  420. -->
  421. <xts:block id="doDeleteAgentTasks" dependency="doUpdateAgentSchedule" processor="XSLT" type="exec" mandatory="false" condition="/root/agent_definition/deletedItems/item">
  422. <xts:logicsheet path="logicsheets/portal.xsl"/>
  423. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  424. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:form="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/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:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="form send xtscm pf bus x SOAP-ENC xtsext">
  425. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  426. <!-- Handle any agentTaskDefinition adds that are required -->
  427. <pf:variables/>
  428. <xsl:template match="/">
  429. <xsl:variable name="env" select="/root/command/form:save/form:env"/>
  430. <xts:sequence>
  431. <!-- do all the deletions of the step objects -->
  432. <xsl:if test="/root/agent_definition/deletedItems/item">
  433. <!-- Handle any deletes that are required -->
  434. <xts:append>
  435. <deletedSteps>
  436. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  437. <send:request provider="cm" requester="AGS:save">
  438. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  439. <delete xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  440. <xtscm:objects>
  441. <xsl:for-each select="/root/agent_definition/deletedItems/item">
  442. <xsl:if test="./taskStoreID != ''">
  443. <xtscm:agentTaskDefinition>
  444. <xtscm:searchPath>
  445. <xsl:value-of select="./taskStoreID"/>
  446. </xtscm:searchPath>
  447. </xtscm:agentTaskDefinition>
  448. </xsl:if>
  449. <xsl:if test="./targetStoreID !=''">
  450. <xsl:if test="./type = 'message' ">
  451. <xtscm:memo>
  452. <xtscm:searchPath>
  453. <xsl:value-of select="./targetStoreID"/>
  454. </xtscm:searchPath>
  455. </xtscm:memo>
  456. </xsl:if>
  457. <xsl:if test="./type = 'sql' ">
  458. <xtscm:storedProcedureTask>
  459. <xtscm:searchPath>
  460. <xsl:value-of select="./targetStoreID"/>
  461. </xtscm:searchPath>
  462. </xtscm:storedProcedureTask>
  463. </xsl:if>
  464. <xsl:if test="./type = 'url' ">
  465. <xtscm:baseRSSTask>
  466. <xtscm:searchPath>
  467. <xsl:value-of select="./targetStoreID"/>
  468. </xtscm:searchPath>
  469. </xtscm:baseRSSTask>
  470. </xsl:if>
  471. <xsl:if test="./type = 'web' ">
  472. <xtscm:webServiceTask>
  473. <xtscm:searchPath>
  474. <xsl:value-of select="./targetStoreID"/>
  475. </xtscm:searchPath>
  476. </xtscm:webServiceTask>
  477. </xsl:if>
  478. <xsl:if test="./type = 'notification' or ./type = 'approval' ">
  479. <xtscm:humanTask>
  480. <xtscm:searchPath>
  481. <xsl:value-of select="./targetStoreID"/>
  482. </xtscm:searchPath>
  483. </xtscm:humanTask>
  484. </xsl:if>
  485. </xsl:if>
  486. </xsl:for-each>
  487. </xtscm:objects>
  488. <xtscm:options>
  489. <xsl:attribute name="recursive"><xsl:text>true</xsl:text></xsl:attribute>
  490. <xsl:attribute name="force"><xsl:text>true</xsl:text></xsl:attribute>
  491. </xtscm:options>
  492. </delete>
  493. </xts:transform>
  494. </send:request>
  495. </xts:transform>
  496. </deletedSteps>
  497. </xts:append>
  498. <!-- delete the paths -->
  499. <xts:delete select="/root/agent_definition/deletedItems/item"/>
  500. </xsl:if>
  501. </xts:sequence>
  502. </xsl:template>
  503. </xsl:stylesheet>
  504. </xts:block>
  505. <!--
  506. ================================================================================
  507. doLoadCurrentTargets
  508. a block which loads information about the targets for objects which are being updated
  509. ===============================================================================================
  510. -->
  511. <xts:block id="doLoadCurrentTargets" dependency="doDeleteAgentTasks" processor="XSLT" type="exec" condition="/root/agent_item" mandatory="false">
  512. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  513. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  514. <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:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:form="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/" exclude-result-prefixes="send xtsext xtscm form">
  515. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  516. <xsl:template match="/">
  517. <xts:sequence>
  518. <xsl:for-each select="/root/agent_definition/items/item">
  519. <xsl:variable name="id" select="./id"/>
  520. <xsl:if test="./targetStoreID != ''">
  521. <xts:append select="/root/agent_item[@id = '{$id}']">
  522. <currentTaskTarget>
  523. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  524. <send:request provider="cm" requester="AGS:save">
  525. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  526. <xtscm:query xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/">
  527. <xtscm:search>
  528. <xsl:value-of select="./targetStoreID"/>
  529. </xtscm:search>
  530. <xtscm:properties>
  531. <xtscm:property name="searchPath"/>
  532. <xtscm:property name="storeID"/>
  533. <xtscm:property name="objectClass"/>
  534. </xtscm:properties>
  535. </xtscm:query>
  536. </xts:transform>
  537. </send:request>
  538. </xts:transform>
  539. </currentTaskTarget>
  540. </xts:append>
  541. </xsl:if>
  542. </xsl:for-each>
  543. </xts:sequence>
  544. </xsl:template>
  545. </xsl:stylesheet>
  546. </xts:block>
  547. <!--
  548. ================================================================================
  549. doUpdateAgentSubObjects
  550. a block which updates the agentSubObject which are already in existance.
  551. ===============================================================================================
  552. -->
  553. <xts:block id="doUpdateAgentSubObjects" dependency="doLoadCurrentTargets" processor="XSLT" type="exec" condition="/root/agent_item" mandatory="false">
  554. <xts:logicsheet path="ags/logicsheets/agsCmHelper.xsl"/>
  555. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  556. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  557. <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:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:agsh="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agsCmHelper/" xmlns:form="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/" exclude-result-prefixes="send xtsext xtscm agsh form">
  558. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  559. <xsl:template match="/">
  560. <xts:sequence>
  561. <xsl:for-each select="/root/agent_definition/items/item">
  562. <xsl:variable name="id" select="./id"/>
  563. <xsl:variable name="operation">
  564. <xsl:choose>
  565. <xsl:when test="./taskStoreID">
  566. <xsl:text>update</xsl:text>
  567. </xsl:when>
  568. <xsl:otherwise>
  569. <xsl:text>add</xsl:text>
  570. </xsl:otherwise>
  571. </xsl:choose>
  572. </xsl:variable>
  573. <xsl:variable name="searchPath">
  574. <xsl:choose>
  575. <xsl:when test="./taskStoreID">
  576. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/targetStoreID"/>
  577. </xsl:when>
  578. <xsl:otherwise>
  579. <xsl:value-of select="/root/agent_definition/agentDefinition"/>
  580. </xsl:otherwise>
  581. </xsl:choose>
  582. </xsl:variable>
  583. <xsl:choose>
  584. <xsl:when test="./type='sql'">
  585. <!-- we should have got the search path for this item in the block above - so we have to run an update on this now -->
  586. <xts:append select="/root/agent_item[@id = '{$id}']">
  587. <agentTaskTarget>
  588. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  589. <send:request provider="cm" requester="AGS:save">
  590. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  591. <xsl:element name="{$operation}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  592. <xtscm:objects>
  593. <xtscm:storedProcedureTask>
  594. <xtscm:searchPath>
  595. <!-- put either the search path to the task (update) or search path the agent (add) -->
  596. <xsl:value-of select="$searchPath"/>
  597. </xtscm:searchPath>
  598. <!-- give the memo the name of the task -->
  599. <xtscm:defaultName>
  600. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/name"/>
  601. </xtscm:defaultName>
  602. <xtscm:storedProcedureName>
  603. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='sql_procedure_name']"/>
  604. </xtscm:storedProcedureName>
  605. <xsl:if test="/root/agent_item[@id = $id]/param[@name='sql_model']!=''">
  606. <xtscm:metadataModel>
  607. <xtscm:model>
  608. <xtscm:searchPath>
  609. <!-- put the path to the model spec in -->
  610. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='sql_model']"/>
  611. </xtscm:searchPath>
  612. </xtscm:model>
  613. </xtscm:metadataModel>
  614. </xsl:if>
  615. <xtscm:metadataModelPackage>
  616. <xtscm:package>
  617. <xtscm:searchPath>
  618. <!-- put the path to the model spec in -->
  619. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='sql_package']"/>
  620. </xtscm:searchPath>
  621. </xtscm:package>
  622. </xtscm:metadataModelPackage>
  623. <!-- just copy the options that we've got -->
  624. <xsl:copy-of select="/root/agent_item[@id = $id]/options"/>
  625. </xtscm:storedProcedureTask>
  626. </xtscm:objects>
  627. <xtscm:options>
  628. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  629. </xtscm:options>
  630. </xsl:element>
  631. </xts:transform>
  632. </send:request>
  633. </xts:transform>
  634. </agentTaskTarget>
  635. </xts:append>
  636. </xsl:when>
  637. <xsl:when test="./type='url'">
  638. <xsl:variable name="task" select="/root/agent_item[@id=$id]"/>
  639. <xsl:variable name="replaceObject2">
  640. <xsl:choose>
  641. <xsl:when test="not(./taskStoreID)">
  642. <xsl:text>false</xsl:text>
  643. </xsl:when>
  644. <xsl:when test="$task/param[@name='url_uri'] = 'url_url'">
  645. <!-- check the object class in the returned target -->
  646. <xsl:if test="/root/agent_item[@id=$id]/currentTaskTarget/xtscm:queryResponse/*/xtscm:objectClass='urlRSSTask'">
  647. <xsl:text>false</xsl:text>
  648. </xsl:if>
  649. </xsl:when>
  650. <xsl:when test="$task/param[@name='url_uri'] = 'url_entry' or $task/param[@name='url_uri'] = 'url_eventList' ">
  651. <!-- check the object class in the returned target -->
  652. <xsl:if test="/root/agent_item[@id=$id]/currentTaskTarget/xtscm:queryResponse/*/xtscm:objectClass='shortcutRSSTask'">
  653. <xsl:text>false</xsl:text>
  654. </xsl:if>
  655. </xsl:when>
  656. <xsl:otherwise>
  657. <xsl:text>true</xsl:text>
  658. </xsl:otherwise>
  659. </xsl:choose>
  660. </xsl:variable>
  661. <!-- determine if we're replaceing or updating -->
  662. <xsl:variable name="replaceObject">
  663. <xsl:choose>
  664. <xsl:when test="not(./taskStoreID)">
  665. <xsl:text>false</xsl:text>
  666. </xsl:when>
  667. <xsl:when test="$task/param[@name='url_uri'] = 'url_url'">
  668. <!-- check the object class in the returned target -->
  669. <xsl:if test="/root/agent_item[@id=$id]/currentTaskTarget/xtscm:queryResponse/*/xtscm:objectClass='urlRSSTask'">
  670. <xsl:text>false</xsl:text>
  671. </xsl:if>
  672. </xsl:when>
  673. <xsl:when test="$task/param[@name='url_uri'] = 'url_entry'">
  674. <!-- check the object class in the returned target -->
  675. <xsl:if test="/root/agent_item[@id=$id]/currentTaskTarget/xtscm:queryResponse/*/xtscm:objectClass='shortcutRSSTask'">
  676. <xsl:text>false</xsl:text>
  677. </xsl:if>
  678. </xsl:when>
  679. <xsl:when test="$task/param[@name='url_uri'] = 'url_eventList'">
  680. <!-- check the object class in the returned target -->
  681. <xsl:if test="/root/agent_item[@id=$id]/currentTaskTarget/xtscm:queryResponse/*/xtscm:objectClass='shortcutAgentRSSTask'">
  682. <xsl:text>false</xsl:text>
  683. </xsl:if>
  684. </xsl:when>
  685. <xsl:otherwise>
  686. <xsl:text>true</xsl:text>
  687. </xsl:otherwise>
  688. </xsl:choose>
  689. </xsl:variable>
  690. <!-- either replace or create/update the object -->
  691. <xsl:choose>
  692. <xsl:when test="$replaceObject != 'false'">
  693. <send:request provider="cm" requester="AGS:save">
  694. <bus:delete xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  695. <search xsi:type="xsd:string">
  696. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/targetStoreID"/>
  697. </search>
  698. <options xsi:type="bus:deleteOptions">
  699. <recursive xsi:type="xsd:boolean">true</recursive>
  700. <force xsi:type="xsd:boolean">true</force>
  701. </options>
  702. </bus:delete>
  703. </send:request>
  704. <xts:append select="/root/agent_item[@id = '{$id}']">
  705. <agentTaskTarget>
  706. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  707. <send:request provider="cm" requester="AGS:save">
  708. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  709. <add xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  710. <xtscm:objects>
  711. <xsl:call-template name="rssTaskObject">
  712. <xsl:with-param name="task" select="$task"/>
  713. <xsl:with-param name="path" select="/root/agent_definition/agentDefinition"/>
  714. <xsl:with-param name="name" select="/root/agent_definition/items/item[./id = $id]/name"/>
  715. </xsl:call-template>
  716. </xtscm:objects>
  717. <xtscm:options>
  718. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  719. </xtscm:options>
  720. </add>
  721. </xts:transform>
  722. </send:request>
  723. </xts:transform>
  724. </agentTaskTarget>
  725. </xts:append>
  726. </xsl:when>
  727. <xsl:otherwise>
  728. <!-- we should have got the search path for this item in the block above - so we have to run an update on this now -->
  729. <xts:append select="/root/agent_item[@id = '{$id}']">
  730. <agentTaskTarget>
  731. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  732. <send:request provider="cm" requester="AGS:save">
  733. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  734. <xsl:element name="{$operation}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  735. <xtscm:objects>
  736. <xsl:call-template name="rssTaskObject">
  737. <xsl:with-param name="task" select="$task"/>
  738. <!-- put either the search path to the task (update) or search path the agent (add) -->
  739. <xsl:with-param name="path" select="$searchPath"/>
  740. <xsl:with-param name="name" select="/root/agent_definition/items/item[./id = $id]/name"/>
  741. </xsl:call-template>
  742. </xtscm:objects>
  743. <xtscm:options>
  744. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  745. </xtscm:options>
  746. </xsl:element>
  747. </xts:transform>
  748. </send:request>
  749. </xts:transform>
  750. </agentTaskTarget>
  751. </xts:append>
  752. </xsl:otherwise>
  753. </xsl:choose>
  754. </xsl:when>
  755. <xsl:when test="./type='web'">
  756. <!-- we should have got the search path for this item in the block above - so we have to run an update on this now -->
  757. <xts:append select="/root/agent_item[@id = '{$id}']">
  758. <agentTaskTarget>
  759. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  760. <send:request provider="cm" requester="AGS:save">
  761. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  762. <xsl:element name="{$operation}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  763. <xtscm:objects>
  764. <xtscm:webServiceTask>
  765. <xtscm:searchPath>
  766. <!-- put either the search path to the task (update) or search path the agent (add) -->
  767. <xsl:value-of select="$searchPath"/>
  768. </xtscm:searchPath>
  769. <!-- give the memo the name of the task -->
  770. <xtscm:defaultName>
  771. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/name"/>
  772. </xtscm:defaultName>
  773. <xtscm:uri>
  774. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='url_wsdl']"/>
  775. </xtscm:uri>
  776. <xtscm:operationName>
  777. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='url_operation']"/>
  778. </xtscm:operationName>
  779. <xtscm:serviceName>
  780. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='url_serviceName']"/>
  781. </xtscm:serviceName>
  782. <xtscm:inputMessageName/>
  783. <xtscm:outputMessageName/>
  784. <xtscm:bindingName>
  785. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='url_port']"/>
  786. </xtscm:bindingName>
  787. <!-- just copy the options that we've got -->
  788. <xsl:copy-of select="/root/agent_item[@id = $id]/options"/>
  789. </xtscm:webServiceTask>
  790. </xtscm:objects>
  791. <xtscm:options>
  792. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  793. </xtscm:options>
  794. </xsl:element>
  795. </xts:transform>
  796. </send:request>
  797. </xts:transform>
  798. </agentTaskTarget>
  799. </xts:append>
  800. </xsl:when>
  801. <xsl:when test="./type='message'">
  802. <!-- we should have got the search path for this item in the block above - so we have to run an update on this now -->
  803. <xts:append select="/root/agent_item[@id = '{$id}']">
  804. <agentTaskTarget>
  805. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  806. <send:request provider="cm" requester="AGS:save">
  807. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  808. <xsl:element name="{$operation}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  809. <xtscm:objects>
  810. <xtscm:memo>
  811. <xtscm:searchPath>
  812. <!-- put either the search path to the target (update) or search path the agent (add) -->
  813. <xsl:value-of select="$searchPath"/>
  814. </xtscm:searchPath>
  815. <!-- give the memo object the taskName of the object -->
  816. <xtscm:defaultName>
  817. <xsl:value-of select="/root/agent_definition/items/item[./id = $id]/name"/>
  818. </xtscm:defaultName>
  819. <!-- build the options - runOptions are normally in the env - the deliveryOptions are in a blob -->
  820. <!-- copy the options from the message step -->
  821. <xsl:copy-of select="/root/agent_item[@id=$id]/options"/>
  822. </xtscm:memo>
  823. </xtscm:objects>
  824. <xtscm:options>
  825. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  826. </xtscm:options>
  827. </xsl:element>
  828. </xts:transform>
  829. </send:request>
  830. </xts:transform>
  831. </agentTaskTarget>
  832. </xts:append>
  833. </xsl:when>
  834. <xsl:when test="./type='notification' or ./type='approval'">
  835. <xsl:variable name="taskIconPath"><xsl:value-of select="/root/agent_item[@id=$id]/*[local-name()='taskOptions']//*[local-name()='manualTask']/*[local-name()='taskIconPath']"/></xsl:variable>
  836. <xsl:if test="$taskIconPath=''">
  837. <xts:replace select="/root/agent_item[@id = '{$id}']/taskOptions//*[local-name()='manualTask']/*[local-name()='taskIconPath']">
  838. <taskIconPath>
  839. <xsl:call-template name="getHumanTaskIcon">
  840. <xsl:with-param name="item" select="/root/agent_definition/items/item[./id = $id]"/>
  841. </xsl:call-template>
  842. </taskIconPath>
  843. </xts:replace>
  844. </xsl:if>
  845. <!-- we should have got the search path for this item in the block above - so we have to run an update on this now -->
  846. <xts:append select="/root/agent_item[@id = '{$id}']">
  847. <agentTaskTarget>
  848. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  849. <send:request provider="cm" requester="AGS:save">
  850. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  851. <xsl:element name="{$operation}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  852. <xtscm:objects>
  853. <xtscm:humanTask>
  854. <xtscm:searchPath>
  855. <!-- put either the search path to the target (update) or search path the agent (add) -->
  856. <xsl:value-of select="$searchPath"/>
  857. </xtscm:searchPath>
  858. <!-- give the memo the name of the task -->
  859. <xtscm:defaultName>
  860. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/name"/>
  861. </xtscm:defaultName>
  862. <!-- set the icon URI - this should alter the icon in the portal -->
  863. <xsl:choose>
  864. <xsl:when test="/root/agent_definition/items/item[./id = $id]/type = 'notification'">
  865. <xtscm:iconURI>./ps/portal/images/icon_notification.gif</xtscm:iconURI>
  866. </xsl:when>
  867. <xsl:when test="/root/agent_definition/items/item[./id = $id]/type = 'approval'">
  868. <xtscm:iconURI>./ps/portal/images/icon_approval_task.gif</xtscm:iconURI>
  869. </xsl:when>
  870. </xsl:choose>
  871. <!-- set the type of the task into the object - we need to know what type to resurrect it -->
  872. <xtscm:operationName>
  873. <xsl:value-of select="/root/agent_definition/items/item[./id = $id]/type"/>
  874. </xtscm:operationName>
  875. <xtscm:parameters>
  876. <xtscm:parameterValue>
  877. <xtscm:name>hts</xtscm:name>
  878. <xtscm:simpleParmValueItem>
  879. <xtscm:inclusive>false</xtscm:inclusive>
  880. <xtscm:display>hts</xtscm:display>
  881. <xtscm:use>
  882. <xts:transform name="XMLEncode">
  883. <xts:transform src="ags/transforms/getChildren.xslt" processor="XSLT">
  884. <xsl:copy-of select="/root/agent_item[@id = $id]/taskOptions"/>
  885. </xts:transform>
  886. </xts:transform>
  887. </xtscm:use>
  888. </xtscm:simpleParmValueItem>
  889. </xtscm:parameterValue>
  890. </xtscm:parameters>
  891. </xtscm:humanTask>
  892. </xtscm:objects>
  893. <xtscm:options>
  894. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  895. </xtscm:options>
  896. </xsl:element>
  897. </xts:transform>
  898. </send:request>
  899. </xts:transform>
  900. </agentTaskTarget>
  901. </xts:append>
  902. </xsl:when>
  903. </xsl:choose>
  904. </xsl:for-each>
  905. </xts:sequence>
  906. </xsl:template>
  907. <!--write a template to create the rss objects -->
  908. <agsh:rssTaskObject/>
  909. <xsl:template name="getHumanTaskIcon">
  910. <xsl:param name="item"/>
  911. <xsl:choose>
  912. <xsl:when test="$item/type = 'notification'">
  913. <xsl:text>ps/portal/images/icon_notification.gif</xsl:text>
  914. </xsl:when>
  915. <xsl:when test="$item/type = 'approval'">
  916. <xsl:text>ps/portal/images/icon_approval_task.gif</xsl:text>
  917. </xsl:when>
  918. </xsl:choose>
  919. </xsl:template>
  920. </xsl:stylesheet>
  921. </xts:block>
  922. <!--
  923. ===============================================================================================
  924. doUpdateAgentTasks
  925. A block which updates the action steps
  926. ===============================================================================================
  927. -->
  928. <xts:block id="doUpdateAgentTasks" dependency="doUpdateAgentSubObjects" processor="XSLT" type="exec" mandatory="false" condition="/root/agent_item">
  929. <xts:logicsheet path="ags/logicsheets/cm-save.xsl"/>
  930. <xts:logicsheet path="logicsheets/portal.xsl"/>
  931. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  932. <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:form="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/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:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="cms form send xtscm pf bus x SOAP-ENC xtsext">
  933. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  934. <!-- Handle any agentTaskDefinition adds that are required -->
  935. <pf:variables/>
  936. <xsl:template match="/">
  937. <xsl:variable name="env" select="/root/command/form:save/form:env"/>
  938. <xts:sequence>
  939. <xsl:for-each select="/root/agent_definition/items/item">
  940. <xsl:variable name="id" select="./id"/>
  941. <xsl:variable name="position" select="position()"/>
  942. <xsl:variable name="operation">
  943. <xsl:choose>
  944. <xsl:when test="./taskStoreID != ''">
  945. <xsl:text>update</xsl:text>
  946. </xsl:when>
  947. <xsl:otherwise>
  948. <xsl:text>add</xsl:text>
  949. </xsl:otherwise>
  950. </xsl:choose>
  951. </xsl:variable>
  952. <xsl:variable name="searchPath">
  953. <xsl:choose>
  954. <xsl:when test="./taskStoreID != ''">
  955. <xsl:value-of select="./taskStoreID"/>
  956. </xsl:when>
  957. <xsl:otherwise>
  958. <xsl:value-of select="/root/agent_definition/agentDefinition"/>
  959. </xsl:otherwise>
  960. </xsl:choose>
  961. </xsl:variable>
  962. <xts:append select="/root/agent_item[@id = '{$id}']">
  963. <agentTask>
  964. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  965. <send:request provider="cm" requester="AGS:save">
  966. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  967. <xsl:element name="{$operation}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  968. <xtscm:objects>
  969. <xtscm:agentTaskDefinition>
  970. <xtscm:searchPath>
  971. <!-- put either the search path to the task (update) or search path the agent (add) -->
  972. <xsl:value-of select="$searchPath"/>
  973. </xtscm:searchPath>
  974. <xtscm:defaultName>
  975. <xsl:choose>
  976. <xsl:when test="./type='sql' or ./type='web' or ./type='url' or ./type='message' or ./type='approval' or ./type='notification'">
  977. <xsl:value-of select="concat('Task-' , /root/agent_definition/items/item[./id=$id]/name)"/>
  978. </xsl:when>
  979. <xsl:otherwise>
  980. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/name"/>
  981. </xsl:otherwise>
  982. </xsl:choose>
  983. </xtscm:defaultName>
  984. <xtscm:displaySequence>
  985. <xsl:value-of select="$position"/>
  986. </xtscm:displaySequence>
  987. <xtscm:taskObject>
  988. <xsl:choose>
  989. <xsl:when test="./type = 'report'">
  990. <xtscm:report>
  991. <xtscm:searchPath>
  992. <!-- put the path to either the object being updated - or the parent agentDefinition object if added -->
  993. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='selected_path']"/>
  994. </xtscm:searchPath>
  995. </xtscm:report>
  996. </xsl:when>
  997. <xsl:when test="./type = 'sql'">
  998. <xtscm:storedProcedureTask>
  999. <xtscm:searchPath>
  1000. <!-- put the path into the sql proc that we selected as the action -->
  1001. <xsl:value-of select="/root/agent_item[@id = $id]/agentTaskTarget//xtscm:searchPath"/>
  1002. </xtscm:searchPath>
  1003. </xtscm:storedProcedureTask>
  1004. </xsl:when>
  1005. <xsl:when test="./type = 'web'">
  1006. <xtscm:webServiceTask>
  1007. <xtscm:searchPath>
  1008. <!-- put the path into the web service that we selected as the action -->
  1009. <xsl:value-of select="/root/agent_item[@id = $id]/agentTaskTarget//xtscm:searchPath"/>
  1010. </xtscm:searchPath>
  1011. </xtscm:webServiceTask>
  1012. </xsl:when>
  1013. <xsl:when test="./type = 'url'">
  1014. <xtscm:baseRSSTask>
  1015. <xtscm:searchPath>
  1016. <!-- put the path into the report that we selected as the action -->
  1017. <xsl:value-of select="/root/agent_item[@id = $id]/agentTaskTarget//xtscm:searchPath"/>
  1018. </xtscm:searchPath>
  1019. </xtscm:baseRSSTask>
  1020. </xsl:when>
  1021. <xsl:when test="./type = 'agent'">
  1022. <xtscm:agent>
  1023. <xtscm:searchPath>
  1024. <!-- put the path into the report that we selected as the action -->
  1025. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='selected_path']"/>
  1026. </xtscm:searchPath>
  1027. </xtscm:agent>
  1028. </xsl:when>
  1029. <xsl:when test="./type = 'job'">
  1030. <xtscm:jobDefinition>
  1031. <xtscm:searchPath>
  1032. <!-- put the path into the report that we selected as the action -->
  1033. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='selected_path']"/>
  1034. </xtscm:searchPath>
  1035. </xtscm:jobDefinition>
  1036. </xsl:when>
  1037. <xsl:when test="./type = 'import'">
  1038. <xtscm:importDeployment>
  1039. <xtscm:searchPath>
  1040. <!-- put the path into import deployment -->
  1041. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='selected_path']"/>
  1042. </xtscm:searchPath>
  1043. </xtscm:importDeployment>
  1044. </xsl:when>
  1045. <xsl:when test="./type = 'index'">
  1046. <xtscm:indexUpdateTask>
  1047. <xtscm:searchPath>
  1048. <!-- put the path into import deployment -->
  1049. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='selected_path']"/>
  1050. </xtscm:searchPath>
  1051. </xtscm:indexUpdateTask>
  1052. </xsl:when>
  1053. <xsl:when test="./type = 'export'">
  1054. <xtscm:exportDeployment>
  1055. <xtscm:searchPath>
  1056. <!-- put the path into export deployment -->
  1057. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='selected_path']"/>
  1058. </xtscm:searchPath>
  1059. </xtscm:exportDeployment>
  1060. </xsl:when>
  1061. <xsl:when test="./type = 'content'">
  1062. <xtscm:contentTask>
  1063. <xtscm:searchPath>
  1064. <!-- put the path into the content task deployment -->
  1065. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='selected_path']"/>
  1066. </xtscm:searchPath>
  1067. </xtscm:contentTask>
  1068. </xsl:when>
  1069. <xsl:when test="./type = 'metric'">
  1070. <xtscm:baseDataIntegrationTask>
  1071. <xtscm:searchPath>
  1072. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='selected_path']"/>
  1073. </xtscm:searchPath>
  1074. </xtscm:baseDataIntegrationTask>
  1075. </xsl:when>
  1076. <xsl:when test="./type = 'planningMacro'">
  1077. <xtscm:planningMacroTask>
  1078. <xtscm:searchPath>
  1079. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='selected_path']"/>
  1080. </xtscm:searchPath>
  1081. </xtscm:planningMacroTask>
  1082. </xsl:when>
  1083. <xsl:when test="./type = 'migration'">
  1084. <xtscm:migrationTask>
  1085. <xtscm:searchPath>
  1086. <xsl:value-of select="/root/agent_item[@id = $id]/param[@name='selected_path']"/>
  1087. </xtscm:searchPath>
  1088. </xtscm:migrationTask>
  1089. </xsl:when>
  1090. <xsl:when test="./type='notification' or ./type= 'approval'">
  1091. <xtscm:humanTask>
  1092. <xtscm:searchPath>
  1093. <!-- put the path into the report that we selected as the action -->
  1094. <xsl:value-of select="/root/agent_item[@id = $id]/agentTaskTarget//xtscm:searchPath"/>
  1095. </xtscm:searchPath>
  1096. </xtscm:humanTask>
  1097. </xsl:when>
  1098. <xsl:when test="./type='message'">
  1099. <xtscm:memo>
  1100. <xtscm:searchPath>
  1101. <!-- put the path into the report that we selected as the action -->
  1102. <xsl:value-of select="/root/agent_item[@id = $id]/agentTaskTarget//xtscm:searchPath"/>
  1103. </xtscm:searchPath>
  1104. </xtscm:memo>
  1105. </xsl:when>
  1106. </xsl:choose>
  1107. </xtscm:taskObject>
  1108. <!-- build the options - runOptions are normally in the env - the deliveryOptions are in a blob -->
  1109. <xtscm:options>
  1110. <!--xsl:call-template name="build_runOptions">
  1111. <xsl:with-param name="env" select="/root/agent_item[@id = $id]"/>
  1112. <xsl:with-param name="jobStep" select="true()"/>
  1113. </xsl:call-template-->
  1114. <!-- build the agent run options-->
  1115. <xsl:variable name="agentItem" select="/root/agent_item[@id = $id]"/>
  1116. <!--xsl:variable name="agentOptions" select="$agentItem/param[@name=starts-with(@name,'m_ao_')]"/-->
  1117. <runOptions>
  1118. <xsl:if test="$agentItem/options != ''">
  1119. <xsl:copy-of select="$agentItem/options/*[local-name()='value']/*[local-name()='item']"/>
  1120. </xsl:if>
  1121. <!--xsl:for-each select="$agentOptions">
  1122. <xsl:variable name="agentOptionName" select="substring-after(@name, 'm_ao_')"/>
  1123. <xsl:if test="@name='m_ao_availableAsEmailAttachment'">
  1124. <item xsi:type="cm:agentOptionBoolean">
  1125. <name xsi:type="cm:agentOptionEnum">
  1126. <xsl:value-of select="$agentOptionName"/>
  1127. </name>
  1128. <value xsi:type="xsd:boolean">
  1129. <xsl:value-of select="."/>
  1130. </value>
  1131. </item>
  1132. </xsl:if>
  1133. </xsl:for-each-->
  1134. </runOptions>
  1135. </xtscm:options>
  1136. <!-- can save the filter values in a real place now -->
  1137. <xtscm:eventTypes>
  1138. <xsl:for-each select="./suppression/param[starts-with(@name, 'Filter_')]">
  1139. <xtscm:item>
  1140. <xsl:value-of select="."/>
  1141. </xtscm:item>
  1142. </xsl:for-each>
  1143. </xtscm:eventTypes>
  1144. <!-- this is the query item list that filters in conjunction with Filter_changed
  1145. or Filter_unchanged not well named as event key -->
  1146. <xtscm:eventKey>
  1147. <xsl:call-template name="build_keyItems">
  1148. <xsl:with-param name="keyItems">
  1149. <xsl:value-of select="./suppression/param[@name='Action_topic_filter']"/>
  1150. </xsl:with-param>
  1151. </xsl:call-template>
  1152. </xtscm:eventKey>
  1153. <xtscm:filterDataItemName><xsl:value-of select="./taskLevelFilter"/></xtscm:filterDataItemName>
  1154. <xtscm:runCondition><xsl:value-of select="./runCondition"/></xtscm:runCondition>
  1155. <!-- build the parameters and assignments-->
  1156. <xsl:call-template name="build_parameters">
  1157. <xsl:with-param name="id" select="$id"/>
  1158. </xsl:call-template>
  1159. <xsl:call-template name="build_assignments">
  1160. <xsl:with-param name="id" select="$id"/>
  1161. </xsl:call-template>
  1162. </xtscm:agentTaskDefinition>
  1163. </xtscm:objects>
  1164. <xtscm:options>
  1165. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  1166. <xtscm:returnProperties>
  1167. <xtscm:property>storeID</xtscm:property>
  1168. <xtscm:property>taskObject</xtscm:property>
  1169. <xtscm:property>defaultName</xtscm:property>
  1170. </xtscm:returnProperties>
  1171. </xtscm:options>
  1172. </xsl:element>
  1173. </xts:transform>
  1174. </send:request>
  1175. </xts:transform>
  1176. </agentTask>
  1177. </xts:append>
  1178. </xsl:for-each>
  1179. </xts:sequence>
  1180. </xsl:template>
  1181. <!--
  1182. Single template to make the parameters instead of just copying it
  1183. -->
  1184. <xsl:template name="build_parameters">
  1185. <xsl:param name="id"/>
  1186. <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">
  1187. <xsl:for-each select="/root/agent_items_params/agent_item_params[@id = $id]/parameterData/parameterValues/item">
  1188. <xsl:variable name="parameterName" select="./name"/>
  1189. <!-- only copy the item if there's not a corresponding assignment -->
  1190. <xsl:if test="not(/root/agent_items_params/agent_item_params[@id = $id]/parameterData/parameterAssignments/parameterAssignment[./parameterName=$parameterName])">
  1191. <xsl:copy-of select="."/>
  1192. </xsl:if>
  1193. </xsl:for-each>
  1194. </parameters>
  1195. </xsl:template>
  1196. <!--build the assignments prop for the agent task by id this is a bit roundabout... specially to a form used by preprocess.xslt-->
  1197. <xsl:template name="build_assignments">
  1198. <xsl:param name="id"/>
  1199. <xsl:if test="/root/agent_items_params/agent_item_params[@id = $id]/parameterData/parameterAssignments">
  1200. <xtscm:parameterAssignments>
  1201. <xsl:for-each select="/root/agent_items_params/agent_item_params[@id = $id]/parameterData/parameterAssignments/parameterAssignment">
  1202. <xtscm:parameterAssignmentDataItem>
  1203. <xtscm:parameterName>
  1204. <xsl:value-of select="./parameterName"/>
  1205. </xtscm:parameterName>
  1206. <xtscm:dataItemName>
  1207. <xsl:value-of select="./dataItemName"/>
  1208. </xtscm:dataItemName>
  1209. </xtscm:parameterAssignmentDataItem>
  1210. </xsl:for-each>
  1211. </xtscm:parameterAssignments>
  1212. </xsl:if>
  1213. </xsl:template>
  1214. <!--
  1215. pull in any templates to handle "special" properties on CM objects
  1216. -->
  1217. <cms:prop-save/>
  1218. <xsl:template match="text()"/>
  1219. <!-- template to make the key items into something which pre-process can make -->
  1220. <cms:build_keyItems/>
  1221. </xsl:stylesheet>
  1222. </xts:block>
  1223. <!--
  1224. ===============================================================================================
  1225. doMemoHumanSubObjectsPostProcess (hack)
  1226. a block which searches memo options, and humanTask parameter values and where agentReportTask tab ids are found, replaces with the storeID of
  1227. the offending agentReportTask. WE don't know the dependencies now so we have to save items with task dependencies in 2 steps
  1228. First - save everything - Second - update all tasks with references to other tasks and then update the object in CM
  1229. ===============================================================================================
  1230. -->
  1231. <xts:block id="doMemoHumanSubObjectsPostProcess" dependency="doUpdateAgentTasks" processor="XSLT" type="exec" condition="/root/agent_item" mandatory="false">
  1232. <xts:logicsheet path="ags/logicsheets/agsCmHelper.xsl"/>
  1233. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:agsh="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agsCmHelper/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="agsh xtsext">
  1234. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  1235. <xsl:template match="/">
  1236. <xts:sequence>
  1237. <!-- pre-process all the memo tasks -->
  1238. <xsl:for-each select="/root/descendant::item[ancestor::agent_item[@type='message'] and contains(@*[local-name()='type'],'memoPartAgentObject')]">
  1239. <!-- this is the hack - we need the report tab id, assume it is set in the memoPartObject -->
  1240. <xsl:variable name="position" select="position()"/>
  1241. <xsl:variable name="searchPath" select="searchPath"/>
  1242. <xsl:variable name="agentReportTaskStoreID" select="/root/agent_item[@id=$searchPath]/agentTask/*[local-name()='addResponse' or local-name()='updateResponse']/*[local-name()='agentTaskDefinition']/*[local-name()='defaultName']"/>
  1243. <!-- if we have a mapping - do the replace -->
  1244. <xsl:if test="$agentReportTaskStoreID">
  1245. <xts:replace xmlns:xts="http://developer.cognos.com/schemas/xts/" select="/root/descendant::item[ancestor::agent_item[@type='message'] and contains(@*[local-name()='type'],'memoPartAgentObject')][{position()}]/searchPath" mandatory="true">
  1246. <searchPath>
  1247. <xsl:copy-of select="$searchPath/@*"/>
  1248. <xsl:value-of select="$agentReportTaskStoreID"/>
  1249. </searchPath>
  1250. </xts:replace>
  1251. </xsl:if>
  1252. </xsl:for-each>
  1253. <!-- pre-process all the human tasks with taskLinks -->
  1254. <xsl:for-each select="/root/descendant::*[local-name()='taskLink'][ancestor::agent_item[@type='notification' or @type='approval']]">
  1255. <!-- this is the hack - we need the report tab id, assume it is set in the memoPartObject -->
  1256. <xsl:variable name="position" select="position()"/>
  1257. <xsl:variable name="id" select="*[local-name()='id']"/>
  1258. <xsl:variable name="agentReportTaskStoreID" select="/root/agent_item[@id=$id]/agentTask/*[local-name()='addResponse' or local-name()='updateResponse']/*[local-name()='agentTaskDefinition']/*[local-name()='defaultName']"/>
  1259. <!-- if we have a mapping - do the replace -->
  1260. <xsl:if test="$agentReportTaskStoreID">
  1261. <xts:replace xmlns:xts="http://developer.cognos.com/schemas/xts/" select="/root/descendant::*[local-name()='taskLink'][ancestor::agent_item[@type='notification' or @type='approval']][{position()}]/*[local-name()='id']" mandatory="true">
  1262. <impl:id xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1">
  1263. <xsl:copy-of select="$id/@*"/>
  1264. <xsl:value-of select="$agentReportTaskStoreID"/>
  1265. </impl:id>
  1266. </xts:replace>
  1267. </xsl:if>
  1268. </xsl:for-each>
  1269. <!-- post-process all the human tasks with futureTasks -->
  1270. <xsl:for-each select="/root/descendant::*[local-name()='futureTask'][ancestor::agent_item[@type='notification' or @type='approval']]">
  1271. <!-- this is the hack - we need the report tab id, assume it is set in the memoPartObject -->
  1272. <xsl:variable name="position" select="position()"/>
  1273. <xsl:variable name="id" select="*[local-name()='id']"/>
  1274. <xsl:variable name="agentReportTaskStoreID" select="/root/agent_item[@id=$id]/agentTask/*[local-name()='addResponse' or local-name()='updateResponse']/*[local-name()='agentTaskDefinition']/*[local-name()='defaultName']"/>
  1275. <!-- if we have a mapping - do the replace -->
  1276. <xsl:if test="$agentReportTaskStoreID">
  1277. <xts:replace xmlns:xts="http://developer.cognos.com/schemas/xts/" select="/root/descendant::*[local-name()='futureTask'][ancestor::agent_item[@type='notification' or @type='approval']][{position()}]/*[local-name()='id']" mandatory="true">
  1278. <impl:id xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1">
  1279. <xsl:copy-of select="$id/@*"/>
  1280. <xsl:value-of select="$agentReportTaskStoreID"/>
  1281. </impl:id>
  1282. </xts:replace>
  1283. </xsl:if>
  1284. </xsl:for-each>
  1285. </xts:sequence>
  1286. </xsl:template>
  1287. <!--include template for converting storeID's into search paths -->
  1288. <agsh:storeIDConverter/>
  1289. </xsl:stylesheet>
  1290. </xts:block>
  1291. <!--
  1292. ================================================================================
  1293. doUpdateAgentMemoHumanSubObjects
  1294. a block which updates memo/human objects which are already there.
  1295. ===============================================================================================
  1296. -->
  1297. <xts:block id="doUpdateAgentMemoHumanSubObjects" dependency="doMemoHumanSubObjectsPostProcess" processor="XSLT" type="exec" condition="/root/agent_item" mandatory="false">
  1298. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  1299. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  1300. <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:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:form="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/" exclude-result-prefixes="send xtsext xtscm form">
  1301. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  1302. <xsl:template match="/">
  1303. <xts:sequence>
  1304. <xsl:for-each select="/root/agent_definition/items/item">
  1305. <xsl:variable name="id" select="./id"/>
  1306. <xsl:if test="./type='message' or ./type='notification' or ./type='approval' ">
  1307. <xsl:variable name="operation">
  1308. <xsl:text>update</xsl:text>
  1309. </xsl:variable>
  1310. <xsl:variable name="searchPath">
  1311. <xsl:value-of select="/root/agent_definition/items/item[./id=$id]/targetStoreID"/>
  1312. </xsl:variable>
  1313. <!-- we should have got the search path for this item in the block above - so we have to run an update on this now -->
  1314. <xts:replace select="/root/agent_item[@id = '{$id}']/agentTaskTarget">
  1315. <agentTaskTarget>
  1316. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  1317. <send:request provider="cm" requester="AGS:save">
  1318. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  1319. <xsl:element name="{$operation}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  1320. <xtscm:objects>
  1321. <xsl:choose>
  1322. <xsl:when test="./type='message'">
  1323. <!-- we should have got the search path for this item in the block above - so we have to run an update on this now -->
  1324. <xtscm:memo>
  1325. <xtscm:searchPath>
  1326. <!-- put the search path which was returned from the phase(I) save -->
  1327. <xsl:value-of select="/root/agent_item[@id = $id]/agentTaskTarget//xtscm:memo/xtscm:searchPath"/>
  1328. </xtscm:searchPath>
  1329. <!-- copy the options from the message step -->
  1330. <xsl:copy-of select="/root/agent_item[@id=$id]/options"/>
  1331. </xtscm:memo>
  1332. </xsl:when>
  1333. <xsl:when test="./type='notification' or ./type='approval'">
  1334. <!-- we should have got the search path for this item in the block above - so we have to run an update on this now -->
  1335. <xtscm:humanTask>
  1336. <xtscm:searchPath>
  1337. <!-- put the search path which was returned from the phase(I) save -->
  1338. <xsl:value-of select="/root/agent_item[@id = $id]/agentTaskTarget//xtscm:humanTask/xtscm:searchPath"/>
  1339. </xtscm:searchPath>
  1340. <!-- update the parameters which might have changed -->
  1341. <xtscm:parameters>
  1342. <xtscm:parameterValue>
  1343. <xtscm:name>hts</xtscm:name>
  1344. <xtscm:simpleParmValueItem>
  1345. <xtscm:inclusive>false</xtscm:inclusive>
  1346. <xtscm:display>hts</xtscm:display>
  1347. <xtscm:use>
  1348. <xts:transform name="XMLEncode">
  1349. <xts:transform src="ags/transforms/getChildren.xslt" processor="XSLT">
  1350. <xsl:copy-of select="/root/agent_item[@id = $id]/taskOptions"/>
  1351. </xts:transform>
  1352. </xts:transform>
  1353. </xtscm:use>
  1354. </xtscm:simpleParmValueItem>
  1355. </xtscm:parameterValue>
  1356. </xtscm:parameters>
  1357. </xtscm:humanTask>
  1358. </xsl:when>
  1359. </xsl:choose>
  1360. </xtscm:objects>
  1361. <xtscm:options>
  1362. <xsl:attribute name="updateAction"><xsl:text>fail</xsl:text></xsl:attribute>
  1363. </xtscm:options>
  1364. </xsl:element>
  1365. </xts:transform>
  1366. </send:request>
  1367. </xts:transform>
  1368. </agentTaskTarget>
  1369. </xts:replace>
  1370. </xsl:if>
  1371. </xsl:for-each>
  1372. </xts:sequence>
  1373. </xsl:template>
  1374. </xsl:stylesheet>
  1375. </xts:block>
  1376. <!--
  1377. ===============================================================================================
  1378. doSavePaths
  1379. A block which saves all the search paths of the objects that we've created into the agent definition block
  1380. =========================================================================== -->
  1381. <xts:block id="doSavePaths" dependency="doUpdateAgentMemoHumanSubObjects" processor="XSLT" type="exec">
  1382. <xts:logicsheet path="ags/logicsheets/agsCmHelper.xsl"/>
  1383. <xts:logicsheet path="logicsheets/portal.xsl"/>
  1384. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  1385. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:form="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:agsh="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agsCmHelper/" xmlns:x="x" 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="form send xtscm pf bus agsh x SOAP-ENC xtsext xsi">
  1386. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  1387. <!-- Handle any agentTaskDefinitions adds that are required -->
  1388. <xsl:template match="/">
  1389. <xsl:variable name="env" select="/root/command/form:save/form:env"/>
  1390. <xts:sequence>
  1391. <!-- need to replace the schedule information -->
  1392. <xsl:if test="/root/agentSchedule/xtscm:addResponse/xtscm:schedule/xtscm:storeID">
  1393. <!-- delete and append - maybe the case we have no schedule defined already -->
  1394. <xts:delete select="/root/agent_definition/agentSchedule"/>
  1395. <xts:append select="/root/agent_definition/agentSchedule">
  1396. <agentSchedule>
  1397. <xsl:call-template name="storeIDConverter">
  1398. <xsl:with-param name="storeID">
  1399. <xsl:value-of select="/root/agentSchedule/xtscm:addResponse/xtscm:schedule/xtscm:storeID"/>
  1400. </xsl:with-param>
  1401. </xsl:call-template>
  1402. </agentSchedule>
  1403. </xts:append>
  1404. </xsl:if>
  1405. <xsl:for-each select="/root/agent_item">
  1406. <xsl:variable name="id" select="./@id"/>
  1407. <!-- delete any previous task and target store ID's -->
  1408. <xts:delete select="/root/agent_definition/items/item[id='{$id}']/taskStoreID"/>
  1409. <xts:delete select="/root/agent_definition/items/item[id='{$id}']/targetStoreID"/>
  1410. <!-- put the new ones in place -->
  1411. <xts:append select="/root/agent_definition/items/item[id='{$id}']">
  1412. <taskStoreID>
  1413. <xsl:call-template name="storeIDConverter">
  1414. <xsl:with-param name="storeID">
  1415. <xsl:value-of select="./agentTask/*[local-name()='addResponse' or local-name()='updateResponse']/xtscm:agentTaskDefinition/xtscm:storeID"/>
  1416. </xsl:with-param>
  1417. </xsl:call-template>
  1418. </taskStoreID>
  1419. <targetStoreID>
  1420. <xsl:call-template name="storeIDConverter">
  1421. <xsl:with-param name="storeID">
  1422. <xsl:value-of select="./agentTask/*[local-name()='addResponse' or local-name()='updateResponse']/xtscm:agentTaskDefinition/xtscm:taskObject/*/xtscm:storeID"/>
  1423. </xsl:with-param>
  1424. </xsl:call-template>
  1425. </targetStoreID>
  1426. </xts:append>
  1427. </xsl:for-each>
  1428. </xts:sequence>
  1429. </xsl:template>
  1430. <!--include template for converting storeID's into search paths -->
  1431. <agsh:storeIDConverter/>
  1432. </xsl:stylesheet>
  1433. </xts:block>
  1434. <!--
  1435. ================================================================================
  1436. do the commandResults ???
  1437. ================================================================================
  1438. -->
  1439. <xts:block id="commandResults" processor="XSLT" type="exec" mode="output" mimeType="text/xml" dependency="doSavePaths">
  1440. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  1441. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" version="1.0" exclude-result-prefixes="xtscm">
  1442. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  1443. <xsl:template match="/root">
  1444. <response>
  1445. <xsl:copy-of select="agent_definition"/>
  1446. </response>
  1447. </xsl:template>
  1448. <xsl:template match="text()"/>
  1449. </xsl:stylesheet>
  1450. </xts:block>
  1451. <!--
  1452. ===============================================================================================
  1453. faultHandler
  1454. ===============================================================================================
  1455. -->
  1456. <xts:block id="ignore" type="fault" processor="XSLT">
  1457. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  1458. <xsl:output method="xml"/>
  1459. <xsl:template match="/root/fault">
  1460. <error>
  1461. <xsl:value-of select="//*[local-name() = 'messageString']"/>
  1462. </error>
  1463. </xsl:template>
  1464. <xsl:template match="text()"/>
  1465. </xsl:stylesheet>
  1466. </xts:block>
  1467. </xts:morphlet>