This page (revision-1) was last changed on 29-Nov-2024 16:16 by UnknownAuthor

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 1 added 100 lines
!!! Overview
Usually when using [DirXML], the desire is to make a direct SQL call from the driver to set some values in a Database table.
In this case, we needed to set some values within eDirectory based on a SQL Join. Supposedly this can be done within the "normal" setup of the tables, but on our DB2 instance we were unable to make this work.
The code makes a direct SQL call from the driver and places the, possibly multi-values, into an attribute in eDirectory.
! Change the Conditions
For your use, you will probably need to change the conditions as these were more for demonstrative purposes.
%%information
Be sure to add the [XML namespace] to the policy.
%%
Shows a [DirXML Example] and [XPATH Example] for working with [{$pagename}]:
{{{
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE policy PUBLIC "policy-builder-dtd" "C:\Program Files\Novell\Designer3\Designer\eclipse\plugins\com.novell.idm.policybuilder_3.0.0.200807211539\DTD\dirxmlscript3.5.1.dtd"><policy xmlns:cmd="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsCommandProcessor">
<rule>
<description>Get DB GID</description>
<comment xml:space="preserve">We parse the src-dn to get the primary key in the user table that is used in the following query.</comment>
<conditions>
<and>
<if-src-dn op="available"/>
</and>
</conditions>
<actions>
<do-set-local-variable name="lv-usergid" scope="policy">
<arg-string>
<token-parse-dn dest-dn-format="slash" length="1" src-dn-format="ldap" start="-1">
<token-src-dn convert="false" length="-1"/>
</token-parse-dn>
</arg-string>
</do-set-local-variable>
</actions>
</rule>
<rule>
<description>afSupplierSubClass</description>
<comment xml:space="preserve">A direct SQL statment that populates the vfSupplierSubClass attribute with the possible multiple values from the query.</comment>
<conditions>
<or>
<if-local-variable name="lv-usergid" op="available"/>
</or>
</conditions>
<actions>
<do-if>
<arg-conditions>
<and>
<if-local-variable name="lv-usergid" op="available"/>
</and>
</arg-conditions>
<arg-actions>
<do-trace-message/>
</arg-actions>
<arg-actions>
<do-trace-message color="brred"/>
<do-break/>
</arg-actions>
</do-if>
<do-set-local-variable name="sql-statement" scope="policy">
<arg-string>
<token-text xml:space="preserve">select supplier_class_nam from CORRTEST.so_iam_suppr_class c join CORRTEST.so_iam_usr_suplr_cls_xref x on x.SO_IAM_SUPPR_CLASS_GID = c.SO_IAM_SUPPR_CLASS_GID where so_iam_user_stg_gid=</token-text>
<token-local-variable name="lv-usergid"/>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="query2" scope="policy">
<arg-node-set>
<token-xml-parse>
<token-text xml:space="preserve">&lt;jdbc:statement xmlns:jdbc="urn:dirxml:jdbc">&lt;jdbc:sql></token-text>
<token-xml-serialize>
<token-local-variable name="sql-statement"/>
</token-xml-serialize>
<token-text xml:space="preserve">&lt;/jdbc:sql>&lt;/jdbc:statement></token-text>
</token-xml-parse>
</arg-node-set>
</do-set-local-variable>
<do-set-local-variable name="lv-classresult" scope="policy">
<arg-node-set>
<token-xpath expression="query:query($srcQueryProcessor, $query2)"/>
</arg-node-set>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-xpath expression="$lv-classresult//jdbc:value"/>
</arg-node-set>
<arg-actions>
<do-add-dest-attr-value name="vfSupplierSubClass">
<arg-value>
<token-local-variable name="current-node"/>
</arg-value>
</do-add-dest-attr-value>
</arg-actions>
</do-for-each>
</actions>
</rule>
</policy>
}}}
!! More Information
There might be more information for this subject on one of the following:
[{ReferringPagesPlugin before='*' after='\n' }]