123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2014
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <!--
- Copies an object in CM based on parameters passed in.
- Should create a CM command like so:
- <copy xmlns="http://developer.cognos.com/schemas/xts-cm/1/" select="/Contents/folder/report" target="/Contents/folder2/report2"/>
- -->
- <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:create="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/" xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/">
- <xts:block id="doCopy" processor="XSLT" type="exec">
- <xts:logicsheet path="portal/iFrmCmd/logicsheets/cm-save.xsl"/>
- <xts:logicsheet path="logicsheets/buslogic.xslt"/>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- exclude-result-prefixes="xtsext">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xsl:apply-templates select="root/command/form:copy"/>
- </xsl:template>
- <xsl:template match="form:env">
- <xts:sequence>
- <xts:append>
- <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
- <send:request provider="cm" faultBlock="copyFault">
- <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
- <cm:copy xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
- <cm:objects xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:choose>
- <!-- Single object copy operation -->
- <xsl:when test="(form:param[@name = 'm_obj'] and (form:param[@name = 'm_obj'] != ''))">
- <cm:nil>
- <cm:searchPath><xsl:value-of select="form:param[@name = 'm_obj']"/></cm:searchPath>
- </cm:nil>
- </xsl:when>
- <!-- Group copy operation -->
- <xsl:otherwise>
- <xsl:copy-of select="form:clipboard/*"/>
- </xsl:otherwise>
- </xsl:choose>
- </cm:objects>
- <cm:target>
- <xsl:value-of select="form:param[@name = 'm_p_path']"/>
- </cm:target>
- <xsl:if test="form:param[@name='m_obj']">
- <cm:newName><xsl:value-of select="form:param[@name='m_p_defaultName']"/></cm:newName>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="form:param[@name='overwriteExistingItems'] = 'true'">
- <xsl:choose>
- <xsl:when test="form:param[@name='cmdErrorUpdateActionReplace'] = 'true'">
- <cm:options recursive="true" updateAction="replace"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- "replace" by default -->
- <xsl:choose>
- <xsl:when test="string(/root/system/param[@name = 'updateTargetObjectWhenOverwrite']) = 'true'">
- <cm:options recursive="true" updateAction="update"/>
- </xsl:when>
- <xsl:otherwise>
- <cm:options recursive="true" updateAction="replace"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <cm:options recursive="true" updateAction="fail"/>
- </xsl:otherwise>
- </xsl:choose>
- </cm:copy>
- </xts:transform>
- </send:request>
- </xts:transform>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
-
- <!--
- Performs any additional operations after the copy has successfully completed
- -->
- <xts:block id="postCopy" processor="XSLT" type="exec" dependency="doCopy" condition=".[/root/*[local-name()='copyResponse']//*[local-name()='storeID']]" mandatory="false">
- <xts:logicsheet path="logicsheets/buslogic.xslt"/>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xsl:apply-templates select="root/command/form:copy"/>
- </xsl:template>
- <xsl:template match="form:env">
- <xsl:if test="form:param[@name='cmdAquirePermissionsFromTargetParent'] = 'true'">
- <xsl:variable name="targetStoreID" select="/root/*[local-name()='copyResponse']//*[local-name()='storeID']"/>
- <xts:sequence>
- <xts:append>
- <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
- <send:request provider="cm" faultBlock="copyFault">
- <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
- <cm:update>
- <cm:objects xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:variable name="objType" select="name(/root/*[local-name()='copyResponse']/*)"/>
- <xsl:element name="{$objType}">
- <cm:searchPath>
- <xsl:value-of select="concat('storeID("',string($targetStoreID),'")')"/>
- </cm:searchPath>
- <cm:policies/>
- </xsl:element>
- </cm:objects>
- </cm:update>
- </xts:transform>
- </send:request>
- </xts:transform>
- </xts:append>
- </xts:sequence>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
-
- <xts:block id="copyFault" type="fault" processor="XSLT">
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="xml"/>
- <xsl:template match="/root/fault">
- <xsl:choose>
- <xsl:when test="./*[local-name() = 'exception']/*[local-name() = 'exceptionDetail']/*[local-name() = 'exception']/*[local-name()='errorCode'] = 'cmNameConflict'">
- <copyFault>
- <xsl:copy-of select="."/>
- </copyFault>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="text()"/>
- </xsl:stylesheet>
- </xts:block>
-
- <xts:block id="result" processor="XSLT" type="exec" mode="output" mimeType="text/xml" dependency="postCopy">
- <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
- <xsl:stylesheet xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" version="1.0">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/root">
- <xsl:choose>
- <xsl:when test="bus:response"><xsl:copy-of select="bus:response/child::*"/></xsl:when>
- <xsl:when test="./copyFault">
- <error>
- <errorCode>
-
- <xsl:value-of select="./copyFault/fault/*[local-name()='exception']/*[local-name()='exceptionDetail']/*[local-name()='exception']/*[local-name()='errorCode']"/>
- </errorCode>
- <xsl:if test="/root/command/form:copy/form:env/form:param[@name='overwriteExistingItems'] = 'true'">
- <errorCodeDetails>failOnOverwrite</errorCodeDetails>
- </xsl:if>
- <errorMessage>
- <xsl:value-of select="./copyFault/fault/*[local-name()='exception']/*[local-name()='exceptionDetail']/*[local-name()='exception']/*[local-name()='message']/*[local-name()='messageString']"/>
- </errorMessage>
- </error>
- </xsl:when>
- <xsl:otherwise><error/></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="text()"/>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|