本文整理汇总了Java中org.jivesoftware.smackx.ReportedData.getRows方法的典型用法代码示例。如果您正苦于以下问题:Java ReportedData.getRows方法的具体用法?Java ReportedData.getRows怎么用?Java ReportedData.getRows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.ReportedData
的用法示例。
在下文中一共展示了ReportedData.getRows方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: searchUsers
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
/**
* 查询用户
*
* @param userName
* @return
* @throws XMPPException
*/
public static List<Session> searchUsers(XMPPConnection mXMPPConnection,String userName) {
List<Session> listUser=new ArrayList<Session>();
try{
UserSearchManager search = new UserSearchManager(mXMPPConnection);
//此处一定要加上 search.
Form searchForm = search.getSearchForm("search."+mXMPPConnection.getServiceName());
Form answerForm = searchForm.createAnswerForm();
answerForm.setAnswer("Username", true);
answerForm.setAnswer("search", userName);
ReportedData data = search.getSearchResults(answerForm,"search."+mXMPPConnection.getServiceName());
Iterator<Row> it = data.getRows();
Row row=null;
while(it.hasNext()){
row=it.next();
Session session=new Session();
session.setFrom(row.getValues("Username").next().toString());
listUser.add(session);
}
}catch(Exception e){
}
return listUser;
}
示例5: userExist
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
boolean userExist(String user, String jid) {
if (ThreadHelper.xmppConnection.isAuthenticated()) {
String service = "search."+ThreadHelper.xmppConnection.getServiceName();
UserSearchManager search = new UserSearchManager(ThreadHelper.xmppConnection);
try {
Form queryForm = search.getSearchForm(service);
Form searchForm = queryForm.createAnswerForm();
searchForm.setAnswer("Username", true);
searchForm.setAnswer("search", user);
ReportedData data = search.getSearchResults(searchForm, service);
Iterator<Row> rows = data.getRows();
while (rows.hasNext()) {
Row row = rows.next();
Iterator<String> jids = row.getValues("jid");
while (jids.hasNext())
if (jids.next().equalsIgnoreCase(jid))
return true;
}
} catch (XMPPException e) {
if (th.D) Log.e(TAG, e.getMessage(), e);
}
}
return false;
}
示例6: searchUsers
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
/**
* �����û�
*
* @param serverDomain
* @param userName
* @return
*/
public List<User> searchUsers(String serverDomain, String userName) {
List<User> list = new ArrayList<User>();
UserSearchManager userSearchManager = new UserSearchManager(connection);
try {
Form searchForm = userSearchManager.getSearchForm("search."
+ serverDomain);
Form answerForm = searchForm.createAnswerForm();
answerForm.setAnswer("Username", true);
answerForm.setAnswer("Name", true);
answerForm.setAnswer("search", userName);
ReportedData data = userSearchManager.getSearchResults(answerForm,
"search." + serverDomain);
Iterator<Row> rows = data.getRows();
while (rows.hasNext()) {
User user = new User();
Row row = rows.next();
user.setUserName(row.getValues("Username").next().toString());
user.setName(row.getValues("Name").next().toString());
SLog.i(tag, user.toString());
list.add(user);
}
} catch (XMPPException e) {
SLog.e(tag, Log.getStackTraceString(e));
}
return list;
}
示例7: searchEjaaberd
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
private void searchEjaaberd() {
// 此处一定要加上 search.
try {
Connection connection = getXmppBinder().getXmppConnection();
UserSearchManager search = new UserSearchManager(connection);
Form searchForm = search.getSearchForm("vjud."
+ connection.getServiceName());
Form answerForm = searchForm.createAnswerForm();
// answerForm.setAnswer("nick", mSearchEditText.getText()
// .toString().trim() + "*");
answerForm.setAnswer("user", mSearchEditText.getText().toString()
.trim() + "*");
// answerForm.setAnswer("search", mSearchEditText.getText()
// .toString().trim());
ReportedData data = search.getSearchResults(answerForm, "vjud."
+ connection.getServiceName());
Iterator<Row> it = data.getRows();
Row row = null;
ArrayList<FriendAddModel> list = new ArrayList<FriendAddModel>();
while (it.hasNext()) {
row = it.next();
String userId = StringUtils.escapeUserResource(row
.getValues("jid").next().toString());
FriendAddModel model = new FriendAddModel(userId);
model.setMsg(userId);
String nick = row.getValues("nick").next().toString();
if (!YiUtils.isStringInvalid(nick)) {
model.setName(nick);
}
XmppVcard vCard = new XmppVcard(getXmppBinder()
.getServiceContext());
vCard.load(connection, model.getMsg());
// 加载用户的个性签名
String sign = vCard.getSign();
if (sign != null && sign.length() > 0) {
if (model.getSubMsg().length() > 1) {
sign = ' ' + sign;
}
model.setSubMsg(model.getSubMsg() + sign);
}
list.add(model);
}
Message message = getHandler().obtainMessage(MSG_ON_SEARCH_SUCCESS,
list);
message.sendToTarget();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
示例8: searchOpenfire
import org.jivesoftware.smackx.ReportedData; //导入方法依赖的package包/类
private void searchOpenfire() {
// 此处一定要加上 search.
try {
Connection connection = getXmppBinder().getXmppConnection();
UserSearchManager search = new UserSearchManager(connection);
Form searchForm = search.getSearchForm("search."
+ connection.getServiceName());
Form answerForm = searchForm.createAnswerForm();
answerForm.setAnswer("Username", true);
answerForm.setAnswer("search", mSearchEditText.getText().toString()
.trim());
ReportedData data = search.getSearchResults(answerForm, "search."
+ connection.getServiceName());
Iterator<Row> it = data.getRows();
Row row = null;
ArrayList<FriendAddModel> list = new ArrayList<FriendAddModel>();
while (it.hasNext()) {
row = it.next();
String userId = row.getValues("Username").next().toString()
+ "@" + XmppConnectionUtils.getXmppHost();
FriendAddModel model = new FriendAddModel(userId);
model.setMsg(userId);
model.setName(row.getValues("Name").next().toString());
XmppVcard vCard = new XmppVcard(getXmppBinder()
.getServiceContext());
vCard.load(connection, userId);
// 加载用户的个性签名
String sign = vCard.getSign();
if (sign != null && sign.length() > 0) {
if (model.getSubMsg().length() > 1) {
sign = ' ' + sign;
}
model.setSubMsg(model.getSubMsg() + sign);
}
list.add(model);
}
Message message = getHandler().obtainMessage(MSG_ON_SEARCH_SUCCESS,
list);
message.sendToTarget();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}