Generating list of user names of some organization

Hi,

I created rule which should return a list of users of organization "Top:Phone Groups". I chose the following solution (maybe this is not the easiest one):

<block trace='true'>

<defvar name='userList'>

<invoke name='getObjectNames' class='com.waveset.ui.FormUtil'>

<ref>:display.session</ref>

<s>User</s>

</invoke>

</defvar>

<defvar name='phoneGroups'>

<list/>

</defvar>

<defvar name='userInfo'/>

<dolist name='userName'>

<ref>userList</ref>

<block trace='true'>

<set name='userInfo'>

<invoke name='getObject' class='com.waveset.ui.FormUtil'>

<ref>:display.session</ref>

<s>User</s>

<ref>userName</ref>

</invoke>

</set>

<cond>

<eq>

<ref>user.waveset.organization</ref>

<s>Top:Phone Groups</s>

</eq>

<set>

<ref>phoneGroups</ref>

<length>

<ref>phoneGroups</ref>

</length>

<ref>user.waveset.accountId</ref>

</set>

</cond>

</block>

</dolist>

<ref>phoneGroups</ref>

</block>

When I run this rule I get null and I get this trace (its truncated):

<Rule name='Get Phone Groups'>

<block trace='true'>

<defvar name='userList'>

</defvar> --> null

<defvar name='phoneGroups'>

</defvar> --> null

<defvar name='userInfo'>

</defvar> --> null

<dolist name='userName'>

<ref>userList</ref>

[<defvar name='userList'>]

<invoke name='getObjectNames' class='com.waveset.ui.FormUtil'>

<ref>:display.session</ref> --> com.waveset.session.LocalSession@1ed2061

<s>User</s> --> User

</invoke> --> [1001, admin, Administrator, config, ecadmin, jminarik, myconfig, Profinit, Profinit SK, ptous, ...truncated...]

[</defvar>] --> [1001, admin, Administrator, config, ecadmin, jminarik, myconfig, Profinit, Profinit SK, ptous, ...truncated...] --> [1001, admin, Administrator, config, ecadmin, jminarik, myconfig, Profinit, Profinit SK, ptous, ...truncated...]

<block trace='true'>

<set name='userInfo'>

<invoke name='getObject' class='com.waveset.ui.FormUtil'>

<ref>:display.session</ref> --> com.waveset.session.LocalSession@1ed2061

<s>User</s> --> User

<ref>userName</ref> --> 1001

</invoke> --> User:1001

</set> --> null

<cond>

<eq>

<ref>user.waveset.organization</ref> --> null

<s>Top:Phone Groups</s> --> Top:Phone Groups

</eq> --> 0

</cond> --> null

</block> --> null

<block trace='true'>

<set name='userInfo'>

<invoke name='getObject' class='com.waveset.ui.FormUtil'>

<ref>:display.session</ref> --> com.waveset.session.LocalSession@1ed2061

<s>User</s> --> User

<ref>userName</ref> --> admin

</invoke> --> User:admin

</set> --> null

<cond>

<eq>

<ref>user.waveset.organization</ref> --> null

<s>Top:Phone Groups</s> --> Top:Phone Groups

</eq> --> 0

</cond> --> null

</block> --> null

</dolist> --> [null, null, null, null, null, null, null, null, null, null, ...truncated...]

<ref>phoneGroups</ref>

[<defvar name='phoneGroups'>]

<list>

</list> --> null

[</defvar>] --> null --> null

</block> --> null

</Rule> --> null

Why the result of the line <ref>user.waveset.organization</ref> (in condition cond) is null?

<ref>user.waveset.organization</ref> --> null

When I change it to <ref>user.waveset</ref>, the trace is still

<ref>user.waveset</ref> --> null

But when I change it to <ref>user</ref>, the trace is for example

<ref>user</ref> --> User:jhouska

Thank a lot

Jindrich Houska

[4254 byte] By [jhouskaa] at [2007-11-27 10:58:00]
# 1

Did u get the user view before using user.waveset.organization in your form?

Swatza at 2007-7-29 12:12:47 > top of Java-index,Web & Directory Servers,Directory Servers...
# 2

Hi, When you call getObject, this returns the xml object of the user.

You cannot use path expressions on the raw xml object, so

expression such as:

<ref>user.waveset.organization</ref>

will not work.

Assuming you are doing this from a workflow,

what you need to do is get the view of the user,

using something like the the getView session workflow service:

<Activity id='2' name='Get View'>

<Comments>Get a read-only view.</Comments>

<Action id='0' name='getView' application='com.waveset.session.WorkflowServices'>

<Argument name='op' value='getView'/>

<Argument name='type' value='User'/>

<Argument name='id' value='$(userName)'/>

<Argument name='Form' value='Empty Form'/>

<Argument name='TargetResources'>

<List>

<String>Lighthouse</String>

</List>

</Argument>

</Action>

<WorkflowEditor x='215' y='511'/>

</Activity>

This code will return a user view in the variable called 'view',

so you can then use path expression such as:

<ref>view.waveset.organization</ref>

I have not tested this particular example, but I hope this works for you.

John I

johnia at 2007-7-29 12:12:47 > top of Java-index,Web & Directory Servers,Directory Servers...