本文整理汇总了Java中org.jivesoftware.smackx.ReportedData.Row方法的典型用法代码示例。如果您正苦于以下问题:Java ReportedData.Row方法的具体用法?Java ReportedData.Row怎么用?Java ReportedData.Row使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.ReportedData
的用法示例。
在下文中一共展示了ReportedData.Row方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchUsers
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
/**
* 查询用户
* @param xmppConnection
* @param userName
* @return
* @throws XMPPException
*/
public static List<HashMap<String, String>> searchUsers(XMPPConnection xmppConnection,String userName) {
List<HashMap<String, String>> results = new ArrayList<HashMap<String, String>>();
try {
UserSearchManager usm = new UserSearchManager(xmppConnection);
Form searchForm = usm.getSearchForm(xmppConnection.getServiceName());
Form answerForm = searchForm.createAnswerForm();
answerForm.setAnswer("userAccount", true);
answerForm.setAnswer("userPhote", userName);
ReportedData data = usm.getSearchResults(answerForm, "search" + xmppConnection.getServiceName());
Iterator<ReportedData.Row> it = data.getRows();
while (it.hasNext()) {
HashMap<String, String> user = new HashMap<String, String>();
ReportedData.Row row = it.next();
user.put("userAccount", row.getValues("userAccount").next().toString());
user.put("userPhote", row.getValues("userPhote").next().toString());
results.add(user);
}
} catch (XMPPException e) {
e.printStackTrace();
}
return results;
}
示例2: searchUsers
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
/**
* 查询用户
* @param xmppConnection
* @param userName
* @return
* @throws XMPPException
*/
public static List<HashMap<String, String>> searchUsers(XMPPConnection xmppConnection, String userName) {
List<HashMap<String, String>> results = new ArrayList<HashMap<String, String>>();
try {
UserSearchManager usm = new UserSearchManager(xmppConnection);
Form searchForm = usm.getSearchForm(xmppConnection.getServiceName());
Form answerForm = searchForm.createAnswerForm();
answerForm.setAnswer("userAccount", true);
answerForm.setAnswer("userPhote", userName);
ReportedData data = usm.getSearchResults(answerForm, "search" + xmppConnection.getServiceName());
Iterator<ReportedData.Row> it = data.getRows();
while (it.hasNext()) {
HashMap<String, String> user = new HashMap<String, String>();
ReportedData.Row row = it.next();
user.put("userAccount", row.getValues("userAccount").next().toString());
user.put("userPhote", row.getValues("userPhote").next().toString());
results.add(user);
}
} catch (XMPPException e) {
Log.e("searchUsers", e.getMessage());
e.printStackTrace();
}
return results;
}
示例3: searchUsers
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
/**
* 查找用户
*
* @param
* @param userName
* @return
*/
public List<XmppUser> searchUsers(String userName) {
List<XmppUser> list = new ArrayList<XmppUser>();
UserSearchManager userSearchManager = new UserSearchManager(con);
try {
Form searchForm = userSearchManager.getSearchForm("search."
+ con.getServiceName());
Form answerForm = searchForm.createAnswerForm();
answerForm.setAnswer("Username", true);
answerForm.setAnswer("Name", true);
answerForm.setAnswer("search", userName);
ReportedData data = userSearchManager.getSearchResults(answerForm,
"search." + con.getServiceName());
Iterator<ReportedData.Row> rows = data.getRows();
while (rows.hasNext()) {
XmppUser user = new XmppUser(null, null);
ReportedData.Row row = rows.next();
user.setUserName(row.getValues("Username").next().toString());
user.setName(row.getValues("Name").next().toString());
list.add(user);
}
} catch (XMPPException e) {
SLog.e(tag, Log.getStackTraceString(e));
}
return list;
}
示例4: getFirstValue
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
/**
* Returns the first value found in the ReportedData.Row.
*
* @param row the ReportedData.Row.
* @param key the specified key in the ReportedData.Row.
* @return the first value found in the ReportedData.Row
*/
public String getFirstValue(ReportedData.Row row, String key) {
try {
final Iterator<String> rows = row.getValues(key);
while (rows.hasNext()) {
return rows.next();
}
}
catch (Exception e) {
Log.error("Error retrieving the first value.", e);
}
return null;
}
示例5: ChatSearchResult
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
public ChatSearchResult(ReportedData.Row row, String query) {
UTC_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT+0"));
String startDate = getFirstValue(row, "startDate");
try {
creationDate = UTC_FORMAT.parse(startDate);
}
catch (ParseException e) {
Log.error(e);
}
sessionID = getFirstValue(row, "sessionID");
StringBuffer authors = new StringBuffer();
Iterator athrs = row.getValues("agentJIDs");
while (athrs.hasNext()) {
authors.append((String)athrs.next());
authors.append(" ");
}
String rell = getFirstValue(row, "relevance");
Double o = Double.valueOf(rell);
relevance = ((int)o.doubleValue() * 100);
question = getFirstValue(row, "question");
customerName = getFirstValue(row, "username");
email = getFirstValue(row, "email");
fields.add(customerName);
fields.add(question);
fields.add(email);
fields.add(authors.toString());
fields.add(creationDate);
}
示例6: getFirstValue
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
public String getFirstValue(ReportedData.Row row, String key) {
try {
final Iterator iter = row.getValues(key);
while (iter.hasNext()) {
return (String)iter.next();
}
}
catch (Exception e) {
}
return null;
}