Novell Home

Setting IDM Transaction Status

Novell Cool Solutions: Tip
By David Gersic

Digg This - Slashdot This

Posted: 17 Jan 2007
 

Problem

A Forum reader recently asked:

"I have a case where I need to veto a synthetic add in the PeopleSoft driver. (I'm using PS Driver version 4.0.5 running on IDM 2.0.10.61647.) I can recognize and veto the operation without issue. Setting the status of the PeopleSoft transaction following a veto is the problem.

What I would like to do is set the status of the transaction something other than "In Process". As far as I'm concerned, the operation was a "Success" or "Cancelled" - anything but "In Process" (or "Error").

I've tried setting the status to "Success" and then vetoing the op in the Event Policy set in the Publisher Channel. The op is a modify at this point; the synthetic add has not yet been generated. The "success" is reported in the trace but the subsequent veto kills everything from that point on.

No matter what I try, the veto action whacks everything in the <input> portion of the document. I do see policies being evaluated after the veto, but there is nothing to evaluate; all it has to evaluate for input is <input/>.

Any ideas on how to set the PS transaction status after a "successful" veto? I'm pretty sure I know what to send to PS to set the status as I wish. Or should I use something other than "do-veto" to stop the operaton?

And here's the response from David Gersic ...

Solution

Once you veto() it, it's gone. But, if you just change the status, the event dies, and you can use that instead. I'm doing it here with these two bits of code.

First, on the Publisher Command Transform, I have this:

<?xml version="1.0" encoding="UTF-8"?><policy>
 <rule>
  <description>Veto Operation if niuAccountLockout is
found</description>
  <conditions>
   <and>
    <if-dest-attr name="niuAccountLockout" op="available"/>
   </and>
  </conditions>
  <actions>
   <do-status level="retry">
    <arg-string>
     <token-text xml:space="preserve"
xmlns:xml="http://www.w3.org/XML/1998/namespace">Operation blocked by
niuAccountLockout</token-text>
    </arg-string>
   </do-status>
  </actions>
 </rule>
</policy>

This blocks all <modify> events to objects with the "niuAccountLockout" attribute on them. Then, on the Subscriber Output Transform, I have the following bit of XSLT that turns the "retry" in to a "warning" status going in to the PeopleSoft transaction table for this event:

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet
exclude-result-prefixes="query cmd dncv" version="1.0"
xmlns:cmd="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsCommandProcessor"
xmlns:dncv="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.DNConverter"
xmlns:query="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsQueryProcessor"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <!-- parameters passed in from the DirXML engine -->
 <xsl:param name="srcQueryProcessor"/>
 <xsl:param name="destQueryProcessor"/>
 <xsl:param name="srcCommandProcessor"/>
 <xsl:param name="destCommandProcessor"/>
 <xsl:param name="dnConverter"/>
 <xsl:param name="fromNds"/>
 <!-- identity transformation template -->
 <!-- in the absence of any other templates this will cause -->
 <!-- the stylesheet to copy the input through unchanged to the output
-->
 <xsl:template match="node()|@*">
  <xsl:copy>
   <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
 </xsl:template>
 <!-- add your custom templates here -->
 <!--
*************************************************************************************
* 16 February 2006 - dgersic
* Turn a return status of "retry" in to a return status of "warning" if the retry
* was issued by the Pub Command Transform policy used to implement
niuAccountLockout.
*************************************************************************************
-->
 <xsl:template match="output">
  <output>
   <xsl:choose>
    <xsl:when test="status[@level='retry']">
     <xsl:variable name="msg">
      <xsl:value-of select="status/text()"/>
     </xsl:variable>
     <xsl:choose>
      <xsl:when test="contains($msg,'niuAccountLockout')">
       <xsl:message>Operation blocked by
niuAccountLockout.</xsl:message>
       <status level="warning"/>
      </xsl:when>
      <xsl:otherwise>
       <xsl:apply-templates select="node()"/>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
     <xsl:apply-templates select="@*|node()"/>
    </xsl:otherwise>
   </xsl:choose>
  </output>
 </xsl:template>
 <!--
*************************************************************************************
* End of niuAccountLockout XSLT transform
*************************************************************************************
-->
</xsl:stylesheet>

I haven't tried it, at least not that I remember, but you could probably put any of the valid status codes in there if you don't want "warning". I went with "warning" because it seemed to be unused for anything else, and since I wanted the transactions that I'm blocking to be really easy to spot in the transaction table if I need to go find them again. "Warning" as a status also seemed to make sense, since this would be an otherwise valid transaction that's being blocked by an overriding policy from our security people.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell