Skip to Content
author's profile photo Former Member
Former Member

UME search for users code problem

Hello All ,

i am trying to develop an iview that contains a textbox that get a part of a userName or User display name and search using UME api`s i wrote the following code:

public void onSubmit (Event event)throws UMException

{

IPortalComponentResponse response = (IPortalComponentResponse)this.getResponse();

IPortalComponentRequest request = (IPortalComponentRequest)this.getRequest();

IUserFactory userFactory = UMFactory.getUserFactory();

IUserSearchFilter sf =userFactory.getUserSearchFilter();

sf.setDisplayName("p*",1,true);

ISearchResult sr = userFactory.searchUsers(sf);

if (sr != null) {

String uniqueId = (String) sr.next();

IUser user = userFactory.getMutableUser(uniqueId);

int i = sr.size();

Vector users = new Vector();

IUserFactory userFact = UMFactory.getUserFactory();

while (i>=0) {

IUser usr = null;

usr = userFact.getUser("diana");

users.addElement(usr);

i=i-1;

}

}

}

but i get stuck when i am trying to iterate thro the result set can any one enlighten my eyes of what i am doing wrong or about the right way to approach the Problem

Thanks

Ronen

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Dec 15, 2004 at 02:04 PM

    Hi Ronen,

    first, to make code more readable, please use [ code ] and [/ code ] (without the spaces) to format pure code.

    ISearchResult is to be used like every other Iterator, so:

    ISearchResult sr = userFactory.searchUsers(sf);
    ArrayList users = new ArrayList(); /* instead of Vector! */
    while (sr.hasNext()) {
      String uniqueId = (String) sr.next(); /* if this is the case, I don't know */
      IUser user = userFactory.getMutableUser(uniqueId);
      users.add(user);
    }
    

    Hope it helps

    Detlev

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Ronen,

      (a) what kind of error do you get?

      (b) at which line?

      (c) are you sure that sr.next() returns a String? (I just copied this from yours.) If not, test this: System.out.println("ClassTest: " + sr.next().getClass().getName());

      (d) If it returns a String, is this really the uniqueID?

      One of these should help you...

      Best regards

      Detlev

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.