user3441151
user3441151

Reputation: 1910

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

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>

Upvotes: 2

Views: 334

Answers (2)

Norbert Klasen
Norbert Klasen

Reputation: 1

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>

Upvotes: 0

Kalyan Chavali
Kalyan Chavali

Reputation: 1348

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

Regards

Upvotes: 1

Related Questions