!!! Overview
We show a [DirXML Example] of the [Modify-association] token taken from a "Real-Life" condition.
!! Scenario
Client uses a self generated printable [UUID] as nwGUID to track the entries across the enterprise. Normally the nwGUID values would not change, however, there was a business case put forward when there was a need for some entries to be changed.
The Modify-association] token is documented, but not exposed in [Designer] or [Imanager].
We [found an example|https://forums.netiq.com/showthread.php?616-Associations-in-JDBC-driver|target='_blank'] and made some minor modifications to fit the client.
If you read the description for the [Modify-association] token it is only recognized by the [DirXML Engine]. So the [Modify-association] token must be sent on the [Publisher Channel] to the engine.
As in our case, all of the logic in the driver took place on the Subscriber, we needed a method to
!! OTP
Code for Rule:
%%prettify
{{{
<rule>
<description>Check for Modify Association Data on Success</description>
<comment xml:space="preserve">Works with "OTP:Catch Association Changes". We clone the operational data into the Publisher channel and send it to the Engine when will then properly update the Association Values</comment>
<comment name="author" xml:space="preserve">jim@willeke.com </comment>
<comment name="version" xml:space="preserve">1</comment>
<comment name="lastchanged" xml:space="preserve">2014-09-08</comment>
<conditions>
<and>
<if-operation mode="case" op="equal">status</if-operation>
<if-xml-attr mode="nocase" name="level" op="equal">success</if-xml-attr>
<if-xpath op="true">operation-data/modify-association</if-xpath>
</and>
</conditions>
<actions>
<do-clone-xpath dest-expression=".." src-expression="operation-data/modify-association"/>
</actions>
</rule>
}}} /%
Trace:
%%prettify
{{{
[09/08/14 09:12:11.375]:bld ST:Applying output transformation policies.
[09/08/14 09:12:11.376]:bld ST:Applying policy: %+C%14CCatch Association Changes%-C.
[09/08/14 09:12:11.376]:bld ST: Applying to modify #1.
[09/08/14 09:12:11.376]:bld ST: Evaluating selection criteria for rule 'Detect Modify Assoc'.
[09/08/14 09:12:11.377]:bld ST: (if-operation equal "modify") = TRUE.
[09/08/14 09:12:11.377]:bld ST: (if-class-name equal "User") = TRUE.
[09/08/14 09:12:11.377]:bld ST: (if-op-attr 'nwGUID' changing-to ".+") = TRUE.
[09/08/14 09:12:11.378]:bld ST: Rule selected.
[09/08/14 09:12:11.378]:bld ST: Applying rule 'Detect Modify Assoc'.
[09/08/14 09:12:11.378]:bld ST: Action: do-append-xml-element("operation-data",".").
[09/08/14 09:12:11.379]:bld ST: Action: do-append-xml-element("modify-association","operation-data").
[09/08/14 09:12:11.379]:bld ST: Action: do-append-xml-element("association","operation-data/modify-association[last()]").
[09/08/14 09:12:11.380]:bld ST: Action: do-append-xml-text("operation-data/modify-association[last()]/association",token-association()).
[09/08/14 09:12:11.380]:bld ST: arg-string(token-association())
[09/08/14 09:12:11.381]:bld ST: token-association()
[09/08/14 09:12:11.381]:bld ST: Token Value: "b6d951dc-3759-11e4-8dd8-b7f13fbde3c8".
[09/08/14 09:12:11.381]:bld ST: Arg Value: "b6d951dc-3759-11e4-8dd8-b7f13fbde3c8".
[09/08/14 09:12:11.382]:bld ST: Action: do-append-xml-element("association","operation-data/modify-association[last()]").
[09/08/14 09:12:11.382]:bld ST: Action: do-append-xml-text("operation-data/modify-association[last()]/association[last()]",token-op-attr("nwGUID")).
[09/08/14 09:12:11.383]:bld ST: arg-string(token-op-attr("nwGUID"))
[09/08/14 09:12:11.383]:bld ST: token-op-attr("nwGUID")
[09/08/14 09:12:11.384]:bld ST: Token Value: "b8eb900d-3759-11e4-8dd8-b7f13fbde3c8".
[09/08/14 09:12:11.384]:bld ST: Arg Value: "b8eb900d-3759-11e4-8dd8-b7f13fbde3c8".
[09/08/14 09:12:11.384]:bld ST:Policy returned:
[09/08/14 09:12:11.385]:bld ST:
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product edition="Standard" version="4.0.2.1">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<input>
<modify cached-time="20140908131211.096Z" class-name="User" event-id="PIDV07#20140908131211#10#1:a2647ca7-dce2-4221-598c-a77c64a2e2dc" qualified-src-dn="dc=pilot\dc=willeke\OU=people\OU=Ext\OU=B2B\OU=sales\uniqueID=johnj41" src-dn="\NWPILOT\pilot\willeke\people\Ext\B2B\sales\johnj41" src-entry-id="255228" timestamp="1410181926#2">
<association state="associated">b6d951dc-3759-11e4-8dd8-b7f13fbde3c8</association>
<modify-attr attr-name="nwGUID">
<remove-value>
<value timestamp="1410181919#34" type="string">b6d951dc-3759-11e4-8dd8-b7f13fbde3c8</value>
</remove-value>
<add-value>
<value timestamp="1410181926#2" type="string">b8eb900d-3759-11e4-8dd8-b7f13fbde3c8</value>
</add-value>
</modify-attr>
<operation-data>
<modify-association>
<association>b6d951dc-3759-11e4-8dd8-b7f13fbde3c8</association>
<association>b8eb900d-3759-11e4-8dd8-b7f13fbde3c8</association>
</modify-association>
</operation-data>
</modify>
</input>
</nds>
}}} /%
! ITP
Code for Rule:
%%prettify
{{{
<rule>
<description>UpdateAssoc on Success</description>
<comment xml:space="preserve">Works with OTP Catch Association Changes</comment>
<comment name="author" xml:space="preserve">jim@willeke.com </comment>
<comment name="version" xml:space="preserve">1</comment>
<comment name="lastchanged" xml:space="preserve">2014-09-08</comment>
<conditions>
<and>
<if-operation mode="case" op="equal">status</if-operation>
<if-xml-attr mode="nocase" name="level" op="equal">success</if-xml-attr>
<if-xpath op="true">operation-data/modify-association</if-xpath>
</and>
</conditions>
<actions>
<do-clone-xpath dest-expression=".." src-expression="operation-data/modify-association"/>
</actions>
</rule>
}}} /%
%%prettify
{{{
[09/08/14 09:12:11.450]:bld ST:Applying policy: %+C%14CModify-Association%-C.
[09/08/14 09:12:11.450]:bld ST: Applying to status #1.
[09/08/14 09:12:11.450]:bld ST: Evaluating selection criteria for rule 'UpdateAssoc on Success'.
[09/08/14 09:12:11.451]:bld ST: (if-operation equal "status") = TRUE.
[09/08/14 09:12:11.451]:bld ST: (if-xml-attr 'level' equal "success") = TRUE.
[09/08/14 09:12:11.452]:bld ST: (if-xpath true "operation-data/modify-association") = TRUE.
[09/08/14 09:12:11.452]:bld ST: Rule selected.
[09/08/14 09:12:11.452]:bld ST: Applying rule 'UpdateAssoc on Success'.
[09/08/14 09:12:11.453]:bld ST: Action: do-clone-xpath(dest-expression="..",src-expression="operation-data/modify-association").
[09/08/14 09:12:11.453]:bld ST:Policy returned:
[09/08/14 09:12:11.454]:bld ST:
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product edition="Standard" version="4.0.2.1">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<output>
<status event-id="PIDV07#20140908131211#10#1:a2647ca7-dce2-4221-598c-a77c64a2e2dc" level="success"><application>DirXML</application>
<module>BLD</module>
<object-dn>\NWPILOT\pilot\willeke\people\Ext\B2B\sales\johnj41 (pilot\willeke\people\Ext\B2B\sales\johnj41)</object-dn>
<component>Publisher</component>
<operation-data>
<modify-association>
<association>b6d951dc-3759-11e4-8dd8-b7f13fbde3c8</association>
<association>b8eb900d-3759-11e4-8dd8-b7f13fbde3c8</association>
</modify-association>
</operation-data>
</status>
<modify-association>
<association>b6d951dc-3759-11e4-8dd8-b7f13fbde3c8</association>
<association>b8eb900d-3759-11e4-8dd8-b7f13fbde3c8</association>
</modify-association>
</output>
</nds>
[09/08/14 09:12:11.459]:bld ST:No schema mapping policies.
[09/08/14 09:12:11.459]:bld ST:Resolving association references.
[09/08/14 09:12:11.459]:bld ST:Processing returned document.
[09/08/14 09:12:11.460]:bld ST:Processing operation <status> for .
[09/08/14 09:12:11.460]:bld ST:
DirXML Log Event -------------------
Driver: \NWPILOT\pilot\willeke\esc\DirXML\NWDriverSet\BLD
Channel: Subscriber
Object: \NWPILOT\pilot\willeke\people\Ext\B2B\sales\johnj41
Status: Success
Message: <application>DirXML</application>
<module>BLD</module>
<object-dn>\NWPILOT\pilot\willeke\people\Ext\B2B\sales\johnj41 (pilot\willeke\people\Ext\B2B\sales\johnj41)</object-dn>
<component>Publisher</component>
[09/08/14 09:12:11.462]:bld ST:Processing operation <modify-association> for .
[09/08/14 09:12:11.467]:bld ST:End transaction.
}}} /%
!! More Information
There might be more information for this subject on one of the following:
[{ReferringPagesPlugin before='*' after='\n' }]