How to use uuid:randomUUID() in policy builder @Novell

327 views Asked by At

I want to use predefined method of java using java.util.UUID:randomUUID() for 046b6c7f-0b8a-43b9-b35d-6489e6daee91 in place of CN, but when i use this code in my policy, then it gives me com\.novell\.xsl\.extensions\.JavaObject@4c7261af in place of CN.

So how can i solve this issue?

Here is my Policy :

<do-set-local-variable name="id1">
    <arg-string>
        <token-xpath expression="java.util.UUID:randomUUID()"/>
    </arg-string>
</do-set-local-variable>
2

There are 2 answers

4
Kalyan Chavali On BEST ANSWER

Try using String.valueOf(id) in place of CN, where id is the random UUID generated.

Regards

0
Norbert Klasen On

You need to use the xpath string() function to convert the UUID object into a string:

<policy xmlns:juuid="http://www.novell.com/nxsl/java/java.util.UUID">
    <rule>
    <description>set lv</description>
    <conditions>
        <and/>
    </conditions>
    <actions>
        <do-set-local-variable name="uuid" scope="policy">
            <arg-string>
                <token-xpath expression="string(juuid:randomUUID())"/>
            </arg-string>
        </do-set-local-variable>
    </actions>
</rule>
</policy>