123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ASV
- (C) Copyright IBM Corp. 2005, 2010
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1"
- xmlns:hta="http://www.example.org/WS-HT/api"
- xmlns:ht="http://www.example.org/WS-HT"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- exclude-result-prefixes="xsl xsi SOAP-ENC xtsext bus xsd">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:key name="param" match="/root/*[local-name()='param']" use="@name"/>
- <xsl:template match="/root">
- <xsl:choose>
- <xsl:when test="key('param','m_ro_owner_action')='approve' ">
- <impl:createApproveManualTask xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1" xmlns:hta="http://www.example.org/WS-HT/api" xmlns:ht="http://www.example.org/WS-HT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <xsl:call-template name="buildBpelManualTask"/>
- </impl:createApproveManualTask>
- </xsl:when>
- <xsl:when test="key('param','m_ro_owner_action')='agent' ">
- <impl:createAgentUserTask xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1" xmlns:hta="http://www.example.org/WS-HT/api" xmlns:ht="http://www.example.org/WS-HT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <xsl:call-template name="buildBpelManualTask"/>
- </impl:createAgentUserTask>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="buildBpelManualTask">
- <impl:beplTask name="Approval_instance_name" xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1" xmlns:hta="http://www.example.org/WS-HT/api" xmlns:ht="http://www.example.org/WS-HT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <xsl:choose>
- <xsl:when test="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='agentStudio'] = 'true'">
- <xsl:choose>
- <xsl:when test="/root/param[@name='m_ro_priority_radio']='priority'">
- <xsl:if test="/root/param[@name='m_ro_priority']">
- <impl:priority>
- <xsl:value-of select="/root/param[@name='m_ro_priority']"/>
- </impl:priority>
- </xsl:if>
- </xsl:when>
- <xsl:when test="/root/param[@name='m_ro_priority_radio']='item'">
- <xsl:if test="/root/param[@name='m_ro_priority_item']">
- <impl:priority>
- <xsl:value-of select="/root/param[@name='m_ro_priority_item']"/>
- </impl:priority>
- </xsl:if>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="/root/param[@name='m_ro_priority']">
- <impl:priority>
- <xsl:value-of select="/root/param[@name='m_ro_priority']"/>
- </impl:priority>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- <impl:peopleAssignments>
- <xsl:if test="/root/param[@name='to']/param[@name='to' or @name='toGroup' or @name='toAddress']">
- <ht:potentialOwners>
- <ht:from logicalPeopleGroup="CAM">
- <ht:literal>
- <ht:organizationalEntity>
- <xsl:if test="/root/param[@name='to']/param[@name='to']">
- <ht:users>
- <xsl:for-each select="/root/param[@name='to']/param[@name='to']">
- <ht:user>
- <xsl:value-of select="."/>
- </ht:user>
- </xsl:for-each>
- </ht:users>
- </xsl:if>
- <xsl:if test="/root/param[@name='to']/param[@name='toGroup' or @name='toAddress']">
- <ht:groups>
- <xsl:for-each select="/root/param[@name='to']/param[@name='toGroup' or @name='toAddress']">
- <ht:group>
- <xsl:value-of select="."/>
- </ht:group>
- </xsl:for-each>
- </ht:groups>
- </xsl:if>
- </ht:organizationalEntity>
- </ht:literal>
- </ht:from>
- </ht:potentialOwners>
- </xsl:if>
- <xsl:if test="/root/param[@name='cc']/param[@name='cc' or @name='ccGroup' or @name='ccAddress']">
- <ht:taskStakeholders>
- <ht:from logicalPeopleGroup="CAM">
- <ht:literal>
- <ht:organizationalEntity>
- <xsl:if test="/root/param[@name='cc']/param[@name='cc'] ">
- <ht:users>
- <xsl:for-each select="/root/param[@name='cc']/param[@name='cc']">
- <ht:user>
- <xsl:value-of select="."/>
- </ht:user>
- </xsl:for-each>
- </ht:users>
- </xsl:if>
- <xsl:if test="/root/param[@name='cc']/param[@name='ccGroup' or @name='ccAddress']">
- <ht:groups>
- <xsl:for-each select="/root/param[@name='cc']/param[@name='ccGroup' or @name='ccAddress']">
- <ht:group>
- <xsl:value-of select="."/>
- </ht:group>
- </xsl:for-each>
- </ht:groups>
- </xsl:if>
- </ht:organizationalEntity>
- </ht:literal>
- </ht:from>
- </ht:taskStakeholders>
- </xsl:if>
- <ht:businessAdministrators>
- <ht:from logicalPeopleGroup="CAM">
- <ht:literal>
- <ht:organizationalEntity>
- <ht:groups>
- <ht:group>CAMID(":Server Administrators")</ht:group>
- </ht:groups>
- </ht:organizationalEntity>
- </ht:literal>
- </ht:from>
- </ht:businessAdministrators>
- </impl:peopleAssignments>
-
- </impl:beplTask>
- <impl:manualTask xmlns:impl="http://www.ibm.com/xmlns/prod/cognos/internal/hts/_1" xmlns:hta="http://www.example.org/WS-HT/api" xmlns:ht="http://www.example.org/WS-HT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <!-- placeholder for the preview -->
- <impl:preview/>
- <!-- placeholder for the eventID's - though not sure these are needed -->
- <impl:parentEventId/>
- <impl:eventId/>
- <!-- add the task icon path in -->
- <xsl:choose>
- <xsl:when test="key('param', 'm_ro_icon_radio')='default' ">
- <impl:taskIconPath/>
- </xsl:when>
- <xsl:when test="key('param', 'm_ro_icon_radio')='item' ">
- <impl:taskIconPath>
- <xsl:value-of select="key('param', 'm_ro_icon_item')"/>
- </impl:taskIconPath>
- </xsl:when>
- </xsl:choose>
- <xsl:if test="key('param','m_ro_owner_action')='approve'">
- <impl:approveText>
- <xsl:value-of select="key('param','m_ro_approveValue')"/>
- </impl:approveText>
- <impl:rejectText>
- <xsl:value-of select="key('param','m_ro_rejectValue')"/>
- </impl:rejectText>
- </xsl:if>
- <xsl:if test="key('param','m_ro_owner_action')='agent' ">
- <impl:submitText>
- <xsl:value-of select="key('param','m_ro_submitValue')"/>
- </impl:submitText>
- </xsl:if>
- <!-- need to set the link in ASV - when we know the searchPAth to the report output to set -->
- <xsl:if test="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='agentStudio'] = 'true'">
- <xsl:if test="/root/*[local-name()='attachments']/*[local-name()='item']">
- <!-- attachments -->
- <impl:taskLinksList>
- <xsl:for-each select="/root/*[local-name()='attachments']/*[local-name()='item']">
- <impl:taskLink>
- <!-- if we have a locale then append to the attachment name -->
- <xsl:choose>
- <xsl:when test="*[local-name()='locale'] != ''">
- <impl:display>
- <xsl:value-of select="concat(*[local-name()='defaultName'],'_',*[local-name()='locale'])"/>
- </impl:display>
- </xsl:when>
- <xsl:otherwise>
- <impl:display>
- <xsl:value-of select="*[local-name()='defaultName']"/>
- </impl:display>
- </xsl:otherwise>
- </xsl:choose>
- <impl:id>
- <xsl:value-of select="*[local-name()='searchPath']"/>
- </impl:id>
- <impl:format>
- <xsl:value-of select="*[local-name()='format']"/>
- </impl:format>
- <impl:locale>
- <xsl:value-of select="*[local-name()='locale']"/>
- </impl:locale>
- </impl:taskLink>
- </xsl:for-each>
- </impl:taskLinksList>
- </xsl:if>
- <xsl:variable name="links" select="/root/*[local-name()='links']/*[local-name()='item']"/>
- <!-- links -->
- <xsl:if test="$links">
- <impl:linksList>
- <xsl:for-each select="$links">
- <impl:link>
- <impl:display>
- <xsl:value-of select="*[local-name()='displayName']"/>
- </impl:display>
- <impl:objectClass>
- <xsl:choose>
- <xsl:when test="*[local-name()='objectClass'] != ''">
- <xsl:value-of select="*[local-name()='objectClass']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>nil</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </impl:objectClass>
- <impl:id>
- <xsl:value-of select="*[local-name()='searchPath']"/>
- </impl:id>
- </impl:link>
- </xsl:for-each>
- </impl:linksList>
- </xsl:if>
- <xsl:variable name="futureTasks" select="/root/*[local-name()='futureTasks']/*[local-name()='futureTask']"/>
- <!-- future tasks -->
- <xsl:if test="$futureTasks and key('param','m_ro_owner_action')='agent' ">
- <impl:futureTaskList>
- <xsl:for-each select="$futureTasks">
- <impl:futureTask>
- <impl:display>
- <xsl:value-of select="*[local-name()='display']"/>
- </impl:display>
- <impl:id>
- <xsl:value-of select="*[local-name()='id']"/>
- </impl:id>
- <impl:taskType>
- <xsl:value-of select="*[local-name()='taskType']"/>
- </impl:taskType>
- </impl:futureTask>
- </xsl:for-each>
- </impl:futureTaskList>
- </xsl:if>
- </xsl:if>
- <xsl:if test="key('param','m_ro_readExpiry_start')='true'">
- <impl:startFor>
- <xsl:text>P</xsl:text>
- <!-- need to add the 'T' designator if specifying a time. In our case we need to resolve minutes or hours-->
- <xsl:if test="key('param','m_ro_readExpireUnit_start')='H' or key('param','m_ro_readExpireUnit_start')='M'">
- <xsl:text>T</xsl:text>
- </xsl:if>
- <xsl:value-of select="key('param','m_ro_readExpireUnitCount_start')"/>
- <xsl:value-of select="key('param','m_ro_readExpireUnit_start')"/>
- </impl:startFor>
- </xsl:if>
- <xsl:if test="key('param','m_ro_readExpiry_due')='true'">
- <impl:completeFor>
- <xsl:text>P</xsl:text>
- <!-- need to add the 'T' designator if specifying a time. In our case we need to resolve minutes or hours-->
- <xsl:if test="key('param','m_ro_readExpireUnit_due')='H' or key('param','m_ro_readExpireUnit_due')='M'">
- <xsl:text>T</xsl:text>
- </xsl:if>
- <xsl:value-of select="key('param','m_ro_readExpireUnitCount_due')"/>
- <xsl:value-of select="key('param','m_ro_readExpireUnit_due')"/>
- </impl:completeFor>
- </xsl:if>
- <xsl:if test="/root/param[@name='m_ro_sub_notifyOnCreation']">
- <impl:notifyOnCreation>
- <xsl:call-template name="makeSubscriptionParam">
- <xsl:with-param name="selected" select="/root/param[@name='m_ro_sub_notifyOnCreation']"/>
- </xsl:call-template>
- </impl:notifyOnCreation>
- </xsl:if>
- <xsl:if test="/root/param[@name='m_ro_sub_notifyNotCompleted']">
- <impl:notifyNotCompleted>
- <xsl:call-template name="makeSubscriptionParam">
- <xsl:with-param name="selected" select="/root/param[@name='m_ro_sub_notifyNotCompleted']"/>
- </xsl:call-template>
- </impl:notifyNotCompleted>
- </xsl:if>
- <xsl:if test="/root/param[@name='m_ro_sub_notifyNotStarted']">
- <impl:notifyNotStarted>
- <xsl:call-template name="makeSubscriptionParam">
- <xsl:with-param name="selected" select="/root/param[@name='m_ro_sub_notifyNotStarted']"/>
- </xsl:call-template>
- </impl:notifyNotStarted>
- </xsl:if>
- <xsl:if test="/root/param[@name='m_ro_sub_notifyOnStateChange_started']">
- <impl:stateChangeStarted>
- <xsl:call-template name="makeSubscriptionParam">
- <xsl:with-param name="selected" select="/root/param[@name='m_ro_sub_notifyOnStateChange_started']"/>
- </xsl:call-template>
- </impl:stateChangeStarted>
- </xsl:if>
- <xsl:if test="/root/param[@name='m_ro_sub_notifyOnStateChange_owner']">
- <impl:stateChangeOwner>
- <xsl:call-template name="makeSubscriptionParam">
- <xsl:with-param name="selected" select="/root/param[@name='m_ro_sub_notifyOnStateChange_owner']"/>
- </xsl:call-template>
- </impl:stateChangeOwner>
- </xsl:if>
- <xsl:if test="/root/param[@name='m_ro_sub_notifyOnStateChange_completed']">
- <impl:stateChangeCompleted>
- <xsl:call-template name="makeSubscriptionParam">
- <xsl:with-param name="selected" select="/root/param[@name='m_ro_sub_notifyOnStateChange_completed']"/>
- </xsl:call-template>
- </impl:stateChangeCompleted>
- </xsl:if>
- <xsl:if test="/root/param[@name='m_ro_sub_notifyOnStateChange_comment']">
- <impl:stateChangeFailed>
- GLOBAL_SUBSCRIBE
- </impl:stateChangeFailed>
- <impl:comments>
- <xsl:call-template name="makeSubscriptionParam">
- <xsl:with-param name="selected" select="/root/param[@name='m_ro_sub_notifyOnStateChange_comment']"/>
- </xsl:call-template>
- </impl:comments>
- </xsl:if>
- <xsl:if test="/root/param[@name='m_ro_sub_notifyOnStateChange_cancelled']">
- <impl:stateChangeCancelled>
- <xsl:call-template name="makeSubscriptionParam">
- <xsl:with-param name="selected" select="/root/param[@name='m_ro_sub_notifyOnStateChange_cancelled']"/>
- </xsl:call-template>
- </impl:stateChangeCancelled>
- </xsl:if>
- <xsl:if test="/root/param[@name='email_subject']">
- <impl:subject xml:lang="en-us">
- <xsl:value-of select="/root/param[@name='email_subject']"/>
- </impl:subject>
- </xsl:if>
- <!-- sort out the body -->
- <xsl:if test="key('param','email_body')!='' ">
- <xsl:call-template name="htmlBody"/>
- </xsl:if>
- </impl:manualTask>
- </xsl:template>
- <xsl:template name="makeSubscriptionParam">
- <xsl:param name="selected"/>
- <xsl:param name="global" select="'true'"/>
-
- <xsl:choose>
- <xsl:when test="$selected = 'true' or $selected = 'checked'">
- <xsl:choose>
- <xsl:when test="$global = 'true'">
- <xsl:text>GLOBAL_SUBSCRIBE</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>INDIVIDUAL_SUBSCRIBE</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$global = 'true'">
- <xsl:text>GLOBAL_UNSUBSCRIBE</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>INDIVIDUAL_UNSUBSCRIBE</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="htmlBody">
- <impl:description xml:lang="en-us" contentType="text/plain">
- <xsl:value-of select="key('param','email_body')"/>
- </impl:description>
- <xsl:variable name="body">
- <xsl:choose>
- <xsl:when test="key('param','hidden_richEditBody') != ''">
- <xsl:value-of select="key('param','hidden_richEditBody')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="key('param','email_body')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- build up a head and meta element to palce in the HTML email. -->
- <xsl:variable name="head">
- <xsl:if test="key('param','richEditMode') = 'true'">
- <xsl:value-of select="'<HEAD><META name="user-entered-html-email-body"></META></HEAD>'"/>
- </xsl:if>
- </xsl:variable>
- <!-- make sure the body has openning and closing BODY and HTML tags -->
- <xsl:variable name="htmlBody">
- <xsl:choose>
- <xsl:when test="starts-with($body,'<HTML')">
- <xsl:value-of select="$body"/>
- </xsl:when>
- <xsl:when test="starts-with($body,'<BODY')">
- <xsl:value-of select="concat('<HTML>',$head, $body,'</HTML>')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('<HTML>', $head, '<BODY>',$body,'</BODY></HTML>')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- if we need to add a link in the body -->
- <xsl:variable name="completeBody">
- <xsl:choose>
- <xsl:when test="key('param','m_ro_emailAsURL')='true' and /root/*[local-name()='requestParams']/*[local-name()='param' and @name='linkToReport']!= ''">
- <xsl:value-of select="substring-before($htmlBody, '</BODY></HTML>')"/>
- <xsl:value-of select="'<BR/>'"/>
- <xsl:value-of select="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='linkToReport']"/>
- <xsl:value-of select="'</BODY></HTML>'"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$htmlBody"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <impl:description xml:lang="en-us" contentType="text/html">
- <xsl:value-of select="$completeBody" disable-output-escaping="yes"/>
- </impl:description>
- </xsl:template>
- </xsl:stylesheet>
|