1

我正在使用适用于 Java 的 Remedy API。如何使用 java 从 Remedy 用户那里获取用户 ID 或用户 GUID?

我使用以下内容进行了简单的登录:

ARServerUser sUser = new ARServerUser("server", "port", "user", "pass", 1);

但是 sUser 对象里面没有任何用户 ID 或 guid 吗?我查看了 API,但找不到检索它的方法。我也尝试过查看 UserInfo 对象,但它也不包含它?

有任何想法吗?谢谢

4

1 回答 1

1

获取用户所有详细信息的示例代码。

ARServerUser arConnection = new ARServerUser("server", "port", "user", "pass", 1);

List<SortInfo> sortList = new ArrayList<SortInfo>();
int firstRetreive = 0;
int maxRetreive = maxNumEntries;//1M
OutputInteger numMatches = new OutputInteger();
ResultEntryList iterator = new ResultEntryList(data);
QualifierInfo qiPlain = new QualifierInfo();

//make field list for results
List<Field> fields = arConnection.getListFieldObjects(formName);
ArrayList<Integer> alFieldIds = new ArrayList<Integer>();
for (int x = 0; x <
   fields.size(); x++) {
   alFieldIds.add(fields.get(x).getFieldID());
}
int[] fieldIds = new int[alFieldIds.size()];
for (int i = 0; i < fieldIds.length; i++) {
  fieldIds[i] = ((Integer) alFieldIds.get(i)).intValue();
}
arConnection.getListEntryObjects("User", qiPlain, firstRetreive, maxRetreive, sortList, fieldIds, false, numMatches, iterator);

如果您只需要 id,则可以跳过所有字段 ID 的检索。不幸的是,我不记得用户名字段的 ID。用它的ID替换xxx)

ARServerUser arConnection = new ARServerUser("server", "port", "user", "pass", 1);

List<SortInfo> sortList = new ArrayList<SortInfo>();
int firstRetreive = 0;
int maxRetreive = maxNumEntries;//1M
OutputInteger numMatches = new OutputInteger();
ResultEntryList iterator = new ResultEntryList(data);
QualifierInfo qiPlain = new QualifierInfo();

//make field list for results
int[] fieldIds = {Constants.AR_CORE_ENTRY_ID, xxx};

arConnection.getListEntryObjects("User", qiPlain, firstRetreive, maxRetreive, sortList, fieldIds, false, numMatches, iterator);
于 2020-02-15T20:35:08.637 回答