Problem

A Forum reader recently asked:

“Has anyone got the Post Office Record Count piece to work? I am trying to query the record count of 2 or more post offices and place the user in the least populated post office.

I would like to build the the query with policy builder. I have tried the example in the GroupWise docs but keep getting errors. I need to know where to place the query to determine the count and the syntax to facilitate the count.”

And here’s the response from David Gersic …

Solution

It works for me, here. I have a bunch of POs, and we want to keep them all “full” of users. Here’s my Placement rule from the Subscriber channel:

<?xml version="1.0" encoding="UTF-8"?><policy
xmlns:query="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsQueryProcessor">
 <rule>
  <description>User Placement - Top Off PO1</description>
  <conditions>
   <and>
    <if-class-name op="equal">User</if-class-name>
    <if-xpath op="true">query:search($destQueryProcessor, "subtree", "",
"", "User", "50062", "PO1Dev", "Record Count") < 1000</if-xpath>
   </and>
  </conditions>
  <actions>
   <do-set-op-dest-dn>
    <arg-dn>
     <token-text xml:space="preserve">NIU\GW\PO1Dev</token-text>
    </arg-dn>
   </do-set-op-dest-dn>
   <do-break/>
  </actions>
 </rule>
 <rule>
  <description>User Placement - Top Off PO2</description>
  <conditions>
   <and>
    <if-class-name op="equal">User</if-class-name>
    <if-xpath op="true">query:search($destQueryProcessor, "subtree", "",
"", "User", "50062", "PO2Dev", "Record Count") < 1000</if-xpath>
   </and>
  </conditions>
  <actions>
   <do-set-op-dest-dn>
    <arg-dn>
     <token-text xml:space="preserve">NIU\GW\PO2Dev</token-text>
    </arg-dn>
   </do-set-op-dest-dn>
   <do-break/>
  </actions>
 </rule>
 <rule>
  <description>User Placement - Top Off PO3</description>
  <conditions>
   <and>
    <if-class-name op="equal">User</if-class-name>
    <if-xpath op="true">query:search($destQueryProcessor, "subtree", "",
"", "User", "50062", "PO3Dev", "Record Count") < 1000</if-xpath>
   </and>
  </conditions>
  <actions>
   <do-set-op-dest-dn>
    <arg-dn>
     <token-text xml:space="preserve">NIU\GW\PO3Dev</token-text>
    </arg-dn>
   </do-set-op-dest-dn>
   <do-break/>
  </actions>
 </rule>
 <rule>
  <description>User Placement - Top Off PO4</description>
  <conditions>
   <and>
    <if-class-name op="equal">User</if-class-name>
    <if-xpath op="true">query:search($destQueryProcessor, "subtree", "",
"", "User", "50062", "PO4Dev", "Record Count") < 1000</if-xpath>
   </and>
  </conditions>
  <actions>
   <do-set-op-dest-dn>
    <arg-dn>
     <token-text xml:space="preserve">NIU\GW\PO4Dev</token-text>
    </arg-dn>
   </do-set-op-dest-dn>
   <do-break/>
  </actions>
 </rule>
 <rule>
  <description>User Placement - Fill PO5</description>
  <conditions>
   <and>
    <if-class-name op="equal">User</if-class-name>
   </and>
  </conditions>
  <actions>
   <do-set-op-dest-dn>
    <arg-dn>
     <token-text xml:space="preserve">NIU\GW\PO5Dev</token-text>
    </arg-dn>
   </do-set-op-dest-dn>
   <do-break/>
  </actions>
 </rule>
 <rule>
  <description>Group Placement</description>
  <conditions>
   <and>
    <if-class-name op="equal">Group</if-class-name>
    <if-global-variable name="GW.Groups"
op="equal">true</if-global-variable>
   </and>
  </conditions>
  <actions>
   <do-set-op-dest-dn>
    <arg-dn>
     <token-text xml:space="preserve">PO1DEV</token-text>
    </arg-dn>
   </do-set-op-dest-dn>
   <do-break/>
  </actions>
 </rule>
</policy>

And here’s a magic bit of XSLT that I needed to add to my Subscriber Output Transform to make it work:

<?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 -->
 <xsl:template match="search-attr[@attr-name='50062']">
  <search-attr attr-name="50035">
   <value>MailDev</value>
  </search-attr>
  <xsl:copy>
   <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
 </xsl:template>
</xsl:stylesheet>

The magic is that GroupWise needs two attributes in the search query, and I developed this with IDM 3.01, where only one search attribute was supported. This could probably be simplified now with IDM35 and its enhanced search token that can specify multiple search attributes, but I haven’t done that yet.

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.
Loading...Loading...

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Leave a Reply

No Comments
By: dgersic
Jun 27, 2007
10:29 am
Reads:
1,309
Score:
Unrated