Overview#
We have run into some conditions when we needed to Convert DirXML Document from an ADD to a MODIFY. Some SOAP calls will only do modifies and how could you ever do an ADD on a loopback?Converting an ADD to a MODIFY#
Here is a DirXML Example and XPATH Example for Converting an ADD to a MODIFY:<rule notrace="true"> <description>Convert add to Modify</description> <conditions> <and> <if-operation mode="case" op="equal">add</if-operation> </and> </conditions> <actions> <do-append-xml-element expression=".." name="modify"/> <do-clone-xpath dest-expression="../modify" src-expression="@* | association"/> <do-for-each> <arg-node-set> <token-xpath expression="../add/add-attr"/> </arg-node-set> <arg-actions> <do-append-xml-element expression="../modify" name="modify-attr"/> <do-set-xml-attr expression="../modify/modify-attr[last()]" name="attr-name"> <arg-string> <token-xpath expression="$current-node/@attr-name"/> </arg-string> </do-set-xml-attr> <do-append-xml-element expression="../modify/modify-attr[last()]" name="remove-all-values"/> <do-append-xml-element expression="../modify/modify-attr[last()]" name="add-value"/> <do-append-xml-element expression="../modify/modify-attr[last()]/add-value[last()]" name="value"/> <do-append-xml-text expression="../modify/modify-attr[last()]/add-value[last()]/value"> <arg-string> <token-local-variable name="current-node"/> </arg-string> </do-append-xml-text> </arg-actions> </do-for-each> </actions> </rule>
Converting a SYNC to a MODIFY#
Here is a DirXML Example for Converting a SYNC to a MODIFY:<rule> <description>Convert sync to Modify</description> <comment xml:space="preserve">When a sync with no association, we convert it to a modify. If you want to force a user that is associated, set nwReSync=BLD on the entry. The association will get set later and the nwReSync with a value of BLD will cause the driver to set appropriate 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-07-14</comment> <conditions> <and> <if-operation mode="case" op="equal">sync</if-operation> <if-association op="not-available"/> <if-xpath disabled="true" op="true">association[@state = 'migrate']</if-xpath> </and> </conditions> <actions> <do-append-xml-element expression=".." name="modify"/> <do-clone-xpath dest-expression="../modify" src-expression="@*"/> <do-append-xml-element expression="../modify" name="modify-attr"/> <do-set-xml-attr expression="../modify/modify-attr[last()]" name="attr-name"> <arg-string> <token-text xml:space="preserve">nwReSync</token-text> </arg-string> </do-set-xml-attr> <do-append-xml-element expression="../modify/modify-attr[last()]" name="add-value"/> <do-append-xml-element expression="../modify/modify-attr[last()]/add-value[last()]" name="value"/> <do-append-xml-text expression="../modify/modify-attr[last()]/add-value[last()]/value"> <arg-string> <token-text xml:space="preserve">BLD</token-text> </arg-string> </do-append-xml-text> </actions> </rule>