我希望在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);
}
此代码仅检索用户个人号码。我该怎么办?
答案 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;
}