create.xts 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2013
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <!--
  13. ===============================================================================================
  14. Creates an object in CM based on parameters passed in.
  15. Should create a CM command like so:
  16. <add xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  17. <search>/content/folder[@defaultName="blah"]</search>
  18. <objects>
  19. <folder>
  20. <defaultName>Dave</defaultName>
  21. <defaultDescription>Dave's folder</defaultDescription>
  22. ...
  23. </folder>
  24. </objects>
  25. </add>
  26. ===============================================================================================
  27. -->
  28. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/">
  29. <!--
  30. ===============================================================================================
  31. formlogic_init - standard form logic initialization
  32. ===============================================================================================
  33. -->
  34. <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt" nodelist="env,credential,system,http" condition=".[/root/env/param[@name='m_pagedef_allow_everyone']='true']" mandatory="false"/>
  35. <!--
  36. ===============================================================================================
  37. Query for the default destination container
  38. ===============================================================================================
  39. -->
  40. <xts:block id="getContent" processor="XSLT" type="exec" dependency="formlogic_init" condition=".[/root/env/param[@name='m_pagedef_allow_everyone']='true']" mandatory="false">
  41. <xts:logicsheet path="logicsheets/portal.xsl"/>
  42. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  43. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  44. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  45. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  46. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  47. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  48. <xsl:template match="/">
  49. <xsl:variable name="path">
  50. <xsl:value-of select="string(/root/env/param[@name='m_path'])"/>
  51. </xsl:variable>
  52. <xts:sequence>
  53. <xts:append>
  54. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  55. <send:request provider="cm">
  56. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  57. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  58. <cm:requests>
  59. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  60. <cm:search>
  61. <xsl:value-of select="$path"/>
  62. </cm:search>
  63. <cm:properties>
  64. <cm:property name="policies"/>
  65. </cm:properties>
  66. </cm:query>
  67. </cm:requests>
  68. </cm:query>
  69. </xts:transform>
  70. </send:request>
  71. </xts:transform>
  72. </xts:append>
  73. </xts:sequence>
  74. </xsl:template>
  75. </xsl:stylesheet>
  76. </xts:block>
  77. <!--
  78. ===============================================================================================
  79. preCreate
  80. A block to take care of tasks that should be done before the save. For example decoding
  81. certain parameters like m_p_members or jobSteps.
  82. Also silently wires off creating URL objects based on system configurations
  83. ===============================================================================================
  84. -->
  85. <xts:block id="preCreate" processor="XSLT" type="exec" dependency="getContent">
  86. <xts:logicsheet path="portal/iFrmCmd/logicsheets/cm-save.xsl"/>
  87. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  88. xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/"
  89. xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/"
  90. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  91. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  92. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  93. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  94. <cms:prop-decode/>
  95. <xsl:template match="/root/command/form:create/form:env">
  96. <xts:sequence>
  97. <!-- decode all properties -->
  98. <xsl:apply-templates select="form:param[@name='emailToRunOptions' or @name='jobOptions' or @name='jobSteps' or starts-with(@name, 'm_p_')]" mode="decode"/>
  99. <!--
  100. Feature 572184: Last minute check to see if this creat (add) operation is clear to go.
  101. - If this is a request to create a URL object when it is disabled system-wide then bypass the creat operation
  102. -->
  103. <xsl:if test="/root/system/param[@name='disableURLObjectCreation'] = 'true' and form:param[@name='m_new_class'] = 'URL'">
  104. <xts:append>
  105. <skipCreate/>
  106. </xts:append>
  107. </xsl:if>
  108. </xts:sequence>
  109. </xsl:template>
  110. <xsl:template match="text()"/>
  111. </xsl:stylesheet>
  112. </xts:block>
  113. <!--
  114. ===============================================================================================
  115. doCreate
  116. ===============================================================================================
  117. -->
  118. <xts:block id="doCreate" processor="XSLT" type="exec" dependency="preCreate" condition=".[not(root/skipCreate)]">
  119. <xts:logicsheet path="portal/iFrmCmd/logicsheets/cm-save.xsl"/>
  120. <xts:logicsheet path="logicsheets/portal.xsl"/>
  121. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  122. <xsl:stylesheet version="1.0"
  123. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  124. xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/"
  125. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  126. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  127. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  128. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  129. xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/"
  130. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  131. xmlns:cps="http://developer.cognos.com/schemas/cps/asm/objects/1/"
  132. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  133. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  134. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  135. exclude-result-prefixes="cms xts send cm pf form xtsext">
  136. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  137. <pf:variables/> <!-- global application variables -->
  138. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  139. <xsl:template match="/">
  140. <xsl:apply-templates select="root/command/form:create/form:env"/>
  141. </xsl:template>
  142. <xsl:template match="form:env">
  143. <!-- this is the class of the new object -->
  144. <xsl:variable name="cls" select="form:param[@name='m_new_class']"/>
  145. <!-- optional parameter to override the default CM update action -->
  146. <xsl:variable name="update-action">
  147. <xsl:if test="form:param[@name='update-action'] = 'update' or form:param[@name='update-action'] = 'replace'">
  148. <xsl:value-of select="form:param[@name='update-action']"/>
  149. </xsl:if>
  150. </xsl:variable>
  151. <xts:sequence>
  152. <!-- prepare and send the add request -->
  153. <xts:append>
  154. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  155. <send:request provider="cm" faultBlock="createFault">
  156. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  157. <cm:add xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  158. <cm:search>
  159. <xsl:value-of select="form:param[@name='m_p_path']"/>
  160. </cm:search>
  161. <cm:objects>
  162. <xsl:element name="{$cls}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  163. <xsl:apply-templates/>
  164. <xsl:if test="$cls='reportView'">
  165. <xsl:value-of select="xtsext:web64decode( xtsext:cafaction('sign_unwrap', string(form:param[@name = 'reportViewExecutionFormat'])), true() )" disable-output-escaping="yes"/>
  166. <xsl:value-of select="xtsext:web64decode( xtsext:cafaction('sign_unwrap', string(form:param[@name = 'reportViewExecutionLocale'])), true() )" disable-output-escaping="yes"/>
  167. <xsl:value-of select="xtsext:web64decode( xtsext:cafaction('sign_unwrap', string(form:param[@name = 'reportViewOptions'])), true() )" disable-output-escaping="yes"/>
  168. <xsl:value-of select="xtsext:web64decode( xtsext:cafaction('sign_unwrap', string(form:param[@name = 'reportViewParameters'])), true() )" disable-output-escaping="yes"/>
  169. </xsl:if>
  170. <xsl:if test="$cls='powerPlay8ReportView'">
  171. <xsl:value-of select="xtsext:web64decode( xtsext:cafaction('sign_unwrap', string(form:param[@name = 'powerPlay8ReportViewOptions'])), true() )" disable-output-escaping="yes"/>
  172. </xsl:if>
  173. <xsl:if test="form:param[starts-with(@name, 'm_ml_')]">
  174. <xsl:call-template name="gen-multilingual-arrays"/>
  175. </xsl:if>
  176. <xsl:if test="form:param[@name='m_new_class']='dataSource'">
  177. <cm:dataSourceCapabilities>
  178. <xsl:for-each select="key('env-param', 'm_dscap')">
  179. <cm:capability>
  180. <xsl:value-of select="concat('http://developer.cognos.com/ceba/constants/dataSourceCapabilityEnum#', string(.))"/>
  181. </cm:capability>
  182. </xsl:for-each>
  183. </cm:dataSourceCapabilities>
  184. </xsl:if>
  185. <xsl:if test="/root/system/param[@name='ui_objects']/object[@class=string($cls) and @runnable='T']">
  186. <xsl:call-template name="gen-default-retention">
  187. <xsl:with-param name="cls" select="$cls"/>
  188. </xsl:call-template>
  189. </xsl:if>
  190. <xsl:if test="$cls='agentDefinitionView'">
  191. <cm:allowNotification>
  192. <xsl:choose>
  193. <xsl:when test="form:param[@name='m_agent_allowNotification']">true</xsl:when>
  194. <xsl:otherwise>false</xsl:otherwise>
  195. </xsl:choose>
  196. </cm:allowNotification>
  197. </xsl:if>
  198. <xsl:if test="$cls='pageDefinition' and form:param[@name='m_pagedef_allow_everyone']='true'">
  199. <cm:policies>
  200. <xsl:variable name="destinationFldrRef" select="/root/cm:queryResponse/cm:queryReply[1]/*"/>
  201. <xsl:copy-of select="$destinationFldrRef/cm:policies/cm:policy[cm:securityObject/cm:searchPath != 'CAMID(&quot;::Everyone&quot;)']"/>
  202. <cm:policy>
  203. <cm:securityObject>
  204. <cm:searchPath>CAMID("::Everyone")</cm:searchPath>
  205. </cm:securityObject>
  206. <xsl:for-each select="$destinationFldrRef/cm:policies/cm:policy[cm:securityObject/cm:searchPath = 'CAMID(&quot;::Everyone&quot;)']/cm:permission[@name !='read']">
  207. <xsl:copy-of select="."/>
  208. </xsl:for-each>
  209. <cm:permission name="read" access="grant"/>
  210. </cm:policy>
  211. </cm:policies>
  212. </xsl:if>
  213. <xsl:if test="$cls='jobDefinition'">
  214. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  215. <root>
  216. <!-- copy the job options and rebuild the options and value elements since the count might be wrong -->
  217. <xsl:copy-of select="/root/*[local-name()='jobOptions']/*[local-name()='options']/*[local-name()='value']/*"/>
  218. <xts:transform src="transforms/portal/options/buildOptionItems.xslt" processor="XSLT">
  219. <root>
  220. <xsl:copy-of select="/root/env"/>
  221. <xts:transform name="XML" src="portal/options.xml"/>
  222. <optionType>jobOptions</optionType>
  223. </root>
  224. </xts:transform>
  225. </root>
  226. </xts:transform>
  227. </xsl:if>
  228. <xsl:if test="$cls='contentTask'">
  229. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  230. <root>
  231. <xts:transform src="transforms/portal/options/buildOptionItems.xslt" processor="XSLT">
  232. <root>
  233. <xsl:copy-of select="/root/env"/>
  234. <xts:transform name="XML" src="portal/options.xml"/>
  235. <optionType>contentTaskProperties</optionType>
  236. <optionType>contentTaskOptions</optionType>
  237. </root>
  238. </xts:transform>
  239. </root>
  240. </xts:transform>
  241. </xsl:if>
  242. <xsl:if test="$cls='indexUpdateTask'">
  243. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  244. <root>
  245. <xts:transform src="transforms/portal/options/buildOptionItems.xslt" processor="XSLT">
  246. <root>
  247. <xsl:copy-of select="/root/env"/>
  248. <xts:transform name="XML" src="portal/options.xml"/>
  249. <optionType>indexOptions</optionType>
  250. </root>
  251. </xts:transform>
  252. </root>
  253. </xts:transform>
  254. </xsl:if>
  255. <!--
  256. Handle the layout property for pagelet objects.
  257. I should be reading the env data from the <command/create> element but that causes
  258. unwanted namespace problems when xml-encoding the layout xml.
  259. -->
  260. <xsl:if test="$cls='pagelet'">
  261. <cm:layout>
  262. <xts:transform name="XMLEncode">
  263. <xts:transform src="portal/mypages/transform/gen_pagelet_layout.xslt" processor="XSLT">
  264. <xsl:copy-of select="."/>
  265. </xts:transform>
  266. </xts:transform>
  267. </cm:layout>
  268. </xsl:if>
  269. <xsl:if test="$cls='metricsFileImportTask' or $cls='metricsMaintenanceTask'">
  270. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  271. <root>
  272. <xts:transform src="transforms/portal/options/buildOptionItems.xslt" processor="XSLT">
  273. <root>
  274. <xts:transform src="transforms/portal/options/cleanEnv.xslt" processor="XSLT">
  275. <root>
  276. <xsl:copy-of select="/root/env"/>
  277. </root>
  278. </xts:transform>
  279. <xts:transform name="XML" src="portal/options.xml"/>
  280. <optionType>metricsOptions</optionType>
  281. </root>
  282. </xts:transform>
  283. </root>
  284. </xts:transform>
  285. </xsl:if>
  286. <xsl:if test="form:param[@name='m_new_class']='powerPlayReport'">
  287. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  288. <root>
  289. <xts:transform src="transforms/portal/options/buildOptionItems.xslt" processor="XSLT">
  290. <root>
  291. <xts:transform src="transforms/portal/options/cleanEnv.xslt" processor="XSLT">
  292. <root>
  293. <xsl:copy-of select="/root/env"/>
  294. </root>
  295. </xts:transform>
  296. <xts:transform name="XML" src="portal/options.xml"/>
  297. <optionType>powerPlayOptions</optionType>
  298. </root>
  299. </xts:transform>
  300. </root>
  301. </xts:transform>
  302. <xsl:if test="form:param[@name='m_ppro_outputFormat']='HTML' and not(form:param[@name='m_p_defaultPortalAction'])">
  303. <cm:defaultPortalAction>edit</cm:defaultPortalAction>
  304. </xsl:if>
  305. </xsl:if>
  306. <xsl:if test="string($cls)='drillPath'">
  307. <xts:transform src="transforms/portal/options/buildOptions.xslt" processor="XSLT">
  308. <root>
  309. <xts:transform src="transforms/portal/options/buildOptionItems.xslt" processor="XSLT">
  310. <root>
  311. <xts:transform src="transforms/portal/options/cleanEnv.xslt" processor="XSLT">
  312. <root>
  313. <xsl:copy-of select="/root/env"/>
  314. </root>
  315. </xts:transform>
  316. <xts:transform name="XML" src="portal/options.xml"/>
  317. <optionType>drillPathOptions</optionType>
  318. </root>
  319. </xts:transform>
  320. </root>
  321. </xts:transform>
  322. </xsl:if>
  323. <xsl:if test="form:param[starts-with(string(@name),'drillParam_')]">
  324. <cm:parameterAssignments type="cm:parameterAssignmentDataItemArrayProp">
  325. <xsl:for-each select="form:param[starts-with(string(@name),'drillParam_')]">
  326. <xsl:if test="string(.)!=''">
  327. <cm:parameterAssignmentDataItem>
  328. <cm:parameterName><xsl:value-of select="xtsext:web64decode( string( substring-after( string(@name),'drillParam_' ) ), true() )"/></cm:parameterName>
  329. <cm:dataItemName><xsl:value-of select="string(.)"/></cm:dataItemName>
  330. </cm:parameterAssignmentDataItem>
  331. </xsl:if>
  332. </xsl:for-each>
  333. </cm:parameterAssignments>
  334. </xsl:if>
  335. <xsl:if test="$cls='powerPlayReport' and form:param[starts-with(string(@name),'m_ppdb_')]">
  336. <cm:dataBlocks>
  337. <xsl:if test="string(form:param[string(@name)='m_ppdb_parameters'])!=''">
  338. <cm:dataBlock>
  339. <cm:data><xsl:value-of select="form:param[string(@name)='m_ppdb_parameters']"/></cm:data>
  340. <cm:id>parameters</cm:id>
  341. </cm:dataBlock>
  342. </xsl:if>
  343. <xsl:if test="string(form:param[string(@name)='m_ppdb_reportConfiguration'])!=''">
  344. <cm:dataBlock>
  345. <cm:data><xsl:value-of select="form:param[string(@name)='m_ppdb_reportConfiguration']"/></cm:data>
  346. <cm:id>reportConfiguration</cm:id>
  347. </cm:dataBlock>
  348. </xsl:if>
  349. <xsl:if test="string(form:param[string(@name)='m_ppdb_reportSpecification'])!=''">
  350. <cm:dataBlock>
  351. <cm:data><xsl:value-of select="form:param[string(@name)='m_ppdb_reportSpecification']"/></cm:data>
  352. <cm:id>reportSpecification</cm:id>
  353. </cm:dataBlock>
  354. </xsl:if>
  355. </cm:dataBlocks>
  356. </xsl:if>
  357. <xsl:if test="$cls='powerPlay8Report' and form:param[starts-with(string(@name),'m_pp8properties')]">
  358. <xts:transform name="XMLDecode">
  359. <xsl:copy-of select="form:param[string(@name)='m_pp8properties']"/>
  360. </xts:transform>
  361. </xsl:if>
  362. <xsl:if test="$cls='queryServiceTask' and form:param[string(@name)='m_queryServiceOptions']">
  363. <xsl:value-of select="form:param[@name='m_queryServiceOptions']" disable-output-escaping="yes"/>
  364. </xsl:if>
  365. </xsl:element>
  366. </cm:objects>
  367. <xsl:choose>
  368. <xsl:when test="$update-action!=''">
  369. <cm:options updateAction="{$update-action}"/>
  370. </xsl:when>
  371. <xsl:when test="$cls='runTimeState'">
  372. <cm:options updateAction="replace"/>
  373. </xsl:when>
  374. <xsl:when test="form:param[@name='overwriteExistingItems'] = 'true'">
  375. <cm:options updateAction="replace"/>
  376. </xsl:when>
  377. <xsl:otherwise>
  378. <cm:options updateAction="fail"/>
  379. </xsl:otherwise>
  380. </xsl:choose>
  381. </cm:add>
  382. </xts:transform>
  383. </send:request>
  384. </xts:transform>
  385. </xts:append>
  386. </xts:sequence>
  387. </xsl:template>
  388. <xsl:template match="form:param[starts-with(@name,'m_p_')]">
  389. <!-- this is the class of the new object -->
  390. <xsl:variable name="cls" select="../form:param[@name='m_new_class']"/>
  391. <xsl:variable name="paramName">
  392. <xsl:choose>
  393. <xsl:when test="starts-with(@name, 'm_p_archiveLocation_')">
  394. <xsl:value-of select="substring-after(@name, 'm_p_archiveLocation_')"/>
  395. </xsl:when>
  396. <xsl:otherwise>
  397. <xsl:value-of select="substring-after(@name, 'm_p_')"/>
  398. </xsl:otherwise>
  399. </xsl:choose>
  400. </xsl:variable>
  401. <!-- create an element for each property passed in -->
  402. <xsl:element name="{$paramName}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  403. <xsl:if test="string($cls)='metricsExportTask' and @name='m_p_specification'">
  404. <xsl:attribute name="type">dataIntegrationServiceSpecificationProp</xsl:attribute>
  405. </xsl:if>
  406. <xsl:choose>
  407. <xsl:when test="string($cls)='migrationTask' and @name='m_p_specification'">
  408. <xsl:element name="value">
  409. <xsl:attribute name="xsi:type">bus:specification</xsl:attribute>
  410. <xsl:value-of select="."/>
  411. </xsl:element>
  412. </xsl:when>
  413. <xsl:otherwise>
  414. <!-- name is the on CM property that must be encoded *before* giving to CM -->
  415. <xsl:value-of select="."/>
  416. </xsl:otherwise>
  417. </xsl:choose>
  418. </xsl:element>
  419. </xsl:template>
  420. <xsl:template name="gen-multilingual-arrays">
  421. <xsl:element name="name" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  422. <xsl:for-each select="form:param[starts-with(@name, 'm_ml_name_')]">
  423. <xsl:variable name="localeVal">
  424. <xsl:value-of select="xtsext:substringAfterLast(string(@name), '_')"/>
  425. </xsl:variable>
  426. <xsl:element name="item" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  427. <xsl:element name="locale"><xsl:value-of select="$localeVal"/></xsl:element>
  428. <xsl:element name="value"><xsl:value-of select="."/></xsl:element>
  429. </xsl:element>
  430. </xsl:for-each>
  431. </xsl:element>
  432. <xsl:element name="description" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  433. <xsl:for-each select="form:param[starts-with(@name, 'm_ml_description_')]">
  434. <xsl:variable name="localeVal">
  435. <xsl:value-of select="xtsext:substringAfterLast(string(@name), '_')"/>
  436. </xsl:variable>
  437. <xsl:element name="item" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  438. <xsl:element name="locale"><xsl:value-of select="$localeVal"/></xsl:element>
  439. <xsl:element name="value"><xsl:value-of select="."/></xsl:element>
  440. </xsl:element>
  441. </xsl:for-each>
  442. </xsl:element>
  443. <xsl:element name="screenTip" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  444. <xsl:for-each select="form:param[starts-with(@name, 'm_ml_screenTip_')]">
  445. <xsl:variable name="localeVal">
  446. <xsl:value-of select="xtsext:substringAfterLast(string(@name), '_')"/>
  447. </xsl:variable>
  448. <xsl:element name="item" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  449. <xsl:element name="locale"><xsl:value-of select="$localeVal"/></xsl:element>
  450. <xsl:element name="value"><xsl:value-of select="."/></xsl:element>
  451. </xsl:element>
  452. </xsl:for-each>
  453. </xsl:element>
  454. </xsl:template>
  455. <xsl:template match="form:param[starts-with(@name,'m_ppc_')]">
  456. <!-- create an element for each property passed in -->
  457. <xsl:element name="{substring-after(@name, 'm_ppc_')}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  458. <!-- name is the on CM property that must be encoded *before* giving to CM -->
  459. <xsl:value-of select="."/>
  460. </xsl:element>
  461. </xsl:template>
  462. <xsl:template name="gen-default-retention">
  463. <xsl:param name="cls"/>
  464. <xsl:element name="retentions" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  465. <xsl:element name="retentionRule" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  466. <xsl:attribute name="objectClass">
  467. <xsl:value-of select="'history'"/>
  468. </xsl:attribute>
  469. <xsl:attribute name="prop">
  470. <xsl:value-of select="'creationTime'"/>
  471. </xsl:attribute>
  472. <xsl:attribute name="maxObjects">
  473. <xsl:choose>
  474. <xsl:when test="$cls='exportDeployment' or $cls='importDeployment'">
  475. <xsl:value-of select="'1'"/>
  476. </xsl:when>
  477. <xsl:otherwise>
  478. <xsl:value-of select="'5'"/>
  479. </xsl:otherwise>
  480. </xsl:choose>
  481. </xsl:attribute>
  482. </xsl:element>
  483. <xsl:if test="$cls='reportView'">
  484. <xsl:element name="retentionRule" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  485. <xsl:attribute name="objectClass">
  486. <xsl:value-of select="'reportVersion'"/>
  487. </xsl:attribute>
  488. <xsl:attribute name="prop">
  489. <xsl:value-of select="'creationTime'"/>
  490. </xsl:attribute>
  491. <xsl:attribute name="maxObjects">
  492. <xsl:value-of select="'1'"/>
  493. </xsl:attribute>
  494. </xsl:element>
  495. </xsl:if>
  496. </xsl:element>
  497. </xsl:template>
  498. <!--
  499. -shortcuts are coming back with a different implementaion this may not be used
  500. TODO: THE @name='m_p_shortcut' IS PART OF THE HACK FOR BUG #348025 ABOVE, THIS
  501. SHOULD ALSO BE REMOVED WHEN THE BUG IS FIXED...
  502. ->
  503. <xsl:template match="form:param[@name != 'm_p_shortcut']">
  504. <xsl:variable name="nm" select="@name"/>
  505. <xsl:if test="not(preceding-sibling::form:param[@name=$nm]) and starts-with($nm, 'm_p_')">
  506. <- create an element for each property passed in ->
  507. <xsl:element name="{substring-after(@name, 'm_p_')}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  508. <- name is the on CM property that must be encoded *before* giving to CM ->
  509. <xsl:value-of select="."/>
  510. <xsl:for-each select="following-sibling::form:param[@name = $nm]">
  511. <xsl:value-of select="' '"/>
  512. <xsl:value-of select="."/>
  513. </xsl:for-each>
  514. </xsl:element>
  515. </xsl:if>
  516. </xsl:template>
  517. <- pull in any templates to handle "special" properties on CM objects -->
  518. <cms:prop-save/>
  519. <xsl:template match="text()"/>
  520. </xsl:stylesheet>
  521. </xts:block>
  522. <xts:block id="createFault" type="fault" processor="XSLT">
  523. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  524. <xsl:output method="xml"/>
  525. <xsl:template match="/root/fault">
  526. <xsl:choose>
  527. <xsl:when test="./*[local-name() = 'exception']/*[local-name() = 'exceptionDetail']/*[local-name() = 'exception']/*[local-name()='errorCode'] = 'cmDuplicateName'">
  528. <copyFault>
  529. <xsl:copy-of select="."/>
  530. </copyFault>
  531. </xsl:when>
  532. <xsl:otherwise>
  533. <xsl:copy-of select="."/>
  534. </xsl:otherwise>
  535. </xsl:choose>
  536. </xsl:template>
  537. <xsl:template match="text()"/>
  538. </xsl:stylesheet>
  539. </xts:block>
  540. <!--
  541. ================================================================================
  542. create_default_signon
  543. This blocks creates a default signon for the Everyone group with the supplied
  544. encrypted credentials. This block only executes when the m_new_class parameter
  545. is 'dataSourceConnection' and when the m_default_signon parameter is present.
  546. NOTE: This block doesn't seem to function with the XSLTC processor. The
  547. <xsl:value-of select=""/> inside of the <search> node never returns a value,
  548. causing the add request to fail.
  549. ================================================================================
  550. -->
  551. <xts:block id="create_default_signon" type="exec" mode="interpret" processor="XSLT" dependency="doCreate" mandatory="false" condition=".[/root/command/*[local-name()='create' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/']/*[local-name()='env' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/']/*[local-name()='param' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/' and @name='m_new_class']='dataSourceConnection' and /root/command/*[local-name()='create' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/']/*[local-name()='env' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/']/*[local-name()='param' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/' and @name='m_default_signon'] and not(root/copyFault) and not(root/fault)]">
  552. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  553. <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:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/">
  554. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  555. <xsl:template match="/">
  556. <xts:sequence>
  557. <xts:append>
  558. <defaultSignon>
  559. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  560. <send:request provider="cm">
  561. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  562. <add xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  563. <search>
  564. <xsl:value-of select="/root/cm:addResponse/cm:dataSourceConnection/cm:searchPath"/>
  565. </search>
  566. <objects>
  567. <dataSourceSignon>
  568. <defaultName><xsl:value-of select="/root/command/form:create/form:env/form:param[@name='m_p_defaultName']"/></defaultName>
  569. <credentials>
  570. <xsl:value-of select="/root/command/form:create/form:env/form:param[@name='m_default_signon']"/>
  571. </credentials>
  572. <consumers>
  573. <group>
  574. <searchPath>CAMID("::Everyone")</searchPath>
  575. </group>
  576. </consumers>
  577. <xsl:variable name="tenantID" select="/root/command/form:create/form:env/form:param[@name='m_p_tenantID']"/>
  578. <xsl:if test="$tenantID">
  579. <tenantID><xsl:value-of select="$tenantID"/></tenantID>
  580. </xsl:if>
  581. </dataSourceSignon>
  582. </objects>
  583. </add>
  584. </xts:transform>
  585. </send:request>
  586. </xts:transform>
  587. </defaultSignon>
  588. </xts:append>
  589. </xts:sequence>
  590. </xsl:template>
  591. </xsl:stylesheet>
  592. </xts:block>
  593. <!--
  594. ================================================================================
  595. create_proxy_credential
  596. Creates a proxy credential with the supplied encrypted credentials. This block
  597. only executes when the m_new_class parameter is 'dataSourceConnection' and when
  598. the m_proxy_signon parameter is present.
  599. ================================================================================
  600. -->
  601. <xts:block id="create_proxy_credential" type="exec" mode="interpret" processor="XSLT" dependency="doCreate" mandatory="false" condition=".[/root/command/*[local-name()='create' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/']/*[local-name()='env' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/']/*[local-name()='param' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/' and @name='m_new_class']='dataSourceConnection' and /root/command/*[local-name()='create' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/']/*[local-name()='env' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/']/*[local-name()='param' and namespace-uri()='http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/' and @name='m_connection_proxy_enabled']='true' and not(root/copyFault) and not(root/fault)]">
  602. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  603. <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:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/">
  604. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  605. <xsl:template match="/">
  606. <xts:sequence>
  607. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  608. <send:request provider="cm">
  609. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  610. <add xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  611. <search>
  612. <xsl:value-of select="/root/cm:addResponse/cm:dataSourceConnection/cm:searchPath"/>
  613. </search>
  614. <objects>
  615. <credential>
  616. <defaultName>proxy</defaultName>
  617. <defaultDescription>
  618. <xsl:value-of select="/root/command/form:create/form:env/form:param[@name='m_proxy_signon']"/>
  619. </defaultDescription>
  620. <credentials>
  621. <xsl:value-of select="/root/command/form:create/form:env/form:param[@name='m_proxy_signon']"/>
  622. </credentials>
  623. <xsl:variable name="tenantID" select="/root/command/form:create/form:env/form:param[@name='m_p_tenantID']"/>
  624. <xsl:if test="$tenantID">
  625. <tenantID><xsl:value-of select="$tenantID"/></tenantID>
  626. </xsl:if>
  627. </credential>
  628. </objects>
  629. </add>
  630. </xts:transform>
  631. </send:request>
  632. </xts:transform>
  633. </xts:sequence>
  634. </xsl:template>
  635. </xsl:stylesheet>
  636. </xts:block>
  637. <!--
  638. ===============================================================================================
  639. postCreate
  640. A block to take care of tasks that should be done after creating the primary object. For example saving the jobStepDefinition
  641. child objects of a jobDefinition
  642. ===============================================================================================
  643. -->
  644. <xts:block id="postCreate" dependency="doCreate" condition=".[not(root/copyFault) and not(root/fault) and not(root/skipCreate)]" processor="XSLT" type="exec" mandatory="false">
  645. <xts:logicsheet path="portal/iFrmCmd/logicsheets/cm-save.xsl"/>
  646. <xts:logicsheet path="logicsheets/portal.xsl"/>
  647. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  648. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  649. xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/"
  650. xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/"
  651. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  652. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  653. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  654. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  655. xmlns:cps="http://developer.cognos.com/schemas/cps/asm/objects/1/"
  656. xmlns:x="x"
  657. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  658. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  659. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  660. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  661. <!-- Handle any jobStepDefinition adds that are required -->
  662. <pf:variables/>
  663. <xsl:template match="/">
  664. <xsl:variable name="env" select="/root/command/form:create/form:env"/>
  665. <xsl:if test="$env/form:param[@name='m_new_class']='agentDefinitionView'">
  666. <xts:sequence>
  667. <xts:append>
  668. <send:request provider="cm">
  669. <bus:add>
  670. <search xsi:type="xsd:string">
  671. <xsl:value-of select="/root/cm:addResponse/*/cm:searchPath"/>
  672. </search>
  673. <objects xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:baseClass[1]">
  674. <item xsi:type="bus:reportView">
  675. <base xsi:type="bus:baseClassArrayProp">
  676. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:baseClass[1]">
  677. <item xsi:type="bus:baseClass">
  678. <searchPath xsi:type="bus:stringProp"><value xsi:type="xsd:string" xml:space="preserve"><xsl:value-of select="$env/form:param[@name='m_p_base']"/>/report</value></searchPath>
  679. </item>
  680. </value>
  681. </base>
  682. </item>
  683. </objects>
  684. </bus:add>
  685. </send:request>
  686. </xts:append>
  687. </xts:sequence>
  688. </xsl:if>
  689. <xsl:for-each select="/root/steps[cm:queryResponse/cm:jobStepDefinition]">
  690. <xts:sequence>
  691. <xts:append>
  692. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  693. <send:request provider="cm">
  694. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  695. <cm:add>
  696. <cm:objects>
  697. <xsl:for-each select="cm:queryResponse/cm:jobStepDefinition">
  698. <cm:jobStepDefinition>
  699. <cm:searchPath>
  700. <xsl:value-of select="/root/cm:addResponse/cm:jobDefinition/cm:searchPath"/>
  701. </cm:searchPath>
  702. <cm:displaySequence>
  703. <xsl:value-of select="cm:displaySequence"/>
  704. </cm:displaySequence>
  705. <cm:stepObject>
  706. <xsl:element name="{local-name(cm:stepObject/*[1])}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  707. <cm:searchPath>
  708. <xsl:value-of select="cm:stepObject/*[1]/cm:searchPath"/>
  709. </cm:searchPath>
  710. </xsl:element>
  711. </cm:stepObject>
  712. <xsl:if test="*[local-name()='options']/*">
  713. <xsl:copy-of select="*[local-name()='options']"/>
  714. </xsl:if>
  715. <cm:parameters>
  716. <xsl:copy-of select="*[local-name()='parameters']/*"/>
  717. </cm:parameters>
  718. <xsl:if test="$env/form:param[@name='m_p_tenantID']">
  719. <cm:tenantID><xsl:value-of select="$env/form:param[@name='m_p_tenantID']"/></cm:tenantID>/cm:tenantID>
  720. </xsl:if>
  721. </cm:jobStepDefinition>
  722. </xsl:for-each>
  723. </cm:objects>
  724. <cm:options updateAction="fail"/>
  725. </cm:add>
  726. </xts:transform>
  727. </send:request>
  728. </xts:transform>
  729. </xts:append>
  730. </xts:sequence>
  731. </xsl:for-each>
  732. <!-- Create portlet instances for a new pagelet object (in the future pagelet instances) -->
  733. <xsl:variable name="portletInstanceObjects">
  734. <xsl:choose>
  735. <xsl:when test="$env/form:param[@name = 'pagexml']/*/cps:portletInstance">
  736. <xsl:for-each select="$env/form:param[@name = 'pagexml']/*/cps:portletInstance">
  737. <cm:portletInstance>
  738. <cm:searchPath><xsl:value-of select="/root/cm:addResponse/cm:pagelet/cm:searchPath"/></cm:searchPath>
  739. <cm:defaultName><xsl:value-of select="cps:id"/></cm:defaultName>
  740. <cm:portlet>
  741. <cm:baseClass>
  742. <cm:searchPath><xsl:value-of select="concat('storeID(&quot;', cps:portletId, '&quot;)')"/></cm:searchPath>
  743. </cm:baseClass>
  744. </cm:portlet>
  745. </cm:portletInstance>
  746. </xsl:for-each>
  747. </xsl:when>
  748. <xsl:when test="$env/form:param[starts-with(@name,'m_mp_portlet')]">
  749. <xsl:for-each select="$env/form:param[starts-with(@name,'m_mp_portlet')]">
  750. <cm:portletInstance>
  751. <cm:searchPath><xsl:value-of select="/root/cm:addResponse/cm:pagelet/cm:searchPath"/></cm:searchPath>
  752. <cm:defaultName><xsl:value-of select="substring-after(@name, 'm_mp_portlet_')"/></cm:defaultName>
  753. <cm:portlet>
  754. <cm:baseClass>
  755. <cm:searchPath><xsl:value-of select="."/></cm:searchPath>
  756. </cm:baseClass>
  757. </cm:portlet>
  758. </cm:portletInstance>
  759. </xsl:for-each>
  760. </xsl:when>
  761. </xsl:choose>
  762. </xsl:variable>
  763. <xsl:if test="$portletInstanceObjects">
  764. <xts:sequence>
  765. <xts:append>
  766. <send:request provider="cm">
  767. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  768. <cm:add>
  769. <cm:objects>
  770. <xsl:copy-of select="$portletInstanceObjects"/>
  771. </cm:objects>
  772. <cm:options updateAction="fail"/>
  773. </cm:add>
  774. </xts:transform>
  775. </send:request>
  776. </xts:append>
  777. </xts:sequence>
  778. </xsl:if>
  779. </xsl:template>
  780. <!-- pull in any templates to handle "special" properties on CM objects -->
  781. <cms:prop-save/>
  782. <xsl:template match="text()"/>
  783. </xsl:stylesheet>
  784. </xts:block>
  785. <!-- operation results -->
  786. <xts:block id="commandResults" processor="XSLT" type="exec" mode="output" mimeType="text/xml" dependency="postCreate">
  787. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  788. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" version="1.0">
  789. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  790. <xsl:template match="/root">
  791. <response xmlns="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/">
  792. <xsl:choose>
  793. <xsl:when test="cm:addResponse">
  794. <xsl:copy-of select="cm:addResponse/child::*"/>
  795. </xsl:when>
  796. <xsl:when test="./copyFault">
  797. <error>
  798. <errorCode>
  799. <xsl:value-of select="./copyFault/fault/*[local-name()='exception']/*[local-name()='exceptionDetail']/*[local-name()='exception']/*[local-name()='errorCode']"/>
  800. </errorCode>
  801. <errorMessage>
  802. <xsl:value-of select="./copyFault/fault/*[local-name()='exception']/*[local-name()='exceptionDetail']/*[local-name()='exception']/*[local-name()='message']/*[local-name()='messageString']"/>
  803. </errorMessage>
  804. </error>
  805. </xsl:when>
  806. <!--
  807. In case we are skipping the create operation, let the response default to <error/>.
  808. It won't make a difference plus it is only appropriate to return an error given that
  809. this is likely a bogus request (causing the create operation to be bypassed.
  810. -->
  811. <xsl:otherwise><error/></xsl:otherwise>
  812. </xsl:choose>
  813. </response>
  814. </xsl:template>
  815. <xsl:template match="text()"/>
  816. </xsl:stylesheet>
  817. </xts:block>
  818. </xts:morphlet>