Dirxml Script Policy Calling An Ecmascript Function - Novell POLICY IN DESIGNER 3.5 - 09-18-2009 Manual

Policies in designer 3.5
Table of Contents

Advertisement

11.3.1 DirXML Script Policy Calling an ECMAScript Function

The DirXML Script policy converts an attribute that is a URL reference to a photo to the Base64
encoded photo data by calling the ECMAScript function getB64ImageFromURL (). The policy can
be used as an Input Transformation or Output Transformation policy.
The function reads an image from a URL and returns the content as a Base64 encoded string.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE policy PUBLIC "policy-builder-
dtd" "C:\Program
Files\Novell\Designer\eclipse\plugins\com.novell.designer.idm.policybuilder_1
.2.0.200612180606\DTD\dirxmlscript.dtd"><policy>
<rule>
<description>Reformat photo from URL to octet</description>
<conditions/>
<actions>
<do-reformat-op-attr name="photo">
<arg-value type="octet">
<token-xpath expression="es:getB64ImageFromURL(string($current-
value))"/>
</arg-value>
</do-reformat-op-attr>
</actions>
</rule>
</policy>
Function:
<static> String getB64ImageFromURL(<String> urlString)
Parameters: urlString (URL of the image file)
Returns: Base64 encoded content of the image (or empty string if error)
The file
ReformatPhoto.xml
getB64ImageFromURL from a DirXML Script policy. The file
phototest.xml)
is a sample input document that shows the policy in action.
Reformat Photo Example
Figure 11-8
(../samples/ReformatPhoto.xml)
calls the ECMAScript function
(../samples/
phototest.xml
Using ECMAScript in Policies 185

Advertisement

Table of Contents
loading

This manual is also suitable for:

Designer for identity manager 3.5

Table of Contents