protected void parseItems(XmlPullParser parser) throws XmlPullParserException, IOException { ReportedData data = new ReportedData(); data.addColumn(new ReportedData.Column("JID", "jid", FormField.Type.text_single)); data.addRow(row); for (ReportedData.Column column : data.getColumns()) { if (column.getVariable().equals(name)) { exists = true; data.addColumn(column);
/** * Sends the filled out answer form to be sent and queried by the search service. * * @param con the current XMPPConnection. * @param searchForm the <code>Form</code> to send for querying. * @param searchService the search service to use. (ex. search.jivesoftware.com) * @return ReportedData the data found from the query. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, DomainBareJid searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { UserSearch search = new UserSearch(); search.setType(IQ.Type.set); search.setTo(searchService); search.addExtension(searchForm.getDataFormToSend()); IQ response = con.createStanzaCollectorAndSend(search).nextResultOrThrow(); return ReportedData.getReportedDataFrom(response); }
for ( final Column column : data.getColumns() ) { String label = column.getLabel(); columnList.add(label); for ( final Row row : data.getRows() ) { modelList = new ArrayList<>(); for (int i = 0; i < resultsTable.getColumnCount(); i++) { String tableValue = (String)resultsTable.getTableHeader().getColumnModel().getColumn(i).getHeaderValue(); for ( final Column column : data.getColumns() ) { if (column.getLabel().equals(tableValue)) { tableValue = column.getVariable();
public Boolean checkIfUserExists(String user) throws XMPPException{ UserSearchManager search = new UserSearchManager(xmppConnection); Form searchForm = search.getSearchForm("search."+xmppConnection.getServiceName()); Form answerForm = searchForm.createAnswerForm(); answerForm.setAnswer("Username", true); answerForm.setAnswer("search", user); ReportedData data = search.getSearchResults(answerForm,"search."+xmppConnection.getServiceName()); if (data.getRows() != null) { Iterator<Row> it = data.getRows(); while (it.hasNext()) { Row row = it.next(); Iterator iterator = row.getValues("jid"); if (iterator.hasNext()) { String value = iterator.next().toString(); System.out.println("Iteartor values...... " + value); } } return true; } return false; }
/** * Returns a new ReportedData if the stanza is used for reporting data and includes an * extension that matches the elementName and namespace "x","jabber:x:data". * * @param packet the stanza used for reporting data. * @return ReportedData from the packet if present, otherwise null. */ public static ReportedData getReportedDataFrom(Stanza packet) { // Check if the packet includes the DataForm extension DataForm dataForm = DataForm.from(packet); if (dataForm != null) { if (dataForm.getReportedData() != null) return new ReportedData(dataForm); } // Otherwise return null return null; }
for ( ReportedData.Column column : data.getColumns() ) { String label = column.getLabel(); columnnames.add(label); for (ReportedData.Row row : data.getRows() ) { if (!row.getValues(columnnames.get(0)).isEmpty()) { String s = row.getValues(columnnames.get(0))
UserSearchManager usm= new UserSearchManager(xmpp.getConnection()); Form searchForm = usm.getSearchForm("search." +xmpp.getConnection().getServiceName()); Form answerForm = searchForm.createAnswerForm(); answerForm.setAnswer("Username", true); answerForm.setAnswer("search", userName); ReportedData data = usm .getSearchResults(answerForm, "search." + xmpp.getConnection().getServiceName()); if (data.getRows() != null) { for (ReportedData.Row row: data.getRows()) { for (String jid:row.getValues("jid")) { System.out.println(jid); } } }
/** * Submits the completed form and returns the result of the transcript search. The result * will include all the data returned from the server so be careful with the amount of * data that the search may return. * * @param serviceJID the address of the workgroup service. * @param completedForm the filled out search form. * @return the result of the transcript search. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public ReportedData submitSearch(DomainBareJid serviceJID, Form completedForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { TranscriptSearch search = new TranscriptSearch(); search.setType(IQ.Type.get); search.setTo(serviceJID); search.addExtension(completedForm.getDataFormToSend()); TranscriptSearch response = connection.createStanzaCollectorAndSend( search).nextResultOrThrow(); return ReportedData.getReportedDataFrom(response); } }
List<ReportedData.Row> rows = results.getRows(); for (ReportedData.Row row : rows) { Log.d("***", "row: " + row.getValues("Username").toString());