HP质量中心 - 检索用户名列表

时间:2013-12-09 12:32:17

标签: java hp-quality-center

我希望在HP QC in Java中检索特定项目的扩展用户列表 - 例如,不仅是用户个人号码,还包括用户全名。

//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);
}

此代码仅检索用户个人号码。我该怎么办?

1 个答案:

答案 0 :(得分:0)

答案在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;
}