I am using the Remedy API for Java. How do I get a User ID or the User GUID from a Remedy User using java?
I do a simple logon using something like the following:
ARServerUser sUser = new ARServerUser("server", "port", "user", "pass", 1);
The sUser object however does not have any userid or guid inside it? I have looked at the API and cannot find a method to retrieve it. I have also tried looking in the UserInfo object, but that also doe not contain it?
Any ideas? Thanks
Sample code to fetch ALL details for a User.
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);
If you just want the ids, you can skip the retrieval of all the field IDs. unfortunately I cannot remember the ID of the username field. Substitute the xxx with its ID)
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);