calcAgentState.xts 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2009
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/AGS.xml,messages/portal.xml, messages/portalRL.xml" resolverBase="prompting" includeConfig="true" requiredCapability="canUseEventStudio">
  9. <!--
  10. ================================================================================
  11. decode the agent items
  12. ===============================================================================================
  13. -->
  14. <xts:block id="decode_agent_definition" processor="XSLT" type="exec">
  15. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  16. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  17. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  18. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  19. <xsl:template match="/">
  20. <xts:sequence>
  21. <xsl:choose>
  22. <xsl:when test="/root/env/param[@name = 'agent_definition_blob']">
  23. <!-- decode the agent items -->
  24. <xts:append select="/root">
  25. <xsl:value-of select="xtsext:web64decode( xtsext:cafaction('sign_unwrap_settemplatename_decodeagentdefinition_settemplateid_presave001', string( /root/env/param[@name = 'agent_definition_blob'])), true() )" disable-output-escaping="yes"/>
  26. </xts:append>
  27. <!-- delete the agent definition blob - we're putting it back later -->
  28. <xts:delete select="/root/env/param[@name='agent_definition_blob']"/>
  29. </xsl:when>
  30. </xsl:choose>
  31. </xts:sequence>
  32. </xsl:template>
  33. </xsl:stylesheet>
  34. </xts:block>
  35. <!--
  36. ===============================================================================================
  37. getPageData - create the request parameters for the content page
  38. ===============================================================================================
  39. -->
  40. <xts:block id="getPageData" dependency="decode_agent_definition" path="ags/navigator.xslt" processor="XSLT" type="exec"/>
  41. <!--
  42. ===============================================================================================
  43. Handle controller template results - some pages/condition/schedule/email are written in the controller_template form. This means
  44. we have to call them a second time to get the result
  45. ===============================================================================================
  46. -->
  47. <xts:block id="callControllerTemplateResults" path="/ags/callResultTemplate.xslt" dependency="getPageData" condition=".[/root/env/param[@name='tabSelectedID']!='AgentTask-condition']" mandatory="false" processor="XSLT" type="exec">
  48. <xts:logicsheet path="logicsheets/portal.xsl"/>
  49. </xts:block>
  50. <!--
  51. ===============================================================================================
  52. Handle controller template results - some pages/condition/schedule/email are written in the controller_template form. This means
  53. we have to call them a second time to get the result
  54. ===============================================================================================
  55. -->
  56. <xts:block id="handleControllerTemplateResults" path="/ags/handleResultTemplate.xslt" dependency="callControllerTemplateResults" condition=".[/root/env/param[@name='tabSelectedID']!='AgentTask-condition']" mandatory="false" processor="XSLT" type="exec">
  57. <xts:logicsheet path="logicsheets/portal.xsl"/>
  58. </xts:block>
  59. <!--
  60. ===============================================================================================
  61. Correct the task name if required ... the agent task action names which are now not specified by
  62. user and are taken from task property
  63. for Email it is subject, report .. report name, webservice - operation name, SQL - proc name etc.
  64. thus in order to avoid duplicate names we need to manage these names and we do it by putting a
  65. sequence number at the end of task name
  66. ===============================================================================================
  67. -->
  68. <xts:block id="manageTaskNameBlock" path="/ags/manageTaskName.xslt" dependency="handleControllerTemplateResults" mandatory="false" processor="XSLT" type="exec">
  69. <xts:logicsheet path="logicsheets/portal.xsl"/>
  70. </xts:block>
  71. <!--
  72. ===============================================================================================
  73. Save the agent action info. The encoded contents will be stored in /root/env/param[@name='<action>']. where the action is
  74. the contents of /root/env/param[@name='prevTabID'] which can be schedule/message/agent/job/report.
  75. Once the individual elements have been saved into the environment they will be removed.
  76. ===============================================================================================
  77. -->
  78. <xts:block id="storePreviousTab" path="/ags/storeTabTemplate.xslt" dependency="manageTaskNameBlock" mandatory="false" processor="XSLT" type="exec">
  79. <xts:logicsheet path="logicsheets/portal.xsl"/>
  80. </xts:block>
  81. <!--
  82. ================================================================================
  83. encode the agent items again
  84. ================================================================================
  85. -->
  86. <xts:block id="encode_agent_definition" dependency="storePreviousTab" processor="XSLT" type="exec">
  87. <xts:logicsheet path="logicsheets/portal.xsl"/>
  88. <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">
  89. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  90. <pf:serialize-xml/>
  91. <pf:variables/>
  92. <xsl:template match="/">
  93. <xts:sequence>
  94. <xsl:variable name="markup">
  95. <xsl:call-template name="serialize-xml">
  96. <xsl:with-param name="node-set" select="/root/agent_definition"/>
  97. </xsl:call-template>
  98. </xsl:variable>
  99. <xts:append select="/root/env">
  100. <param name="agent_definition_blob">
  101. <xsl:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport, '_settemplatename_encodeagentdefinition_settemplateid_presave002'), xtsext:web64encode( string( $markup ), true()))"/>
  102. </param>
  103. </xts:append>
  104. </xts:sequence>
  105. </xsl:template>
  106. </xsl:stylesheet>
  107. </xts:block>
  108. <!--
  109. ===============================================================================================
  110. genMarkup - Produce the much needed XML response
  111. ===============================================================================================
  112. -->
  113. <xts:block id="getResult" type="exec" mode="output" mimeType="application/xml; charset=utf-8" processor="XSLT" dependency="encode_agent_definition">
  114. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  115. <xsl:output method="xml" encoding="utf-8" indent="no"/>
  116. <!-- declared a variable to determine if a report has been selected, used for validation purposes-->
  117. <xsl:template match="/">
  118. <calcAgentStateResponse>
  119. <!-- send back all the wrapped up agentTaskBlobs -->
  120. <param name="agent_definition_blob">
  121. <xsl:value-of select="/root/env/param[@name='agent_definition_blob']"/>
  122. </param>
  123. <xsl:for-each select="/root/env/param[starts-with(@name, 'AgentTask')]">
  124. <param name="{./@name}">
  125. <xsl:value-of select="."/>
  126. </param>
  127. </xsl:for-each>
  128. </calcAgentStateResponse>
  129. </xsl:template>
  130. </xsl:stylesheet>
  131. </xts:block>
  132. </xts:morphlet>