HP Quality center - Retrieve user names list

727 views Asked by At

I want to retrieve an expanded list of users of a specific project in HP QC in Java - not only user personal number, but also user full name, for example.

//establish connection to a project
IList users = connection.usersList().queryInterface(IList.class);
for (int i = 1; i <= users.count(); i++) {
String user = (String) users.item(i);
System.out.println(user);
}

This code only retrieves user personal numbers. What should I do?

1

There are 1 answers

0
Julia  Chudakova On

The answer was found in QcTools4j-0.2.4.jar.

IList users = connection.usersList().queryInterface(IList.class);
for (int i = 1; i <= users.count(); i++) {
                    String user = users.item(i).toString();
                    ICustomizationUsers localICustomizationUsers = (ICustomizationUsers) (connection.customization().queryInterface(ICustomization.class)).users().queryInterface(ICustomizationUsers.class);
                    ICustomizationUser localICustomizationUser = (ICustomizationUser) localICustomizationUsers.user(user).queryInterface(ICustomizationUser.class);
                    userNames.add(convert(localICustomizationUser));
                }
private String convert(ICustomizationUser paramICustomizationUser) throws ComException {
    String result = paramICustomizationUser.fullName() + "(" + paramICustomizationUser.name() + ")";
    return result;
}