use of org.jivesoftware.smackx.ReportedData.Row in project ecf by eclipse.
the class XMPPUserSearchManager method createResultList.
/**
* Create a result list from ReportedData. Identify dynamically columns and
* rows and create users adding it to a {@link IResultList}
*
* @param data
* ReportedData
* @return {@link IResultList} a list of users
* @throws
*/
protected IResultList createResultList(ReportedData data) {
ResultList result = new ResultList();
Iterator rows = data.getRows();
while (rows.hasNext()) {
Row row = (Row) rows.next();
Iterator jids = row.getValues(JID);
Iterator names = row.getValues(NAME);
String jid = null;
String name = null;
// XMPP server returns the same length for both
while (jids.hasNext() && names.hasNext()) {
try {
jid = (String) jids.next();
name = (String) names.next();
IUser user = new User(new XMPPID(connectNamespace, jid), name);
result.add(new XMPPResultItem(user));
} catch (URISyntaxException e) {
throw new RuntimeException(// $NON-NLS-1$
"cannot create connect id for client " + jid + " , name = " + name, // $NON-NLS-1$
e);
}
}
}
return result;
}
Aggregations