Article

Neossian's picture
article
Reads:

2631

Score:
5
5
1
 
Comments:

0

Delimited Text Driver - Preserve your precious values

Author Info

9 March 2012 - 11:41am
Submitted by: Neossian

(View Disclaimer)

Overview

If your Delimited Text Driver is processing piecemeal snapshots of identity data, you might encounter the problem where any information not included in an CSV file gets stripped out of the vault. Your precious identity data is going to byte-heaven where-from there is no escape, the Preserve Vault Attribute Values policy is a byte-heaven-fire-exit.

This policy will allow you to selectively preserve attribute data in the vault, but still clear values if necessary by setting the value to ##CLEAR## emphasis not necessary.

Why?

When the delimited text driver is not building an association, it must perform a match and then a merge on all data that is sent through it. If your CSV file is not authoritative for all information, you may have data in eDirectory that will be overwritten by "blank" values - removed - when the merge is completed. Sadly Merge Authority can't figure out which should win, because CSV data is always new data.

How?

Merge Authority will automatically add a bunch of these:

	<modify-attr attr-name="Internet EMail Address">
        <remove-value>
          <value timestamp="1330490932#41" type="string">Your_Precious_Data@Your.Precious.Domain.com</value>
        </remove-value>
    </modify-attr>
	  

to your events. This code just strips them out when you don't want them.

Show me the code

You will need to add a list GCV to contain the attributes to be preserved, list the attributes exactly as they will appear after schema mapping

<?xml version="1.0"?>
<configuration-values>
	<definitions>
		<definition display-name="Preserve eDirectory Attributes" item-separator=";" name="GCV-attrs-to-preserve" type="list">
			<description>List attributes that should be preserved in eDirectory if they are not included in the text driver. Use an attribute value of ##CLEAR## to erase all values.</description>
			<value><item>Given Name</item><item>Full Name</item><item>Surname</item><item>OU</item><item>manager</item></value></definition>
	</definitions>
</configuration-values>

Then you need to add this policy to the Publisher Channel Command Transform Policies

<?xml version="1.0" encoding="UTF-8"?><policy>
	<rule>
		<description>For each attribute in the GCV ensure the eDirectory value is preserved.</description>
		<comment xml:space="preserve">The logic used by this rule is as follows

FOR EACH $Attribute$ IN GCV-attrs-to-Preserve
   $LV-THIS-ATTRIBUTE-VALUE = OperationAttribute($Attribute$)
       IF $LV-THIS-ATTRIBUTE-VALUE = nothing THEN
            STRIPXPATH remove-value parts for $Attribute$
       ELSE
            IF $LV-THIS-ATTRIBUTE-VALUE = "##CLEAR##" THEN
                STRIPXPATH add-value parts for $Attribute$
            END IF
       END IF
   $LV-THIS-ATTRIBUTE-VALUE = ""
NEXT

In this way, the following is accomplished:
New values will replace existing values, blank values will not clear the value, only ##CLEAR## will clear the value.



   </comment>
		<comment name="author" xml:space="preserve">Neossian</comment>
		<comment name="version" xml:space="preserve">0.1</comment>
		<conditions>
			
		</conditions>
		<actions>
			<do-for-each>
				<arg-node-set>
					<token-global-variable name="GCV-attrs-to-preserve"/>
				</arg-node-set>
				<arg-actions>
					<do-set-local-variable name="lv-thisAttributeValue">
						<arg-string>
							<token-op-attr name="$current-node$"/>
						</arg-string>
					</do-set-local-variable>
					<do-if>
						<arg-conditions>
							<and>
								<if-local-variable mode="regex" name="lv-thisAttributeValue" op="not-equal">.+</if-local-variable>
							</and>
						</arg-conditions>
						<arg-actions>
							<do-strip-xpath expression="modify-attr[@attr-name=$current-node]/remove-value"/>
						</arg-actions>
						<arg-actions>
							<do-if>
								<arg-conditions>
									<and>
										<if-local-variable mode="nocase" name="lv-thisAttributeValue" op="equal">##CLEAR##</if-local-variable>
									</and>
								</arg-conditions>
								<arg-actions>
									<do-strip-xpath expression="modify-attr[@attr-name=$current-node]/add-value"/>
								</arg-actions>
							</do-if>
						</arg-actions>
					</do-if>
					<do-set-local-variable name="lv-thisAttributeValue">
						<arg-string>
							<token-text xml:space="preserve"/>
						</arg-string>
					</do-set-local-variable>
				</arg-actions>
			</do-for-each>
		</actions>
	</rule>
</policy>

Good luck kids.


Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

© 2013 Novell