load_agent.xts 128 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761
  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, 2017
  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/" messageBase="messages/AGS.xml,messages/portal.xml" requiredCapability="canUseEventStudio">
  18. <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt" nodelist="env,credential,system,http"/>
  19. <!--
  20. ===============================================================================================
  21. Get the information for the agent
  22. ===============================================================================================
  23. -->
  24. <xts:block id="getAgentDefinition" type="exec" mode="interpret" processor="XSLT" dependency="formlogic_init" nodelist="header,env,http,cookies">
  25. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  26. <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:cm="http://developer.cognos.com/schemas/xts-cm/1/" exclude-result-prefixes="send cm">
  27. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  28. <xsl:template match="/">
  29. <xts:sequence>
  30. <xts:append select="root">
  31. <agentDefinition>
  32. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  33. <send:request provider="cm" requester="AGS:load_agent">
  34. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  35. <cm:query>
  36. <cm:search>
  37. <xsl:value-of select="/root/env/param[@name = 'm_path']"/>
  38. </cm:search>
  39. <cm:properties>
  40. <cm:property name="defaultName"/>
  41. <cm:property name="searchPath"/>
  42. <cm:property name="storeID"/>
  43. <cm:property name="sequencing"/>
  44. <!--cm:property name="notificationList"/-->
  45. <cm:property name="allowNotification"/>
  46. <cm:property name="position"/>
  47. <cm:property name="options"/>
  48. <cm:property name="runOptions"/>
  49. <cm:property name="retentions"/>
  50. <cm:property name="eventKey"/>
  51. <cm:property name="ancestors"/>
  52. </cm:properties>
  53. </cm:query>
  54. </xts:transform>
  55. </send:request>
  56. </xts:transform>
  57. </agentDefinition>
  58. </xts:append>
  59. <xts:append select="root">
  60. <agentNotificationList>
  61. <xts:request href="bus://dispatcher" protocol="BUS" responseEnvelope="false" outputHeader="false" option="xml-multipart">
  62. <xsl:attribute name="soapAction">
  63. <xsl:text>http://developer.cognos.com/schemas/deliveryService/1</xsl:text>
  64. </xsl:attribute>
  65. <SOAP-ENV:Envelope 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:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  66. <SOAP-ENV:Header>
  67. <bus:biBusHeader xsi:type="bus:biBusHeader">
  68. <xsl:copy-of select="/root/header/bus:biBusHeader/*"/>
  69. </bus:biBusHeader>
  70. </SOAP-ENV:Header>
  71. <SOAP-ENV:Body>
  72. <xsl:element name="getNotificationList" namespace="http://developer.cognos.com/schemas/deliveryService/1">
  73. <search xsi:type="bus:searchPathSingleObject"><xsl:value-of select="/root/env/param[@name = 'm_path']"/></search>
  74. </xsl:element>
  75. </SOAP-ENV:Body>
  76. </SOAP-ENV:Envelope>
  77. </xts:request>
  78. </agentNotificationList>
  79. </xts:append>
  80. </xts:sequence>
  81. </xsl:template>
  82. </xsl:stylesheet>
  83. </xts:block>
  84. <!--
  85. ===============================================================================================
  86. update condition(report) report spec version - e.g. mr2 version is 2.0 and blacksea version is 4.0
  87. ===============================================================================================
  88. -->
  89. <xts:block id="updateReportSpec" type="exec" mode="interpret" processor="XSLT" dependency="getAgentDefinition" nodelist="header,env,http,cookies">
  90. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  91. <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:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:rs="http://developer.cognos.com/schemas/reportService/1" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" exclude-result-prefixes="send cm rs xsi">
  92. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  93. <xsl:template match="/">
  94. <xts:sequence>
  95. <xts:append select="root">
  96. <agentDefinitionReport>
  97. <send:request provider="warp">
  98. <rs:query>
  99. <objectPath xsi:type="bus:searchPathSingleObject">
  100. <xsl:value-of select="concat(/root/env/param[@name = 'm_path'], '/report')"/>
  101. </objectPath>
  102. <bus:parameterValues SOAP-ENC:arrayType="bus:parameterValue[]" xsi:type="SOAP-ENC:Array"/>
  103. <rs:options xsi:type="bus:optionArray" SOAP-ENC:arrayType="bus:option[]">
  104. <item xsi:type="bus:asynchOptionInt">
  105. <bus:name xsi:type="bus:asynchOptionEnum">primaryWaitThreshold</bus:name>
  106. <bus:value xsi:type="xsd:int">0</bus:value>
  107. </item>
  108. <item xsi:type="bus:asynchOptionInt">
  109. <bus:name xsi:type="bus:asynchOptionEnum">secondaryWaitThreshold</bus:name>
  110. <bus:value xsi:type="xsd:int">30</bus:value>
  111. </item>
  112. <item xsi:type="bus:contentManagerQueryOptionPropEnumArray">
  113. <name xsi:type="bus:contentManagerQueryOptionEnum">properties</name>
  114. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:propEnum[]">
  115. <item>defaultName</item>
  116. <item>searchPath</item>
  117. <item>storeID</item>
  118. <item>options</item>
  119. <item>retentions</item>
  120. <item>specification</item>
  121. <item>metadataModel</item>
  122. <item>packageBase</item>
  123. <item>metadataModelPackage</item>
  124. <item>parameters</item>
  125. <item>paths</item>
  126. <item>modificationTime</item>
  127. <item>routingServerGroup</item>
  128. </value>
  129. </item>
  130. <item xsi:type="bus:reportServiceQueryOptionSpecificationFormat">
  131. <name xsi:type="bus:reportServiceQueryOptionEnum">specificationFormat</name>
  132. <value xsi:type="bus:specificationFormatEnum">report</value>
  133. </item>
  134. <item xsi:type="bus:reportServiceQueryOptionBoolean">
  135. <name xsi:type="bus:reportServiceQueryOptionEnum">upgrade</name>
  136. <value xsi:type="xs:boolean">true</value>
  137. </item>
  138. <item xsi:type="bus:runOptionBoolean">
  139. <bus:name xsi:type="bus:runOptionEnum">prompt</bus:name>
  140. <bus:value xsi:type="xsd:boolean">false</bus:value>
  141. </item>
  142. </rs:options>
  143. </rs:query>
  144. </send:request>
  145. </agentDefinitionReport>
  146. </xts:append>
  147. <xts:replace select="/root/agentDefinitionReport">
  148. <agentDefinitionReport>
  149. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  150. <bus:queryResponse xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
  151. <xts:transform src="ags/transforms/removeNameSpace.xslt" processor="XSLT">
  152. <item xsi:type="cm:report">
  153. <xts:queryNode select="/root/agentDefinitionReport/*[local-name()='queryResponse']/*[local-name()='result']/*[local-name()='details']/item/*[local-name()='report']/*"/>
  154. </item>
  155. </xts:transform>
  156. </bus:queryResponse>
  157. </xts:transform>
  158. </agentDefinitionReport>
  159. </xts:replace>
  160. </xts:sequence>
  161. </xsl:template>
  162. </xsl:stylesheet>
  163. </xts:block>
  164. <!--
  165. ===============================================================================================
  166. Extract the filter from the report spec
  167. ===============================================================================================
  168. -->
  169. <xts:block id="getAgentCondition" type="exec" mode="interpret" processor="XSLT" dependency="updateReportSpec" nodelist="agentDefinitionReport">
  170. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  171. <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:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:cmrp="http://developer.cognos.com/schemas/report/14.0/" exclude-result-prefixes="send cm cmrp">
  172. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  173. <xsl:key name="filters" match="/root/agentDefinitionReport/*[local-name()='queryResponse']/*[local-name()='report']/*[local-name()='specification']/*[local-name()='report']/*[local-name()='queries']/*[local-name()='query']/*" use="local-name()"/>/>
  174. <xsl:template match="/">
  175. <xts:sequence>
  176. <xts:append>
  177. <xsl:variable name="detailExpression" select="key('filters','detailFilters')"/>
  178. <xsl:variable name="summaryExpression" select="key('filters','summaryFilters')"/>
  179. <agentDefinitionCondition>
  180. <summary>
  181. <xsl:text/>
  182. <xsl:variable name="both">
  183. <xsl:if test="$detailExpression != '' and $summaryExpression != ''"> and </xsl:if>
  184. </xsl:variable>
  185. <xsl:value-of select="$detailExpression"/><xsl:value-of select="$both"/><xsl:value-of select="$summaryExpression"/>
  186. <xsl:text/>
  187. </summary>
  188. <expressionBlob>
  189. <xsl:if test="$detailExpression and $detailExpression/*[local-name()='detailFilter']/*[local-name()='filterExpression'] != ''">
  190. <xts:transform name="XMLEncode">
  191. <xsl:copy-of select="$detailExpression"/>
  192. </xts:transform>
  193. </xsl:if>
  194. <xsl:if test="$summaryExpression and $summaryExpression/*[local-name()='summaryFilter']/*[local-name()='filterExpression'] != ''">
  195. <xts:transform name="XMLEncode">
  196. <xsl:copy-of select="$summaryExpression"/>
  197. </xts:transform>
  198. </xsl:if>
  199. </expressionBlob>
  200. <detailsExpression>
  201. <xsl:if test="$detailExpression and $detailExpression/*[local-name()='detailFilter']/*[local-name()='filterExpression'] != ''">
  202. <xsl:value-of select="$detailExpression/*[local-name()='detailFilter']/*[local-name()='filterExpression']"/>
  203. </xsl:if>
  204. </detailsExpression>
  205. <summaryExpression>
  206. <xsl:if test="$detailExpression and $detailExpression/*[local-name()='summaryFilter']/*[local-name()='filterExpression'] != ''">
  207. <xsl:value-of select="$detailExpression/*[local-name()='summaryFilter']/*[local-name()='filterExpression']"/>
  208. </xsl:if>
  209. </summaryExpression>
  210. </agentDefinitionCondition>
  211. </xts:append>
  212. </xts:sequence>
  213. </xsl:template>
  214. </xsl:stylesheet>
  215. </xts:block>
  216. <!--
  217. ===============================================================================================
  218. Get the information for the agent job steps
  219. ===============================================================================================
  220. -->
  221. <xts:block id="getAgentTaskObjects" type="exec" mode="interpret" processor="XSLT" dependency="getAgentCondition" nodelist="header,env,http,cookies">
  222. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  223. <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:cm="http://developer.cognos.com/schemas/xts-cm/1/" exclude-result-prefixes="send cm">
  224. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  225. <xsl:template match="/">
  226. <xts:sequence>
  227. <xts:append>
  228. <agentTaskDefinitions>
  229. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  230. <send:request provider="cm" requester="AGS:load_agent">
  231. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  232. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  233. <cm:search><xsl:value-of select="concat(/root/env/param[@name = 'm_path'], '/agentTaskDefinition')"/></cm:search>
  234. <cm:properties>
  235. <cm:property name="defaultName"/>
  236. <cm:property name="searchPath"/>
  237. <cm:property name="storeID"/>
  238. <cm:property name="options"/>
  239. <cm:property name="runOptions"/>
  240. <cm:property name="parameters"/>
  241. <cm:property name="parameterAssignments"/>
  242. <cm:property name="taskObject"/>
  243. <cm:property name="eventKey"/>
  244. <cm:property name="eventTypes"/>
  245. <cm:property name="storedProcedureName"/>
  246. <cm:property name="metadataModel"/>
  247. <cm:property name="metadataModelPackage"/>
  248. <cm:property name="filterDataItemName"/>
  249. <cm:property name="runCondition"/>
  250. </cm:properties>
  251. <cm:options>
  252. <cm:refProps>
  253. <!-- get all the task properties using refProps -->
  254. <cm:refProp refPropName="taskObject">
  255. <cm:properties>
  256. <cm:property name="defaultName"/>
  257. <cm:property name="searchPath"/>
  258. <cm:property name="storeID"/>
  259. <cm:property name="ancestors"/>
  260. <cm:property name="defaultDescription"/>
  261. <cm:property name="defaultScreenTip"/>
  262. <cm:property name="canBurst"/>
  263. <cm:property name="permissions"/>
  264. <cm:property name="position"/>
  265. <cm:property name="options"/>
  266. <cm:property name="parameters"/>
  267. <cm:property name="storedProcedureName"/>
  268. <cm:property name="metadataModel"/>
  269. <cm:property name="metadataModelPackage"/>
  270. <cm:property name="bindingName"/>
  271. <cm:property name="inputMessageName"/>
  272. <cm:property name="outputMessageName"/>
  273. <cm:property name="operationName"/>
  274. <cm:property name="serviceName"/>
  275. <cm:property name="uri"/>
  276. <cm:property name="channel"/>
  277. <cm:property name="link"/>
  278. <cm:property name="title"/>
  279. </cm:properties>
  280. </cm:refProp>
  281. </cm:refProps>
  282. </cm:options>
  283. <cm:sortBy>
  284. <cm:sort name="displaySequence" order="ascending"/>
  285. </cm:sortBy>
  286. </cm:query>
  287. </xts:transform>
  288. </send:request>
  289. </xts:transform>
  290. </agentTaskDefinitions>
  291. </xts:append>
  292. </xts:sequence>
  293. </xsl:template>
  294. </xsl:stylesheet>
  295. </xts:block>
  296. <!--
  297. ===============================================================================================
  298. Get the information for the schedule
  299. ===============================================================================================
  300. -->
  301. <xts:block id="getAgentSchedule" type="exec" mode="interpret" processor="XSLT" dependency="getAgentTaskObjects" nodelist="header,env,http,cookies">
  302. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  303. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  304. <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:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" exclude-result-prefixes="send cm cml">
  305. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  306. <xsl:template match="/">
  307. <xts:sequence>
  308. <xts:append>
  309. <agentSchedule>
  310. <!--xts:transform src="transforms/CM/post-process.xslt" processor="XSLT"-->
  311. <send:request provider="cm" requester="AGS:load_agent">
  312. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  313. <cm:query>
  314. <cm:search>
  315. <xsl:value-of select="concat(/root/env/param[@name='m_path'],'/schedule[permission(&quot;read&quot;)]')"/>
  316. </cm:search>
  317. <cm:properties>
  318. <cml:prop-schedule/>
  319. <cm:property name="storeID"/>
  320. </cm:properties>
  321. </cm:query>
  322. </xts:transform>
  323. </send:request>
  324. <!--/xts:transform-->
  325. </agentSchedule>
  326. </xts:append>
  327. </xts:sequence>
  328. </xsl:template>
  329. </xsl:stylesheet>
  330. </xts:block>
  331. <!--
  332. ===============================================================================================
  333. generateTaskLinkHelpers - loop through the memo task links and query CM for each one.
  334. The following structure is created which is used by 'updateMemoTask' to delete the links/attachments from the memo
  335. that have been removed. Empty nodes in link/item or attachment mean the item has been deleted.
  336. <linkHelpers>
  337. <memo>
  338. <taskSearchPath> .. </taskSearchPath>
  339. <searchPath> .. </searchPath>
  340. <attachment>
  341. <attachmentSearchPath>...</attachmentSearchPath>
  342. <item>
  343. <searchPath/>
  344. <objectClass/>
  345. <displayName/>
  346. </item>
  347. <link>
  348. <linkSearchPath>...</linkSearchPath>
  349. <item>
  350. <searchPath/>
  351. <objectClass/>
  352. <displayName/>
  353. </item>
  354. </link>
  355. <link>
  356. <linkSearchPath>...</linkSearchPath>
  357. <item>
  358. <searchPath>CAMID("ENT:u=S-1-5-21-284529841-4053721766-3450372860-1021")/folder[@name='My Folders']/report[@name='Product Report']</searchPath>
  359. <objectClass>report</objectClass>
  360. <displayName>Product Report</displayName>
  361. </item>
  362. </link>
  363. </memo>
  364. <linkHelpers/>
  365. ===============================================================================================
  366. -->
  367. <xts:block id="generateTaskLinkHelpers" type="exec" processor="XSLT" dependency="getAgentSchedule"
  368. condition=".[/root/*[local-name()='agentTaskDefinitions']/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition']/*[local-name()='taskObject']/*[local-name()='memo']/*[local-name()='options']//*[local-name()='item'][attribute::*[local-name()='type']='objectLink' or attribute::*[local-name()='type']='memoPartAgentObject'] ]"
  369. mandatory="false" nodelist="agentDefinition,agentTaskDefinitions,header,http,env,cookies,system">
  370. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  371. <xsl:stylesheet version="1.0"
  372. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  373. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  374. exclude-result-prefixes="xsl send">
  375. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  376. <!-- memo task links-->
  377. <xsl:template match="/">
  378. <xts:sequence>
  379. <xts:append select="/root">
  380. <linkHelpers>
  381. <!-- loop through all memo tasks -->
  382. <xsl:for-each select="/root/*[local-name()='agentTaskDefinitions']/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition']/*[local-name()='taskObject']/*[local-name()='memo']">
  383. <xsl:variable name="memo" select="."/>
  384. <memo>
  385. <taskSearchPath><xsl:value-of select="../../*[local-name()='searchPath']"/></taskSearchPath>
  386. <searchPath><xsl:value-of select="$memo/*[local-name()='searchPath']"/></searchPath>
  387. <xsl:for-each select="./*[local-name()='options']//*[local-name()='item'][./*[local-name()='searchPath']]">
  388. <xsl:if test="attribute::*[local-name()='type']='bus:memoPartAgentObject' ">
  389. <attachment>
  390. <xsl:variable name="taskSearchPath" select="./*[local-name()='searchPath']"/>
  391. <xsl:choose>
  392. <!-- with the event output - we actually point to the agentDefinition itself -->
  393. <xsl:when test="$taskSearchPath = 'eventOutput' ">
  394. <xsl:call-template name="outputAttachment">
  395. <xsl:with-param name="taskSearchPath" select="$taskSearchPath"/>
  396. <xsl:with-param name="task" select="/root/*[local-name()='agentDefinition']/*[local-name()='queryResponse']/*[local-name()='agentDefinition']"/>
  397. </xsl:call-template>
  398. </xsl:when>
  399. <xsl:otherwise>
  400. <xsl:call-template name="outputAttachment">
  401. <xsl:with-param name="taskSearchPath" select="$taskSearchPath"/>
  402. <xsl:with-param name="task" select="/root/*[local-name()='agentTaskDefinitions']/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition'][./*[local-name()='searchPath']=$taskSearchPath or contains($taskSearchPath,./*[local-name()='storeID']) ]/*[local-name()='taskObject']/*"/>
  403. </xsl:call-template>
  404. </xsl:otherwise>
  405. </xsl:choose>
  406. </attachment>
  407. </xsl:if>
  408. <xsl:if test="attribute::*[local-name()='type']='bus:objectLink' ">
  409. <link>
  410. <!-- store the search path to the link so that we know which one to delete if the CM object could not be found-->
  411. <linkSearchPath><xsl:value-of select="./*[local-name()='searchPath']"/></linkSearchPath>
  412. <!-- query CM to see if the link exists -->
  413. <xts:transform src="portal/emailOptions/transforms/gen-standard-list.xslt" processor="XSLT">
  414. <xts:param name="messageBase">/messages/portal.xml</xts:param>
  415. <root>
  416. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  417. <send:request provider="cm" requester="AGS:load_agent">
  418. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  419. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  420. <cm:requests>
  421. <cm:query>
  422. <cm:search>
  423. <xsl:value-of select="./*[local-name()='searchPath']"/><xsl:value-of select="/root/system/param[@name='visible']"/>
  424. </cm:search>
  425. <cm:properties>
  426. <cm:property name="defaultName"/>
  427. <cm:property name="searchPath"/>
  428. <cm:property name="iconURI"/>
  429. </cm:properties>
  430. </cm:query>
  431. </cm:requests>
  432. </cm:query>
  433. </xts:transform>
  434. </send:request>
  435. </xts:transform>
  436. <action>links</action>
  437. </root>
  438. </xts:transform>
  439. </link>
  440. </xsl:if>
  441. </xsl:for-each>
  442. </memo>
  443. </xsl:for-each>
  444. </linkHelpers>
  445. </xts:append>
  446. </xts:sequence>
  447. </xsl:template>
  448. <xsl:template name="outputAttachment">
  449. <xsl:param name="taskSearchPath"/>
  450. <xsl:param name="task"/>
  451. <attachmentSearchPath>
  452. <xsl:value-of select="$taskSearchPath"/>
  453. </attachmentSearchPath>
  454. <item>
  455. <searchPath><xsl:value-of select="$task/*[local-name()='searchPath']"/></searchPath>
  456. <userName><xsl:value-of select="$task/*[local-name()='userName']"/></userName>
  457. <defaultName><xsl:value-of select="$task/*[local-name()='defaultName']"/></defaultName>
  458. </item>
  459. </xsl:template>
  460. </xsl:stylesheet>
  461. </xts:block>
  462. <!--
  463. ===============================================================================================
  464. update the memo tasks if any.
  465. update the agent memo task to remove links and attachments of deleted reports/agents
  466. ===============================================================================================
  467. -->
  468. <xts:block id="updateMemoTask" type="exec" mode="interpret" processor="XSLT" dependency="generateTaskLinkHelpers" mandatory="false" condition=".[/root/*[local-name()='linkHelpers']/*[local-name()='memo']/*/*[local-name()='item']/*[local-name()='searchPath']=''] " nodelist="agentTaskDefinitions,linkHelpers,env,header,http,cookies">
  469. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  470. <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:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  471. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  472. <xsl:template match="/">
  473. <xts:sequence>
  474. <!-- loop over all the memo object which are in the linkHelpers -->
  475. <xsl:for-each select="/root/linkHelpers/memo">
  476. <xsl:variable name="position" select="position()"/>
  477. <xsl:variable name="memoSearchPath" select="./*[local-name()='searchPath']"/>
  478. <!-- do we need to alter the contents -->
  479. <xsl:if test="./*[./item/searchPath = '']">
  480. <!-- we do -->
  481. <xts:replace select="/root/agentTaskDefinitions/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition']/*[local-name()='taskObject']/*[local-name()='memo'][./*[local-name()='searchPath']=/root/linkHelpers/memo[position()={$position}]/searchPath]/*[local-name()='options']">
  482. <xts:transform src="ags/transforms/removeLinksAttachments.xslt" processor="XSLT">
  483. <root>
  484. <!-- copy the options which need changing -->
  485. <xsl:copy-of select="/root/agentTaskDefinitions/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition']/*[local-name()='taskObject']/*[local-name()='memo'][./*[local-name()='searchPath']=/root/linkHelpers/memo[position()=$position]/searchPath]/*[local-name()='options']"/>
  486. <!-- copy the appropriate link helpers -->
  487. <xsl:copy-of select="."/>
  488. </root>
  489. </xts:transform>
  490. </xts:replace>
  491. <!-- update CM as well -->
  492. <send:request provider="cm" requester="AGS:load_agent">
  493. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  494. <cm:update>
  495. <cm:objects>
  496. <cm:memo>
  497. <cm:searchPath>
  498. <xsl:value-of select="$memoSearchPath"/>
  499. </cm:searchPath>
  500. <xts:queryNode select="/root/agentTaskDefinitions/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition']/*[local-name()='taskObject']/*[local-name()='memo'][./*[local-name()='searchPath']=/root/linkHelpers/memo[position()={$position}]/searchPath]/*[local-name()='options']"/>
  501. </cm:memo>
  502. </cm:objects>
  503. </cm:update>
  504. </xts:transform>
  505. </send:request>
  506. </xsl:if>
  507. </xsl:for-each>
  508. </xts:sequence>
  509. </xsl:template>
  510. </xsl:stylesheet>
  511. </xts:block>
  512. <!--
  513. ===============================================================================================
  514. tidyEmailTaskLinkHelpers - remove the link helpers
  515. ===============================================================================================
  516. -->
  517. <xts:block id="tidyEmailTaskLinkHelpers" type="exec" mode="interpret" processor="XSLT" dependency="updateMemoTask" mandatory="false" condition=".[/root/*[local-name()='linkHelpers']]" nodelist="linkHelpers">
  518. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  519. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  520. <xsl:template match="/">
  521. <xts:sequence>
  522. <xts:delete select="/root/*[local-name()='linkHelpers']"/>
  523. </xts:sequence>
  524. </xsl:template>
  525. </xsl:stylesheet>
  526. </xts:block>
  527. <!--
  528. ===============================================================================================
  529. delets the agent task
  530. deletes the agent task from the summary bar which has been deleted from the portal
  531. ===============================================================================================
  532. -->
  533. <xts:block id="deleteEmptyTask" type="exec" mode="interpret" processor="XSLT" dependency="tidyEmailTaskLinkHelpers" condition=".[/root/agentTaskDefinitions/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition']/*[local-name()='taskObject' and not(*)]]" mandatory="false" nodelist="agentTaskDefinitions,header,env,http,cookies">
  534. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  535. <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:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  536. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  537. <xsl:template match="/">
  538. <xts:sequence>
  539. <xts:append select="/root">
  540. <deleteTasks>
  541. <xts:queryNode select="/root/agentTaskDefinitions/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition'][./*[local-name()='taskObject' and not(*)]]/*[local-name()='storeID']"/>
  542. </deleteTasks>
  543. </xts:append>
  544. <xts:delete select="/root/agentTaskDefinitions/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition'][./*[local-name()='taskObject' and not(*)]]"/>
  545. </xts:sequence>
  546. </xsl:template>
  547. </xsl:stylesheet>
  548. </xts:block>
  549. <!--
  550. ===============================================================================================
  551. transform the parameters back to cm style
  552. ===============================================================================================
  553. -->
  554. <xts:block id="transformParameters" type="exec" mode="interpret" processor="XSLT" dependency="deleteEmptyTask" nodelist="agentTaskDefinitions">
  555. <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:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes=" xtsext">
  556. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  557. <xsl:template match="/">
  558. <xts:sequence>
  559. <xts:append select="/root">
  560. <transformedParams>
  561. <!-- loop over all the agentTaskDefinitions-->
  562. <xsl:for-each select="/root/agentTaskDefinitions/cm:queryResponse/cm:agentTaskDefinition">
  563. <parameterData>
  564. <xts:transform src="transforms/portal/parameters/pre-WARP-process.xslt" processor="XSLT">
  565. <xsl:copy-of select="cm:parameters"/>
  566. </xts:transform>
  567. <!-- blinking no namespace -->
  568. <parameterAssignments>
  569. <xsl:apply-templates/>
  570. </parameterAssignments>
  571. </parameterData>
  572. </xsl:for-each>
  573. </transformedParams>
  574. </xts:append>
  575. </xts:sequence>
  576. </xsl:template>
  577. <xsl:template match="cm:parameterAssignments">
  578. <xsl:for-each select="./cm:parameterAssignmentDataItem">
  579. <xsl:element name="parameterAssignment">
  580. <xsl:element name="parameterName">
  581. <xsl:value-of select="parameterName"/>
  582. </xsl:element>
  583. <xsl:element name="dataItemName">
  584. <xsl:value-of select="dataItemName"/>
  585. </xsl:element>
  586. </xsl:element>
  587. </xsl:for-each>
  588. </xsl:template>
  589. <xsl:template match="*"/>
  590. </xsl:stylesheet>
  591. </xts:block>
  592. <!--
  593. ===============================================================================================
  594. Build a shell for each agent task - just have to assign the id's at this stage
  595. ===============================================================================================
  596. -->
  597. <xts:block id="createAgentTasks" type="exec" mode="interpret" processor="XSLT" dependency="transformParameters" nodelist="agentTaskDefinitions">
  598. <xts:logicsheet path="ags/logicsheets/agsCmHelper.xsl"/>
  599. <xts:logicsheet path="logicsheets/portal.xsl"/>
  600. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  601. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  602. <xsl:stylesheet version="1.0" xmlns:out="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:agsh="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agsCmHelper/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="agsh pf dt xtsext">
  603. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  604. <pf:serialize-xml/>
  605. <xsl:template match="/">
  606. <xts:sequence>
  607. <xts:append>
  608. <agentTasks>
  609. <!-- loop over all the steps -->
  610. <xsl:for-each select="/root/agentTaskDefinitions/cm:queryResponse/cm:agentTaskDefinition">
  611. <xsl:variable name="objectClass" select="cm:taskObject/*/cm:objectClass"/>
  612. <!-- create the type variable - what type of agent task are we -->
  613. <xsl:variable name="type">
  614. <xsl:choose>
  615. <xsl:when test="$objectClass = 'report' or $objectClass = 'query' or $objectClass = 'reportView' or $objectClass = 'analysis' or $objectClass = 'powerPlay8Report' or $objectClass = 'powerPlay8ReportView' or $objectClass = 'interactiveReport'">
  616. <xsl:text>report</xsl:text>
  617. </xsl:when>
  618. <xsl:when test="$objectClass='jobDefinition'">
  619. <xsl:text>job</xsl:text>
  620. </xsl:when>
  621. <xsl:when test="$objectClass='agentDefinition' or $objectClass='agentDefinitionView'">
  622. <xsl:text>agent</xsl:text>
  623. </xsl:when>
  624. <xsl:when test="$objectClass='memo'">
  625. <xsl:text>message</xsl:text>
  626. </xsl:when>
  627. <xsl:when test="$objectClass='importDeployment'">
  628. <xsl:text>import</xsl:text>
  629. </xsl:when>
  630. <xsl:when test="$objectClass='exportDeployment'">
  631. <xsl:text>export</xsl:text>
  632. </xsl:when>
  633. <xsl:when test="$objectClass = 'contentTask'">
  634. <xsl:text>content</xsl:text>
  635. </xsl:when>
  636. <xsl:when test="$objectClass = 'storedProcedureTask'">
  637. <xsl:text>sql</xsl:text>
  638. </xsl:when>
  639. <xsl:when test="$objectClass = 'webServiceTask'">
  640. <xsl:text>web</xsl:text>
  641. </xsl:when>
  642. <xsl:when test="$objectClass = 'baseRSSTask' or $objectClass = 'urlRSSTask' or $objectClass = 'shortcutRSSTask' or $objectClass = 'shortcutAgentRSSTask'">
  643. <xsl:text>url</xsl:text>
  644. </xsl:when>
  645. <xsl:when test="starts-with($objectClass,'metric')">
  646. <xsl:text>metric</xsl:text>
  647. </xsl:when>
  648. <xsl:when test="$objectClass = 'planningMacroTask'">
  649. <xsl:text>planningMacro</xsl:text>
  650. </xsl:when>
  651. <xsl:when test="$objectClass = 'migrationTask'">
  652. <xsl:text>migration</xsl:text>
  653. </xsl:when>
  654. <xsl:when test="$objectClass = 'indexUpdateTask'">
  655. <xsl:text>index</xsl:text>
  656. </xsl:when>
  657. <xsl:when test="$objectClass = 'humanTask'">
  658. <xsl:value-of select="cm:taskObject/*/cm:operationName"/>
  659. </xsl:when>
  660. </xsl:choose>
  661. </xsl:variable>
  662. <!-- build the task guid for the item -->
  663. <xsl:variable name="task_guid" select="xtsext:generateGUID()"/>
  664. <!-- build the varaibles for each task -->
  665. <item>
  666. <!-- set the attributes for this item -->
  667. <!-- set the id for the item - which is the AgentTaskID -->
  668. <xsl:attribute name="id"><xsl:value-of select="concat('AgentTask-', string($task_guid))"/></xsl:attribute>
  669. <!-- set the taskSearchPath -->
  670. <xsl:attribute name="taskSearchPath"><xsl:value-of select="cm:searchPath"/></xsl:attribute>
  671. <xsl:attribute name="taskDefaultName"><xsl:value-of select="cm:defaultName"/></xsl:attribute>
  672. <!-- set the taskSearchPathStoreID -->
  673. <xsl:attribute name="taskSearchPathStoreID">
  674. <xsl:call-template name="storeIDConverter">
  675. <xsl:with-param name="storeID">
  676. <xsl:value-of select="cm:storeID"/>
  677. </xsl:with-param>
  678. </xsl:call-template>
  679. </xsl:attribute>
  680. <!-- set the taskStoreID -->
  681. <xsl:attribute name="taskStoreID"><xsl:value-of select="cm:storeID"/></xsl:attribute>
  682. <!-- set the targetStoreID -->
  683. <xsl:attribute name="targetStoreID"><xsl:value-of select="./cm:taskObject/*/cm:storeID"/></xsl:attribute>
  684. <!-- calculate the type of the object -->
  685. <xsl:attribute name="type"><xsl:value-of select="$type"/></xsl:attribute>
  686. </item>
  687. </xsl:for-each>
  688. </agentTasks>
  689. </xts:append>
  690. </xts:sequence>
  691. </xsl:template>
  692. <!--include template for converting storeID's into search paths -->
  693. <agsh:storeIDConverter/>
  694. </xsl:stylesheet>
  695. </xts:block>
  696. <!--
  697. ===============================================================================================
  698. expandHumanTaskParameters
  699. have to expand the humanTaskParameters so that we can replace ids in taskLinks with agentTask ids
  700. ===============================================================================================
  701. -->
  702. <xts:block id="expandHumanTaskParameters" type="exec" mode="interpret" processor="XSLT" dependency="createAgentTasks" nodelist="agentTaskDefinitions,agentTasks">
  703. <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:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="cm">
  704. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  705. <xsl:template match="/">
  706. <xts:sequence>
  707. <xsl:for-each select="/root/agentTaskDefinitions/cm:queryResponse/cm:agentTaskDefinition">
  708. <!-- this is the hack - we need the report tab id, assume it is set in the memoPartObject -->
  709. <xsl:variable name="position" select="position()"/>
  710. <xsl:variable name="type" select="/root/agentTasks/item[position()=$position]/@type"/>
  711. <xsl:if test="$type='notification' or $type = 'approval'">
  712. <xts:append select="/root/agentTaskDefinitions/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition'][{$position}]">
  713. <taskOptions>
  714. <xts:transform name="XMLDecode">
  715. <xsl:value-of select="cm:taskObject/*/*[local-name()='parameters']/*[local-name()='parameterValue' and ./*[local-name()='name']='hts']/*[local-name()='simpleParmValueItem']/*[local-name()='use']"/>
  716. </xts:transform>
  717. </taskOptions>
  718. </xts:append>
  719. </xsl:if>
  720. </xsl:for-each>
  721. </xts:sequence>
  722. </xsl:template>
  723. </xsl:stylesheet>
  724. </xts:block>
  725. <!--
  726. ===============================================================================================
  727. doMemoHumanSubObjectsPreProcess (hack)
  728. a block which searches memo options, and where agentReportTask tab ids are found, replaces with the storeID of
  729. the offending agentReportTask. We didn't have this until we saved the agentReportTask.
  730. ===============================================================================================
  731. -->
  732. <xts:block id="doMemoSubObjectsPreProcess" type="exec" mode="interpret" processor="XSLT" dependency="expandHumanTaskParameters" nodelist="agentTaskDefinitions,agentTasks">
  733. <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:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xtsext xtscm">
  734. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  735. <xsl:template match="/">
  736. <xts:sequence>
  737. <xsl:for-each select="/root/agentTaskDefinitions/descendant::*[local-name()='item'][ancestor::*[local-name()='memo']/*[local-name()='options'] and contains(@*[local-name()='type'],'memoPartAgentObject')]">
  738. <!-- this is the hack - we need the report tab id, assume it is set in the memoPartObject -->
  739. <xsl:variable name="position" select="position()"/>
  740. <xsl:variable name="searchPath" select="searchPath"/>
  741. <xsl:variable name="agentTaskID" select="/root/agentTasks/item[@taskSearchPath = $searchPath or @taskDefaultName = $searchPath or @taskSearchPathStoreID = $searchPath]/@id"/>
  742. <!-- if we have a mapping - do the replace -->
  743. <xsl:if test="$agentTaskID">
  744. <xts:replace xmlns:xts="http://developer.cognos.com/schemas/xts/" select="/root/agentTaskDefinitions/descendant::*[local-name()='item'][ancestor::*[local-name()='memo']/*[local-name()='options'] and contains(@*[local-name()='type'],'memoPartAgentObject')][{position()}]/searchPath" mandatory="true">
  745. <searchPath>
  746. <xsl:copy-of select="$searchPath/@*"/>
  747. <xsl:value-of select="$agentTaskID"/>
  748. </searchPath>
  749. </xts:replace>
  750. </xsl:if>
  751. </xsl:for-each>
  752. <!-- pre-process all the human tasks with taskLinks -->
  753. <xsl:for-each select="/root/agentTaskDefinitions/descendant::*[local-name()='taskLink'][ancestor::taskOptions]">
  754. <!-- this is the hack - we need the report tab id, assume it is set in the humanTask input message -->
  755. <xsl:variable name="position" select="position()"/>
  756. <xsl:variable name="id" select="*[local-name()='id']"/>
  757. <xsl:variable name="agentTaskID" select="/root/agentTasks/item[@taskSearchPath = $id or @taskDefaultName = $id or @taskSearchPathStoreID = $id]/@id"/>
  758. <!-- if we have a mapping - do the replace -->
  759. <xsl:if test="$agentTaskID">
  760. <xts:replace xmlns:xts="http://developer.cognos.com/schemas/xts/" select="/root/agentTaskDefinitions/descendant::*[local-name()='taskLink'][ancestor::taskOptions][{position()}]/*[local-name()='id']" mandatory="true">
  761. <impl:id xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1">
  762. <xsl:copy-of select="$id/@*"/>
  763. <xsl:value-of select="$agentTaskID"/>
  764. </impl:id>
  765. </xts:replace>
  766. </xsl:if>
  767. </xsl:for-each>
  768. <!-- pre-process all the human tasks with futureTasks -->
  769. <xsl:for-each select="/root/agentTaskDefinitions/descendant::*[local-name()='futureTask'][ancestor::taskOptions]">
  770. <!-- this is the hack - we need the report tab id, assume it is set in the humanTask input message -->
  771. <xsl:variable name="position" select="position()"/>
  772. <xsl:variable name="id" select="*[local-name()='id']"/>
  773. <xsl:variable name="agentTaskID" select="/root/agentTasks/item[@taskSearchPath = $id or @taskDefaultName = $id or @taskSearchPathStoreID = $id]/@id"/>
  774. <!-- if we have a mapping - do the replace -->
  775. <xsl:if test="$agentTaskID">
  776. <xts:replace xmlns:xts="http://developer.cognos.com/schemas/xts/" select="/root/agentTaskDefinitions/descendant::*[local-name()='futureTask'][ancestor::taskOptions][{position()}]/*[local-name()='id']" mandatory="true">
  777. <impl:id xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1">
  778. <xsl:copy-of select="$id/@*"/>
  779. <xsl:value-of select="$agentTaskID"/>
  780. </impl:id>
  781. </xts:replace>
  782. </xsl:if>
  783. </xsl:for-each>
  784. </xts:sequence>
  785. </xsl:template>
  786. </xsl:stylesheet>
  787. </xts:block>
  788. <!--
  789. ===============================================================================================
  790. Start recreating the agent job steps
  791. ===============================================================================================
  792. -->
  793. <xts:block id="fillAgentTasks" type="exec" mode="interpret" processor="XSLT" dependency="doMemoSubObjectsPreProcess" nodelist="credential,setCookies,header,cookies,agentTasks,agentTaskDefinitions,env,transformedParams">
  794. <xts:logicsheet path="ags/logicsheets/agsCmHelper.xsl"/>
  795. <xts:logicsheet path="logicsheets/portal.xsl"/>
  796. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  797. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  798. <xsl:stylesheet version="1.0" xmlns:out="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:agsh="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agsCmHelper/" exclude-result-prefixes="pf dt xtsext agsh">
  799. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  800. <pf:serialize-xml/>
  801. <pf:variables/>
  802. <xsl:template match="/">
  803. <xts:sequence>
  804. <!-- loop over all the steps -->
  805. <xsl:for-each select="/root/agentTaskDefinitions/cm:queryResponse/cm:agentTaskDefinition">
  806. <xsl:variable name="position" select="position()"/>
  807. <xsl:variable name="objectClass" select="./cm:taskObject/*/cm:objectClass"/>
  808. <xsl:variable name="type" select="/root/agentTasks/item[position()=$position]/@type"/>
  809. <xts:append select="/root/agentTasks/item[{$position}]">
  810. <!-- report/agent/job all have runOptions available -->
  811. <xsl:if test="$type='report' or $type='agent' or $type='job' or $type='metric'">
  812. <!-- build the run options -->
  813. <xts:transform src="transforms/portal/options/generateParams.xslt" processor="XSLT">
  814. <root>
  815. <xsl:copy-of select="./*[local-name()='options']"/>
  816. </root>
  817. </xts:transform>
  818. </xsl:if>
  819. <!-- set the taskName - this is universal now. SubObjects (message/sql/web have the taskName as the default name of the subObject -->
  820. <param name="taskName">
  821. <xsl:choose>
  822. <xsl:when test="$type = 'message' or $type = 'sql' or $type = 'web' or $type='url' or $type='notification' or $type = 'approval'">
  823. <xsl:value-of select="./cm:taskObject/*/cm:defaultName"/>
  824. </xsl:when>
  825. <xsl:otherwise>
  826. <xsl:value-of select="cm:defaultName"/>
  827. </xsl:otherwise>
  828. </xsl:choose>
  829. </param>
  830. <xsl:choose>
  831. <xsl:when test="$type='report'">
  832. <!-- have to know the type of the report - whether or not we're in powerplay land or not -->
  833. <param name="m_class">
  834. <xsl:value-of select="$objectClass"/>
  835. </param>
  836. <param name="selected_path">
  837. <xsl:call-template name="storeIDConverter">
  838. <xsl:with-param name="storeID">
  839. <xsl:value-of select="./cm:taskObject/*/cm:storeID"/>
  840. </xsl:with-param>
  841. </xsl:call-template>
  842. </param>
  843. <!-- when options are available, blob them up and place in a reportOptions parameter-->
  844. <xsl:if test="./*[local-name()='options']">
  845. <!-- build a full report options blob -->
  846. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  847. <param name="reportOptions">
  848. <passport>
  849. <xsl:value-of select="$passport"/>
  850. </passport>
  851. <markup>
  852. <xts:transform name="XMLEncode">
  853. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  854. <root>
  855. <xts:transform src="ags/transforms/getNonOptions.xslt" processor="XSLT">
  856. <extractedOptions>
  857. <xts:transform src="transforms/portal/options/extractEmailOptions.xslt" processor="XSLT">
  858. <root>
  859. <xsl:copy-of select="./*[local-name()='options']"/>
  860. </root>
  861. </xts:transform>
  862. </extractedOptions>
  863. </xts:transform>
  864. </root>
  865. </xts:transform>
  866. </xts:transform>
  867. </markup>
  868. </param>
  869. </xts:transform>
  870. <!-- extract and blob up the delivery options-->
  871. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  872. <param name="deliveryOptions">
  873. <passport>
  874. <xsl:value-of select="$passport"/>
  875. </passport>
  876. <markup>
  877. <xts:transform name="XMLEncode">
  878. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  879. <root>
  880. <xts:transform src="ags/transforms/getEmailOptions.xslt" processor="XSLT">
  881. <extractedOptions>
  882. <xts:transform src="transforms/portal/options/extractEmailOptions.xslt" processor="XSLT">
  883. <root>
  884. <xsl:copy-of select="./*[local-name()='options']"/>
  885. </root>
  886. </xts:transform>
  887. </extractedOptions>
  888. </xts:transform>
  889. </root>
  890. </xts:transform>
  891. </xts:transform>
  892. </markup>
  893. </param>
  894. </xts:transform>
  895. <!-- extract and blob up the mobile options -->
  896. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  897. <param name="mobileOptions">
  898. <passport>
  899. <xsl:value-of select="$passport"/>
  900. </passport>
  901. <markup>
  902. <xts:transform name="XMLEncode">
  903. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  904. <root>
  905. <xts:transform src="ags/transforms/getMobileOptions.xslt" processor="XSLT">
  906. <extractedOptions>
  907. <xts:transform src="transforms/portal/options/extractEmailOptions.xslt" processor="XSLT">
  908. <root>
  909. <xsl:copy-of select="./*[local-name()='options']"/>
  910. </root>
  911. </xts:transform>
  912. </extractedOptions>
  913. </xts:transform>
  914. </root>
  915. </xts:transform>
  916. </xts:transform>
  917. </markup>
  918. </param>
  919. </xts:transform>
  920. </xsl:if>
  921. </xsl:when>
  922. <!-- reports/import/export/content/job/agent all have pointers to the actual task objects -->
  923. <xsl:when test="$type='import' or $type='export' or $type='content' or $type='agent' or $type='job' or $type='metric' or $type='index' or $type='planningMacro' or $type='migration'">
  924. <param name="selected_path">
  925. <xsl:call-template name="storeIDConverter">
  926. <xsl:with-param name="storeID">
  927. <xsl:value-of select="cm:taskObject/*/cm:storeID"/>
  928. </xsl:with-param>
  929. </xsl:call-template>
  930. </param>
  931. <!-- Add the object class for metric, this because it is needed for at least validatePreviewRequest.xts -->
  932. <xsl:if test="$type='metric'">
  933. <param name="objectClass">
  934. <xsl:value-of select="$objectClass"/>
  935. </param>
  936. </xsl:if>
  937. </xsl:when>
  938. <!-- messages have to save the options. The message page itself decodes and uses the options in raw formet -->
  939. <xsl:when test="$type = 'message'">
  940. <!-- we have to create the options parameter -->
  941. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  942. <param name="options">
  943. <passport>
  944. <xsl:value-of select="$passport"/>
  945. </passport>
  946. <markup>
  947. <xts:transform name="XMLEncode">
  948. <xsl:copy-of select="cm:taskObject/*/*[local-name()='options']"/>
  949. </xts:transform>
  950. </markup>
  951. </param>
  952. </xts:transform>
  953. </xsl:when>
  954. <xsl:when test="$type = 'sql'">
  955. <param name="sql_model">
  956. <xsl:value-of select="cm:taskObject/*/*[local-name() = 'metadataModel']//*[local-name() = 'searchPath']"/>
  957. </param>
  958. <param name="sql_package">
  959. <xsl:value-of select="cm:taskObject/*/*[local-name()='metadataModelPackage']//*[local-name()='searchPath']"/>
  960. </param>
  961. <param name="sql_procedure_name">
  962. <xsl:value-of select="cm:taskObject/*/*[local-name() = 'storedProcedureName']/*[local-name() = 'value']"/>
  963. </param>
  964. </xsl:when>
  965. <xsl:when test="$type = 'url'">
  966. <xsl:if test="$objectClass = 'shortcutAgentRSSTask'">
  967. <param name="url_uri">
  968. <xsl:text>url_eventList</xsl:text>
  969. </param>
  970. </xsl:if>
  971. <xsl:if test="$objectClass = 'urlRSSTask'">
  972. <param name="url_url">
  973. <xsl:value-of select="cm:taskObject/*/cm:link"/>
  974. </param>
  975. <param name="url_uri">
  976. <xsl:text>url_url</xsl:text>
  977. </param>
  978. </xsl:if>
  979. <xsl:if test="$objectClass = 'shortcutRSSTask'">
  980. <xsl:variable name="shortcut_search" select="cm:taskObject/*/cm:link//cm:searchPath"/>
  981. <xsl:variable name="agent_search" select="/root/env/param[@name = 'm_path']"/>
  982. <param name="url_entry">
  983. <xsl:choose>
  984. <xsl:when test="$shortcut_search = $agent_search">
  985. <xsl:text>url_eventList</xsl:text>
  986. </xsl:when>
  987. <xsl:otherwise>
  988. <xsl:value-of select="cm:taskObject/*/cm:link//cm:searchPath"/>
  989. </xsl:otherwise>
  990. </xsl:choose>
  991. </param>
  992. <param name="url_uri">
  993. <xsl:text>url_entry</xsl:text>
  994. </param>
  995. </xsl:if>
  996. <param name="url_name">
  997. <xsl:value-of select="cm:taskObject/*/cm:title"/>
  998. </param>
  999. <param name="url_description">
  1000. <xsl:value-of select="cm:taskObject/*/cm:defaultDescription"/>
  1001. </param>
  1002. <param name="url_screentip">
  1003. <xsl:value-of select="cm:taskObject/*/cm:defaultScreenTip"/>
  1004. </param>
  1005. <param name="url_location">
  1006. <xsl:value-of select="cm:taskObject/*/cm:channel//cm:searchPath"/>
  1007. </param>
  1008. </xsl:when>
  1009. <xsl:when test="$type = 'web'">
  1010. <param name="url_wsdl">
  1011. <xsl:value-of select="cm:taskObject/*/*[local-name() = 'uri']"/>
  1012. </param>
  1013. <param name="url_operation">
  1014. <xsl:value-of select="cm:taskObject/*/*[local-name() = 'operationName']"/>
  1015. </param>
  1016. <param name="url_serviceName">
  1017. <xsl:value-of select="cm:taskObject/*/*[local-name() = 'serviceName']"/>
  1018. </param>
  1019. <param name="url_port">
  1020. <xsl:value-of select="cm:taskObject/*/*[local-name() = 'bindingName']"/>
  1021. </param>
  1022. </xsl:when>
  1023. <xsl:when test="$type='notification' or $type = 'approval'">
  1024. <!-- we have to create the options parameter -->
  1025. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  1026. <param name="taskOptions">
  1027. <passport>
  1028. <xsl:value-of select="$passport"/>
  1029. </passport>
  1030. <markup>
  1031. <xts:transform name="XMLEncode">
  1032. <taskOptions>
  1033. <xsl:copy-of select="taskOptions/*"/>
  1034. </taskOptions>
  1035. </xts:transform>
  1036. </markup>
  1037. </param>
  1038. </xts:transform>
  1039. </xsl:when>
  1040. </xsl:choose>
  1041. <!-- parameters can be on any agentDefinitionTask - only ones of relevance are report/agent/sql/web -->
  1042. <xsl:if test="$type = 'report' or $type = 'agent' or $type = 'web' or $type = 'sql' ">
  1043. <xsl:if test="/root/transformedParams/parameterData[position()=$position]">
  1044. <xsl:variable name="taskParam">
  1045. <xsl:if test="/root/transformedParams/parameterData[position()=$position]">
  1046. <xsl:call-template name="serialize-xml">
  1047. <xsl:with-param name="node-set">
  1048. <xsl:copy-of select="/root/transformedParams/parameterData[position()=$position]"/>
  1049. </xsl:with-param>
  1050. </xsl:call-template>
  1051. </xsl:if>
  1052. </xsl:variable>
  1053. <param name="taskParameters">
  1054. <xsl:value-of select="xtsext:web64encode( string( $taskParam), true())"/>
  1055. </param>
  1056. </xsl:if>
  1057. </xsl:if>
  1058. </xts:append>
  1059. </xsl:for-each>
  1060. </xts:sequence>
  1061. </xsl:template>
  1062. <!--include template for converting storeID's into search paths -->
  1063. <agsh:storeIDConverter/>
  1064. </xsl:stylesheet>
  1065. </xts:block>
  1066. <!--
  1067. ===============================================================================================
  1068. Create the option blobs for each content maintenance task. When a content task is visited a cmOptions blob is automatically created.
  1069. This parameter is then used when the agent is saved. A potential problems occurs when an agent is loaded and immediately saved without
  1070. visiting any content maintenance tasks. When loading an agent we need to pre-build each cmOptions parameter.
  1071. And Index Task as well use the same param
  1072. we need TODO: make common variable for each task
  1073. ===============================================================================================
  1074. -->
  1075. <xts:block id="createContentTaskOptionParams" type="exec" mode="interpret" processor="XSLT" dependency="fillAgentTasks" condition=".[(/root/agentTasks/item[@type='content']) or (/root/agentTasks/item[@type='index']) ]" mandatory="false" nodelist="agentTasks,agentTaskDefinitions,credential,setCookies,header,cookies">
  1076. <xts:logicsheet path="logicsheets/portal.xsl"/>
  1077. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  1078. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  1079. <xsl:stylesheet version="1.0"
  1080. xmlns:out="http://www.w3.org/1999/XSL/Transform"
  1081. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  1082. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  1083. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  1084. xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/"
  1085. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  1086. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  1087. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  1088. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  1089. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  1090. exclude-result-prefixes="xsl pf cm dt xts xtsext xsd xsi bus">
  1091. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  1092. <pf:serialize-xml/>
  1093. <pf:variables/>
  1094. <xsl:template match="/">
  1095. <xsl:for-each select="/root/agentTasks/item[@type='content' or @type='index']">
  1096. <!-- create the position variable - which is used to get into each agent item block -->
  1097. <xsl:variable name="position" select="position()"/>
  1098. <xsl:variable name="id" select="./@taskStoreID"/>
  1099. <xsl:variable name="options" select="/root/*[local-name()='agentTaskDefinitions']/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition'][cm:storeID=$id]/*[local-name()='options']"/>
  1100. <!-- when options are available, blob them up and place in a cmOptions parameter-->
  1101. <xsl:if test="$options!=''">
  1102. <xsl:variable name="nodes">
  1103. <cmOptions>
  1104. <xsl:copy-of select="$options"/>
  1105. </cmOptions>
  1106. </xsl:variable>
  1107. <xsl:variable name="markup">
  1108. <xts:transform name="XMLEncode">
  1109. <xsl:call-template name="serialize-xml">
  1110. <xsl:with-param name="node-set" select="$nodes"/>
  1111. </xsl:call-template>
  1112. </xts:transform>
  1113. </xsl:variable>
  1114. <xts:sequence>
  1115. <xts:append select="/root/agentTasks/item[@taskStoreID='{$id}']">
  1116. <param name="cmOptions">
  1117. <xsl:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport, '_settemplatename_createcontenttaskoptionparams_settemplateid_loadagent001'), xtsext:web64encode(string($markup ),true()))"/>
  1118. </param>
  1119. </xts:append>
  1120. </xts:sequence>
  1121. </xsl:if>
  1122. </xsl:for-each>
  1123. </xsl:template>
  1124. </xsl:stylesheet>
  1125. </xts:block>
  1126. <!--
  1127. ===============================================================================================
  1128. Build the agent definition
  1129. ===============================================================================================
  1130. -->
  1131. <xts:block id="buildAgentDefinition" type="exec" mode="interpret" processor="XSLT" dependency="createContentTaskOptionParams" nodelist="agentDefinition,agentDefinitionReport,agentTaskDefinitions,agentTasks,agentSchedule,agentDefinitionCondition,deleteTasks,agentNotificationList">
  1132. <xts:logicsheet path="ags/logicsheets/agsCmHelper.xsl"/>
  1133. <xts:logicsheet path="logicsheets/portal.xsl"/>
  1134. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  1135. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  1136. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  1137. xmlns:agsh="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agsCmHelper/"
  1138. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  1139. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  1140. xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/"
  1141. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  1142. exclude-result-prefixes="agsh pf cm dt xtsext">
  1143. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  1144. <pf:serialize-xml/>
  1145. <xsl:template match="/">
  1146. <xsl:variable name="agentOptions" select="/root/agentDefinition/*[local-name() ='queryResponse']/*[local-name() = 'agentDefinition']/*[local-name() = 'options']"/>
  1147. <xsl:variable name="agentParameters" select="/root/agentDefinitionReport/cm:queryResponse/*[local-name()='report']/*[local-name()='parameters']"/>
  1148. <!-- build the agent_definition -->
  1149. <!-- have the agent options been overridden?-->
  1150. <xsl:variable name="agentDefaultOverrideState">
  1151. <xsl:for-each select="$agentOptions/*[local-name()='value']/*[local-name()='item']/*[local-name()='name']">
  1152. <xsl:variable name="value" select="../*[local-name()='value']"/>
  1153. <xsl:choose>
  1154. <xsl:when test="(.='saveOutput' and $value = 'true') or (.='prompt' and $value= 'false') or (@name='saveAsName' )">
  1155. <xsl:text>d</xsl:text>
  1156. </xsl:when>
  1157. <xsl:when test=".!='checkSecurityReferences' and .!='repairSecurityReferences' and .!='data'">
  1158. <xsl:text>o</xsl:text>
  1159. </xsl:when>
  1160. </xsl:choose>
  1161. </xsl:for-each>
  1162. </xsl:variable>
  1163. <xsl:variable name="agentContentMaintenanceOverride">
  1164. <xsl:choose>
  1165. <xsl:when test="$agentOptions/*[local-name()='value']/*[local-name()='item'][name='checkSecurityReferences']/*[local-name()='value']='true' or $agentOptions/*[local-name()='value']/*[local-name()='item'][name='repairSecurityReferences']/*[local-name()='value']='true'">
  1166. <xsl:text>true</xsl:text>
  1167. </xsl:when>
  1168. <xsl:otherwise>false</xsl:otherwise>
  1169. </xsl:choose>
  1170. </xsl:variable>
  1171. <xts:sequence>
  1172. <xts:append>
  1173. <agent_definition>
  1174. <!--copy the agent options -->
  1175. <xsl:if test="$agentOptions">
  1176. <agentOptions>
  1177. <!-- create the form variables-->
  1178. <form-vars>
  1179. <param name="override_default_options"><xsl:value-of select="contains($agentDefaultOverrideState,'o')"/></param>
  1180. <xsl:if test="$agentContentMaintenanceOverride='true'">
  1181. <param name="override_default_content_task_options">true</param>
  1182. </xsl:if>
  1183. <param name="report_options_collapsed">true</param>
  1184. <param name="content_task_options_collapsed">true</param>
  1185. <param name="deployment_options_collapsed">true</param>
  1186. <param name="index_update_task_options_collapsed">true</param>
  1187. </form-vars>
  1188. <xsl:copy-of select="$agentOptions"/>
  1189. </agentOptions>
  1190. </xsl:if>
  1191. <!--copy the agent options -->
  1192. <xsl:if test="$agentParameters">
  1193. <agentParameters>
  1194. <xsl:copy-of select="$agentParameters"/>
  1195. </agentParameters>
  1196. </xsl:if>
  1197. <!-- have to save all the paths into the agent_definition now -->
  1198. <xsl:if test="/root/agentDefinition/cm:queryResponse/cm:agentDefinition/cm:storeID">
  1199. <agentDefinition>
  1200. <xsl:call-template name="storeIDConverter">
  1201. <xsl:with-param name="storeID">
  1202. <xsl:value-of select="/root/agentDefinition/cm:queryResponse/cm:agentDefinition/cm:storeID"/>
  1203. </xsl:with-param>
  1204. </xsl:call-template>
  1205. </agentDefinition>
  1206. </xsl:if>
  1207. <xsl:if test="/root/agentSchedule/cm:queryResponse/cm:schedule/cm:storeID">
  1208. <agentSchedule>
  1209. <xsl:call-template name="storeIDConverter">
  1210. <xsl:with-param name="storeID">
  1211. <xsl:value-of select="/root/agentSchedule/cm:queryResponse/cm:schedule/cm:storeID"/>
  1212. </xsl:with-param>
  1213. </xsl:call-template>
  1214. </agentSchedule>
  1215. </xsl:if>
  1216. <xsl:if test="/root/agentDefinitionReport/cm:queryResponse/cm:report/cm:storeID">
  1217. <agentDefinitionReport>
  1218. <xsl:call-template name="storeIDConverter">
  1219. <xsl:with-param name="storeID">
  1220. <xsl:value-of select="/root/agentDefinitionReport/cm:queryResponse/cm:report/cm:storeID"/>
  1221. </xsl:with-param>
  1222. </xsl:call-template>
  1223. </agentDefinitionReport>
  1224. </xsl:if>
  1225. <!-- put in the summary values too -->
  1226. <summaryEventKey>
  1227. <xsl:for-each select="/root/agentDefinition/cm:queryResponse/cm:agentDefinition/cm:eventKey/cm:string">
  1228. <xsl:value-of select="."/>
  1229. <xsl:text>;</xsl:text>
  1230. </xsl:for-each>
  1231. </summaryEventKey>
  1232. <!-- define the agent condition summary -->
  1233. <condition>
  1234. <xsl:value-of select="/root/agentDefinitionCondition/summary"/>
  1235. </condition>
  1236. <!-- define the schedule summary -->
  1237. <schedule>
  1238. <!-- we can build the summary schedule in the dialog adaptor -->
  1239. </schedule>
  1240. <!-- create the spacer for the deleted items -->
  1241. <deletedItems>
  1242. <xsl:for-each select="/root/*[local-name()='deleteTasks']/*[local-name() ='storeID']">
  1243. <item>
  1244. <taskStoreID>
  1245. <xsl:call-template name="storeIDConverter">
  1246. <xsl:with-param name="storeID">
  1247. <xsl:value-of select="."/>
  1248. </xsl:with-param>
  1249. </xsl:call-template>
  1250. </taskStoreID>
  1251. </item>
  1252. </xsl:for-each>
  1253. </deletedItems>
  1254. <!-- define the sequencing -->
  1255. <sequencing>
  1256. <xsl:value-of select="/root/agentDefinition/cm:queryResponse/cm:agentDefinition/cm:sequencing"/>
  1257. </sequencing>
  1258. <!-- Make notifications from agentNotificationList block -->
  1259. <notificationList>
  1260. <xsl:for-each select="/root/agentNotificationList/*[local-name() ='getNotificationListResponse']/result/notificationList//*[local-name() ='storeID']/value">
  1261. <item>
  1262. <xsl:call-template name="storeIDConverter">
  1263. <xsl:with-param name="storeID">
  1264. <xsl:value-of select="."/>
  1265. </xsl:with-param>
  1266. </xsl:call-template>
  1267. </item>
  1268. </xsl:for-each>
  1269. </notificationList>
  1270. <allowNotification>
  1271. <xsl:value-of select="/root/agentDefinition/cm:queryResponse/cm:agentDefinition/cm:allowNotification"/>
  1272. </allowNotification>
  1273. <xsl:if test="/root/agentTaskDefinitions/cm:queryResponse/cm:agentTaskDefinition [./cm:eventTypes/cm:eventTypeEnum != '' or ./cm:runCondition = 'runOnFailure'] ">
  1274. <suppressionSet>true</suppressionSet>
  1275. </xsl:if>
  1276. <items>
  1277. <xsl:for-each select="/root/agentTasks/item">
  1278. <!-- create the position variable - this is used to reference other items - which are in the same sequence -->
  1279. <xsl:variable name="position" select="position()"/>
  1280. <xsl:variable name="runCondition">
  1281. <xsl:choose>
  1282. <xsl:when test="/root/agentTaskDefinitions/cm:queryResponse/cm:agentTaskDefinition[position()=$position]/cm:runCondition != '' ">
  1283. <xsl:value-of select="/root/agentTaskDefinitions/cm:queryResponse/cm:agentTaskDefinition[position()=$position]/cm:runCondition"/>
  1284. </xsl:when>
  1285. <xsl:otherwise>runOnSuccess</xsl:otherwise>
  1286. </xsl:choose>
  1287. </xsl:variable>
  1288. <!-- build the item structure -->
  1289. <item>
  1290. <id>
  1291. <xsl:value-of select="./@id"/>
  1292. </id>
  1293. <type>
  1294. <xsl:value-of select="./@type"/>
  1295. </type>
  1296. <name>
  1297. <xsl:value-of select="./param[@name='taskName']"/>
  1298. </name>
  1299. <taskStoreID>
  1300. <xsl:call-template name="storeIDConverter">
  1301. <xsl:with-param name="storeID">
  1302. <xsl:value-of select="./@taskStoreID"/>
  1303. </xsl:with-param>
  1304. </xsl:call-template>
  1305. </taskStoreID>
  1306. <targetStoreID>
  1307. <xsl:call-template name="storeIDConverter">
  1308. <xsl:with-param name="storeID">
  1309. <xsl:value-of select="./@targetStoreID"/>
  1310. </xsl:with-param>
  1311. </xsl:call-template>
  1312. </targetStoreID>
  1313. <!-- sort out the suppression -->
  1314. <suppression>
  1315. <!-- have to decode the filters as well -->
  1316. <xsl:for-each select="/root/agentTaskDefinitions/cm:queryResponse/cm:agentTaskDefinition[position()=$position]/cm:eventTypes/cm:eventTypeEnum">
  1317. <param name="{concat('Filter_',.)}">
  1318. <xsl:value-of select="."/>
  1319. </param>
  1320. </xsl:for-each>
  1321. <param name="Action_topic_filter">
  1322. <xsl:for-each select="/root/agentTaskDefinitions/cm:queryResponse/cm:agentTaskDefinition[position()=$position]/cm:eventKey/cm:string">
  1323. <xsl:value-of select="concat(text(), ';')"/>
  1324. </xsl:for-each>
  1325. </param>
  1326. </suppression>
  1327. <!-- if msg has attachment -->
  1328. <xsl:if test="./@type='message' and /root/*[local-name()='agentTaskDefinitions']/*[local-name()='queryResponse']/*[local-name()='agentTaskDefinition' and position()=$position]/*[local-name()='taskObject']/*[local-name()='memo']/*[local-name()='options']//*[local-name()='item'][attribute::*[local-name()='type']='bus:objectLink' or attribute::*[local-name()='type']='bus:memoPartAgentObject'] ">
  1329. <addInfo>hasAttachment</addInfo>
  1330. </xsl:if>
  1331. <!-- if report has prompt -->
  1332. <xsl:if test="./@type='report' and count(/root/agentTaskDefinitions/*[local-name() ='queryResponse']/*[local-name() ='agentTaskDefinition'][position()=$position]/*[local-name() ='parameterAssignments']/*[local-name()='parameterAssignmentDataItem'])>0">
  1333. <addInfo>hasPrompts</addInfo>
  1334. </xsl:if>
  1335. <taskLevelFilter><xsl:value-of select="/root/agentTaskDefinitions/cm:queryResponse/cm:agentTaskDefinition[position()=$position]/cm:filterDataItemName"/></taskLevelFilter>
  1336. <runCondition><xsl:value-of select="$runCondition"/></runCondition>
  1337. </item>
  1338. </xsl:for-each>
  1339. </items>
  1340. </agent_definition>
  1341. </xts:append>
  1342. </xts:sequence>
  1343. </xsl:template>
  1344. <!--include template for converting storeID's into search paths -->
  1345. <agsh:storeIDConverter/>
  1346. </xsl:stylesheet>
  1347. </xts:block>
  1348. <!--
  1349. ===============================================================================================
  1350. Build the agent parameters
  1351. ===============================================================================================
  1352. -->
  1353. <xts:block id="buildAgentParams" type="exec" mode="interpret" processor="XSLT" dependency="buildAgentDefinition" nodelist="credential,setCookies,header,cookies,agent_definition,agentTasks,agentDefinitionCondition">
  1354. <xts:logicsheet path="logicsheets/portal.xsl"/>
  1355. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  1356. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  1357. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:rep="http://developer.cognos.com/schemas/report/14.0/" xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  1358. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  1359. <pf:serialize-xml/>
  1360. <pf:variables/>
  1361. <xsl:template match="/">
  1362. <!-- delete the agent_definition blob that is pre-build in add_condition -->
  1363. <xts:sequence>
  1364. <!-- blob up the agent definition and blob up the recreated parameters and put them into the env -->
  1365. <xts:append select="/root/env">
  1366. <!-- build the params for the agent_actions -->
  1367. <xsl:for-each select="/root/agent_definition/items/item">
  1368. <xsl:variable name="position" select="position()"/>
  1369. <xsl:variable name="markup">
  1370. <xsl:apply-templates select="/root/agentTasks/item[position() = $position]/*" mode="markup"/>
  1371. </xsl:variable>
  1372. <param name="{./id}">
  1373. <xsl:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport, '_settemplatename_buildagentparams_settemplateid_loadagent002'), xtsext:web64encode( string( $markup ), true()))"/>
  1374. </param>
  1375. </xsl:for-each>
  1376. <!-- we need a summary condition -->
  1377. <param name="AgentTask-condition">
  1378. <xsl:value-of select="/root/agentDefinitionCondition/expressionBlob"/>
  1379. </param>
  1380. <!-- we also need the nav controls from the summary bar -->
  1381. <param name="prevTabID"/>
  1382. <param name="tabSelectedID"/>
  1383. <!-- this is lash tastic - but what the hell -->
  1384. <param name="agentItemOp"/>
  1385. </xts:append>
  1386. </xts:sequence>
  1387. </xsl:template>
  1388. </xsl:stylesheet>
  1389. </xts:block>
  1390. <!--
  1391. ===============================================================================================
  1392. Build the schedule
  1393. ===============================================================================================
  1394. -->
  1395. <xts:block id="buildScheduleParams" type="exec" mode="interpret" processor="XSLT" dependency="buildAgentParams" mandatory="false" condition=".[/root/agentSchedule/*[local-name()='queryResponse']/*[local-name()='queryResult']/*[local-name()='item']]" nodelist="system,env,session,user,actions,tabs,configProps,http,credential,cookies,setCookies,header,agent_definition,morphletResponse,agentSchedule">
  1396. <xts:logicsheet path="portal/iFrmCmd/logicsheets/cm-save.xsl"/>
  1397. <xts:logicsheet path="logicsheets/portal.xsl"/>
  1398. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  1399. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  1400. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  1401. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  1402. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  1403. xmlns:req-params="http://developer.cognos.com/schemas/request/params"
  1404. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  1405. exclude-result-prefixes="xsl cm bus xtsext pf req-params">
  1406. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  1407. <pf:variables/>
  1408. <pf:serialize-xml/>
  1409. <xsl:template match="/">
  1410. <!-- the setSchedule page expects the scheduleParameters to live in /root/env/param which are then taken
  1411. and copied into req:params:param prior to the morphlet call, see ags/navigator.xslt -->
  1412. <xts:sequence>
  1413. <!-- remove the last version -->
  1414. <xts:delete select="/root/env/param[@name='scheduleParameters']"/>
  1415. <!-- update the summary schedule -->
  1416. <xts:replace select="/root/agent_definition/schedule">
  1417. <schedule>
  1418. <xsl:value-of select="/root/morphletResponse/scheduleParameters/param[@name='Summary_schedule']"/>
  1419. </schedule>
  1420. </xts:replace>
  1421. <!-- delete searchPath from the schedule info so that it can be updated -->
  1422. <xts:delete select="/root/agentSchedule/*[local-name()='queryResponse']/*[local-name()='queryResult']/*[local-name()='item']/searchPath"/>
  1423. <!-- create the encoded result -->
  1424. <xts:append select="/root/env">
  1425. <!-- create the encoded response parameter -->
  1426. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  1427. <!-- we can go direct to AgentTask-schedule -->
  1428. <param name="AgentTask-schedule">
  1429. <passport>
  1430. <xsl:value-of select="$passport"/>
  1431. </passport>
  1432. <markup>
  1433. <xts:transform name="XMLEncode">
  1434. <scheduleParameters>
  1435. <xts:queryNode select="/root/agentSchedule/*[local-name()='queryResponse']/*[local-name()='queryResult']/*[local-name()='item']"/>
  1436. <!--xsl:copy-of select="/root/agentSchedule/*[local-name()='queryResponse']/*[local-name()='queryResult']/*[local-name()='item']"/-->
  1437. </scheduleParameters>
  1438. </xts:transform>
  1439. </markup>
  1440. </param>
  1441. </xts:transform>
  1442. </xts:append>
  1443. </xts:sequence>
  1444. </xsl:template>
  1445. </xsl:stylesheet>
  1446. </xts:block>
  1447. <!--
  1448. ================================================================================
  1449. set up the data for the agent item deletion listener
  1450. ================================================================================
  1451. -->
  1452. <xts:block id="setupAgentItemDeleteListener" dependency="buildScheduleParams" path="/ags/modelItemFields.xsl" processor="XSLT" type="exec" nodelist="agentDefinitionCondition,agent_definition,agentTasks,agentTaskDefinitions,transformedParams"/>
  1453. <!--
  1454. ================================================================================
  1455. encode the agent items again
  1456. ================================================================================
  1457. -->
  1458. <xts:block id="encode_agent_definition" dependency="setupAgentItemDeleteListener" processor="XSLT" type="exec" nodelist="agent_definition,credential,setCookies,header,cookies">
  1459. <xts:logicsheet path="logicsheets/portal.xsl"/>
  1460. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  1461. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  1462. <pf:serialize-xml/>
  1463. <pf:variables/>
  1464. <xsl:template match="/">
  1465. <xts:sequence>
  1466. <xsl:variable name="markup">
  1467. <xsl:call-template name="serialize-xml">
  1468. <xsl:with-param name="node-set" select="/root/agent_definition"/>
  1469. </xsl:call-template>
  1470. </xsl:variable>
  1471. <xts:append select="/root/env">
  1472. <param name="agent_definition_blob">
  1473. <xsl:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport, '_settemplatename_encodeagentdefinition_settemplateid_loadagent002'), xtsext:web64encode( string( $markup ), true()))"/>
  1474. </param>
  1475. </xts:append>
  1476. </xts:sequence>
  1477. </xsl:template>
  1478. </xsl:stylesheet>
  1479. </xts:block>
  1480. <!--
  1481. ===============================================================================================
  1482. Render the HTML page
  1483. ===============================================================================================
  1484. -->
  1485. <xts:block id="renderPage" mode="output" processor="XSLT" type="exec" mimeType="text/html" dependency="encode_agent_definition" nodelist="system,env,session,user,actions,tabs,configProps,http,credential,cookies,setCookies,cmContent,agentDefinitionReport,modelItemFields,agentDefinition,agentTaskDefinitions,agentSchedule,agent_definition">
  1486. <!-- portal specific information -->
  1487. <xts:logicsheet path="logicsheets/portal.xsl"/>
  1488. <!-- Get the new theme logicsheets. -->
  1489. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  1490. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  1491. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  1492. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  1493. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  1494. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  1495. <xts:logicsheet path="logicsheets/presentation/main/presentation.xsl"/>
  1496. <!-- apply the form logic -->
  1497. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  1498. <!-- Prevent the href from appearing in the status bar. -->
  1499. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  1500. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" xmlns:mt="http://developer.cognos.com/schemas/xts/logicsheets/presentation/main/mt" xmlns:mf="http://developer.cognos.com/schemas/xts/logicsheets/presentation/main/mf" xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/" xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:rep="http://developer.cognos.com/schemas/report/14.0/" xmlns:x="x" xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/" exclude-result-prefixes="x xsl mt mf lyt cf cp pf df dp cm utml xtsext dt rep">
  1501. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  1502. <!-- current file name -->
  1503. <xsl:variable name="mname" select="'load_agent.xts'"/>
  1504. <!-- add any theme variables -->
  1505. <pf:variables/>
  1506. <!-- These elements will insert the templates needed to generate the displayable object type and icons. -->
  1507. <pf:gen-icon/>
  1508. <pf:serialize-xml/>
  1509. <xsl:template match="/">
  1510. <xsl:variable name="browserTitle">
  1511. <!-- <xts:string id="DIALOG_MESSAGE_RECIPIENT_LABEL">
  1512. <xts:param name="objectName"><xsl:value-of select="$object-name"/></xts:param>
  1513. </xts:string> -->
  1514. </xsl:variable>
  1515. <xsl:variable name="markup">
  1516. <xsl:call-template name="serialize-xml">
  1517. <xsl:with-param name="node-set" select="/root/agentDefinitionReport/cm:queryResponse/cm:report/cm:specification/*[local-name()='report']"/>
  1518. </xsl:call-template>
  1519. </xsl:variable>
  1520. <dp:page longTitle="$browserTitle">
  1521. <!-- specify the style sheet(used to render the active/inactive hint text)
  1522. todo move this into its own xslt file. Do not put it into the dp stuff because that is relevant to the whole portal
  1523. -->
  1524. <utml:form name="pform" method="post" action="{$gateway}">
  1525. <input type="hidden" name="prevTabID" id="prevTabID" value="AgentTask-condition"/>
  1526. </utml:form>
  1527. <dp:script>
  1528. <script type="text/javascript">
  1529. function init()
  1530. {
  1531. //these are commands we must execute in sequence
  1532. var commands = new Array();
  1533. // let user know we are busy
  1534. if(parent.cfgGet('agsInit')!=true){
  1535. commands.push("parent.doWait('open');");
  1536. parent.cfgSet('loadwait', true);
  1537. }
  1538. var cf= (this.getConfigFrame?this.getConfigFrame():(parent.getConfigFrame?parent.getConfigFrame():null));
  1539. if (cf==null||!cf.cfgGet||!cf.cfgGet("AGS_initialized")) {
  1540. setTimeout(this.init,250);
  1541. }
  1542. else {
  1543. <xsl:if test="/root/env/param[@name='m_path']">
  1544. cf.cfgSet("so.defaultLocation", "<xsl:value-of select="xtsext:javascriptencode(/root/env/param[@name='m_path'])"/>/..");
  1545. </xsl:if>
  1546. // clear out the script vars if they're there
  1547. cf.clearAgentScript();
  1548. // we've some more things to do here
  1549. <xsl:for-each select="/root/agentDefinitionReport/cm:queryResponse/cm:report/cm:specification/*[local-name()='report']/*[local-name()='queries']/*[local-name()='query'][@name='Query1']/*[local-name()='selection']/*[local-name()='dataItem']">
  1550. <!-- we have two attributes on each data item - a name and a label. To guarantee we get the correct values in the output we use the label -->
  1551. <xsl:variable name="name" select="@label"/>
  1552. <xsl:variable name="aggregate" select="@aggregate"/>
  1553. <xsl:variable name="displayNodeName" select="local-name(/root/agentDefinitionReport/cm:queryResponse/*[local-name()='report']/*[local-name()='specification']//*[local-name()='report']//*[local-name()='list'][@refQuery='Query1']//*[local-name()='listColumnBody']/*[local-name()='contents']//*[local-name()='dataItemValue'][@refDataItem=$name]/../..)"/>
  1554. <xsl:variable name="expression" select="xtsext:javascriptencode(string(./*[local-name()='expression']))"/>
  1555. <xsl:variable name="displayType">
  1556. <xsl:choose>
  1557. <xsl:when test="$displayNodeName='textItem'"><xsl:text>Value</xsl:text></xsl:when>
  1558. <xsl:when test="$displayNodeName='image'"><xsl:text>Picture</xsl:text></xsl:when>
  1559. <xsl:when test="$displayNodeName='hyperlink'"><xsl:text>Link</xsl:text></xsl:when>
  1560. <xsl:otherwise><xsl:text>Value</xsl:text></xsl:otherwise>
  1561. </xsl:choose>
  1562. </xsl:variable>
  1563. var expression = "<xsl:value-of select="$expression"/>";
  1564. // build it
  1565. cf.generateAgentItem("<xsl:value-of select="xtsext:javascriptencode(string($name))"/>",expression,&quot;<xsl:value-of select="$aggregate"/>&quot;,&quot;<xsl:value-of select="$displayType"/>&quot;);
  1566. </xsl:for-each>
  1567. //generate data to initialise the model item deletion listener
  1568. var fieldName;
  1569. var id;
  1570. var initialValue ;
  1571. var groupFields;
  1572. var groupField;
  1573. <xsl:apply-templates select="/root/modelItemFields"/>
  1574. // set the path to the folder that the agent lies in
  1575. <xsl:text/>if (cf.cfgSet) cf.cfgSet("ReportFolder","<xsl:value-of select="xtsext:javascriptencode(string(/root/agentDefinition/cm:queryResponse/cm:agentDefinition/cm:ancestors/cm:ancestorInfo[last()]/cm:searchPath))"/>");<xsl:text/>
  1576. // have to redefine m_path as well
  1577. document.pform.m_path.value = "<xsl:value-of select="xtsext:javascriptencode(string(/root/agentDefinition/cm:queryResponse/cm:agentDefinition/cm:ancestors/cm:ancestorInfo[last()]/cm:searchPath))"/>";
  1578. //nasty parsing the report expression.... should really call get parameters?
  1579. var filter = "<xsl:value-of select="xtsext:javascriptencode(string(/root/agentDefinitionReport/cm:queryResponse/cm:report/cm:specification/*[local-name()='report']/*[local-name()='queries']/*[local-name()='query'][@name='Query1']/*[local-name()='detailFilters']/*[local-name()='detailFilter']/*[local-name()='filterExpression']))"/>";
  1580. var param_matcher = /\?[^\?]+\?/g;
  1581. var params = filter.match(param_matcher);
  1582. if(params){
  1583. for(var i = 0; i &lt; params.length; i++){
  1584. var param = params[i].substring(1, params[i].length -1);
  1585. cf.addParameter(cf.createParameterObj(param, false, false));
  1586. }
  1587. }
  1588. // update the window title
  1589. <xsl:if test="/root/agentDefinition/cm:queryResponse/cm:agentDefinition/cm:defaultName !=''">
  1590. <xsl:text/>
  1591. if (cf.cfgSet) cf.cfgSet("ReportName", "<xsl:value-of select="xtsext:javascriptencode(string(/root/agentDefinition/cm:queryResponse/cm:agentDefinition/cm:defaultName))"/>");
  1592. <xsl:text/>
  1593. </xsl:if>
  1594. // we aren't dealing with a new report now
  1595. cf.cfgSet("NewReport", false);
  1596. var reportSpec="<xsl:value-of select="xtsext:javascriptencode(string($markup))"/>";
  1597. var d = cf.parseXMLString( reportSpec );
  1598. if (d != null ) {
  1599. cf.updateExtraQueries(d);
  1600. cf.updatePromptPages(d);
  1601. }
  1602. // hmmm
  1603. cf.agentHasChanged(false);
  1604. //need to track this for prompting to save
  1605. cf.cfgSet("saved_agent_condition", cf.buildFilterCondition());
  1606. // do the name of agent
  1607. cf.setWindowTitle();
  1608. // we're dropping into the condition tab
  1609. document.pform.prevTabID.value='AgentTask-condition';
  1610. document.pform.tabSelectedID.value='AgentTask-condition';
  1611. <xsl:if test="/root/agent_definition/deletedItems/item">
  1612. window.alert("<xts:string id="DIALOG_MESSAGE_TASK_DELETED" encode="javascript"/>");
  1613. </xsl:if>
  1614. // This checks to see if the loaded agent has the schedule enabled or disabled, to change the
  1615. // icon for schedule the agent task in UI otherwise leaves it as default.
  1616. <xsl:if test="/root/agentSchedule/bus:queryResponse/queryResult/item/active/value">
  1617. parent.toggleScheduleState("<xsl:value-of select="/root/agentSchedule/bus:queryResponse/queryResult/item/active/value"/>", false);
  1618. </xsl:if>
  1619. //load the dialog frame as part of a stack so that the validation doesnt happen till the frame has loaded
  1620. //this is to avoid clashes with http connections used by xhttpDispatcher and direct form submission
  1621. var dAdaptLoader = new cf.CommandStackObject();
  1622. //add the execute method
  1623. dAdaptLoader.execute = function(){
  1624. // do this another way - by submitting the form - so maintaining the session
  1625. document.pform.ps_nav_op.value = 'maintain';
  1626. document.pform.m.value = 'ags/dialogAdapter.xts';
  1627. document.pform.submit();
  1628. }
  1629. var currentStack = cf.getCommandStackManager().getCommandStack();
  1630. if(!currentStack){
  1631. currentStack = new cf.CommandStack(new Array());
  1632. }
  1633. currentStack.push("cf.validateAgentCondition('errorCondition');");
  1634. currentStack.push("doWait('validate')");
  1635. //during the user interactive validate, we try to push on through errors
  1636. var cancelCmdObject = cf.createCommandStackObject("setTimeout('getCommandStackManager().processCommandStack()', 100)", "getCommandStackManager().getCommandStack().setCancelCommand");
  1637. currentStack.push(cancelCmdObject);
  1638. currentStack.push("cf.getReportSpec();");
  1639. //create a cmd to check if the agents model has been upgraded
  1640. //so we can warn the user.... not much they can do about it though
  1641. currentStack.push("doPackageUpdatedCheck()");
  1642. currentStack.push(dAdaptLoader);
  1643. if(commands &amp;&amp; commands.length > 0){
  1644. for(var i = commands.length - 1; i >= 0; i--){
  1645. currentStack.push(commands[i]);
  1646. }
  1647. }
  1648. cf.getCommandStackManager().doCommandStack(currentStack);
  1649. }
  1650. }
  1651. </script>
  1652. </dp:script>
  1653. </dp:page>
  1654. </xsl:template>
  1655. <!--process single dropzones -->
  1656. <xsl:template match="modelItemField">
  1657. <!--vars declared outside this -->
  1658. fieldName = '<xsl:value-of select="xtsext:javascriptencode(string(./name))"/>';
  1659. id = '<xsl:value-of select="xtsext:javascriptencode(string(@id))"/>';
  1660. initialValue = '<xsl:value-of select="xtsext:javascriptencode(string(./value))"/>';
  1661. //this will check the tree for topics and add them to the field contents held in the deletion listener
  1662. parent.getAgentItemsListener().addField(new parent.FieldContent(fieldName, id, initialValue));
  1663. </xsl:template>
  1664. <!--process groups of drop zones -->
  1665. <xsl:template match="modelItemFieldGroup">
  1666. groupFields = new Array();
  1667. <xsl:for-each select="./modelItemField">
  1668. <!--vars declared outside this -->
  1669. fieldName = '<xsl:value-of select="xtsext:javascriptencode(string(./name))"/>';
  1670. id = '<xsl:value-of select="xtsext:javascriptencode(string(@id))"/>';
  1671. initialValue = '<xsl:value-of select="xtsext:javascriptencode(string(./value))"/>';
  1672. var groupField = new parent.FieldContent(fieldName, id, initialValue);
  1673. //add the field in its own right
  1674. parent.getAgentItemsListener().addField(groupField);
  1675. //add to an array for group register
  1676. groupFields.push(groupField);
  1677. </xsl:for-each>
  1678. //register the group and its mode
  1679. parent.getAgentItemsListener().addDynamicGroup(groupFields, id);
  1680. <xsl:if test="./@promptablePath">
  1681. parent.getAgentItemsListener().setReportTask('<xsl:value-of select="xtsext:javascriptencode(string(./@id))"/>', '<xsl:value-of select="xtsext:javascriptencode(string(./@promptableName))"/>', '<xsl:value-of select="xtsext:javascriptencode(string(./@promptablePath))"/>');
  1682. </xsl:if>
  1683. <xsl:apply-templates/>
  1684. </xsl:template>
  1685. </xsl:stylesheet>
  1686. </xts:block>
  1687. <!-- =========================================================================================
  1688. D E B U G B L O C K
  1689. =========================================================================================
  1690. -->
  1691. <xts:block id="debug" type="exec" mode="output" processor="XSLT" condition=".[/root/session/param[@name = 'debug'] = '1']" mandatory="false" mimeType="text/html" dependency="renderPage">
  1692. <!-- Get the debug logicsheet. -->
  1693. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  1694. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" exclude-result-prefixes="dbg">
  1695. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  1696. <xsl:template match="/">
  1697. <dbg:dumpxml select="/root"/>
  1698. </xsl:template>
  1699. </xsl:stylesheet>
  1700. </xts:block>
  1701. </xts:morphlet>