Welcome to Cool Solutions
Reformat Operation Attribute
There is a powerful token verb in DirXML Script - it's the reformat operation attribute. Here is an example of taking Full Name as an operational attribute and replacing it with LAST,FIRST:
reformat operation attribute("Full Name",Uppercase(Attribute("Surname")+","+Attribute("Given Name"))
The problem is, you might expect this verb to just edit the XML document and replace one string with the other. Unfortunately, what it does instead is a Remove-all-values, then re-adds it to the document. This is actualy working as designed; it is just not as useful in the way it operates as you might hope from the name of the token.
This is probably not what you want to do most of the time.
[12/12/07 17:11:42.119]:APPX ST: Applying rule '[acme] Reformat Full Name on every operation.'.
[12/12/07 17:11:42.120]:APPX ST: Action: do-reformat-op-attr("Full Name",token-upper-case(token-attr("Surname")+","+token-attr("Given Name"))).7 17:11:42.123]:APPX ST: arg-string(token-upper-case(token-attr("Surname")+","+token-attr("Given Name")))
[12/12/07 17:11:42.126]:APPX ST: token-upper-case(token-attr("Surname")+","+token-attr("Given Name"))
[12/12/07 17:11:42.127]:APPX ST: token-upper-case(token-attr("Surname")+","+token-attr("Given Name"))
[12/12/07 17:11:42.129]:APPX ST: token-attr("Surname")
[12/12/07 17:11:42.130]:APPX ST: Query from policy
[12/12/07 17:11:42.131]:APPX ST:
<nds dtdversion="3.5" ndsversion="8.x">
<source>
<product version="3.5.2.20070719 ">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<input>
<query class-name="User" dest-dn="\ACMEIDVAULT\acme\employees\active\JSmith" dest-entry-id="41891" scope="entry">
<read-attr attr-name="Given Name"/>
<read-attr attr-name="Surname"/>
</query>
</input>
</nds>
[12/12/07 17:11:42.139]:APPX ST: Pumping XDS to eDirectory.
[12/12/07 17:11:42.140]:APPX ST: Performing operation query for \ACMEIDVAULT\acme\employees\active\JSmith.
[12/12/07 17:11:42.144]:APPX ST: Query from policy result
[12/12/07 17:11:42.146]:APPX ST:
<nds dtdversion="3.5" ndsversion="8.x">
<source>
<product version="3.5.2.20070719 ">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<output>
<instance class-name="User" qualified-src-dn="O=acme\OU=employees\OU=active\CN=JSmith" src-dn="\ACMEIDVAULT\acme\employees\active\JSmith" src-entry-id="41891">
<association state="associated">E104038</association>
<attr attr-name="Given Name">
<value timestamp="1189236477#111" type="string">Elizabeth</value>
</attr>
<attr attr-name="Surname">
<value timestamp="1189236477#107" type="string">Smith</value>
</attr>
</instance>
<status level="success"></status>
</output>
</nds>
[12/12/07 17:11:42.158]:APPX ST: Token Value: "Smith".
[12/12/07 17:11:42.160]:APPX ST: token-text(",")
[12/12/07 17:11:42.162]:APPX ST: token-attr("Given Name")
[12/12/07 17:11:42.163]:APPX ST: Token Value: "Elizabeth".
[12/12/07 17:11:42.162]:APPX ST: Arg Value: "Smith,Elizabeth".
[12/12/07 17:11:42.164]:APPX ST: Token Value: "SMITH,ELIZABETH".
[12/12/07 17:11:42.164]:APPX ST: Arg Value: "SMITH,ELIZABETH".
<nds dtdversion="3.5" ndsversion="8.x">
<source>
<product version="3.5.2.20070719 ">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<input>
<modify class-name="User" event-id="PK_SEQUENCE=351744,table=CLIENTS,schema=IDM" from-merge="true" qualified-src-dn="O=acme\OU=employees\OU=active\CN=JSmith" src-dn="\ACMEIDVAULT\acme\employees\active\JSmith" src-entry-id="41891">
<association>E104038</association>
<modify-attr attr-name="APPXUser">
<remove-all-values/>
</modify-attr>
<modify-attr attr-name="OU">
<remove-all-values/>
</modify-attr>
<modify-attr attr-name="Full Name">
<remove-all-values/>
</modify-attr>
<modify-attr attr-name="OU">
<add-value>
<value timestamp="1189236477#105" type="string">Customer Service</value>
</add-value>
</modify-attr>
<modify-attr attr-name="Full Name">
<add-value>
<value type="string">SMITH,ELIZABETH</value>
</add-value>
</modify-attr>
</modify>
</input>
</nds>
What you probably want to do instead is a
Strip XPATH Expression of modify-attr[@attr-name="Full Name"]/value/text() - then an Append XML Text of the local variable as the string, to the XPATH of modify-attr[@attr-name="Full Name"]/value.
Or something like this code snippet:
<rule>
<description>Better than ReFormat Op Attr</description>
<conditions>
<and>
<if-op-attr name="Full Name" op="available"/>
</and>
</conditions>
<actions>
<do-set-local-variable name="LASTthenFIRST" scope="policy">
<arg-string>
<token-attr name="Surname"/>
<token-text xml:space="preserve">,</token-text>
<token-attr name="Given Name"/>
</arg-string>
</do-set-local-variable>
<do-strip-xpath expression='modify-attr[@attr-name="Full Name"/value/text()'/>
<do-append-xml-text expression='modify-attr[@attr-name="Full Name"/value/'>
<arg-string>
<token-local-variable name="LASTthenFIRST"/>
</arg-string>
</do-append-xml-text>
</actions>
</rule>
- To leave a comment you need to Login or Register
- 491 reads

Print
Email
RSS
Digg
Slashdot
Recent comments
1 day 4 hours ago
1 day 8 hours ago
46 weeks 2 days ago
46 weeks 2 days ago
46 weeks 4 days ago
46 weeks 5 days ago
47 weeks 1 day ago
1 year 40 weeks ago
1 year 41 weeks ago
1 year 41 weeks ago