public static Collection<String> getWorkgroups(Jid serviceJID, Jid agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { AgentWorkgroups request = new AgentWorkgroups(agentJID); request.setTo(serviceJID); AgentWorkgroups response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow(); return response.getWorkgroups(); }
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, Connection connection) throws XMPPException { AgentWorkgroups request = new AgentWorkgroups(agentJID); request.setTo(serviceJID); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID())); // Send the request connection.sendPacket(request); AgentWorkgroups response = (AgentWorkgroups)collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return response.getWorkgroups(); }
@Override public AgentWorkgroups parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { final Jid agentJID = ParserUtils.getJidAttribute(parser); List<String> workgroups = new ArrayList<>(); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("workgroup")) { workgroups.add(parser.getAttributeValue("", "jid")); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("workgroups")) { done = true; } } } return new AgentWorkgroups(agentJID, workgroups); } }
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, Connection connection) throws XMPPException { AgentWorkgroups request = new AgentWorkgroups(agentJID); request.setTo(serviceJID); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID())); // Send the request connection.sendPacket(request); AgentWorkgroups response = (AgentWorkgroups)collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return response.getWorkgroups(); }
public IQ parseIQ(XmlPullParser parser) throws Exception { String agentJID = parser.getAttributeValue("", "jid"); List<String> workgroups = new ArrayList<String>(); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("workgroup")) { workgroups.add(parser.getAttributeValue("", "jid")); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("workgroups")) { done = true; } } } return new AgentWorkgroups(agentJID, workgroups); } }
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, Connection connection) throws XMPPException { AgentWorkgroups request = new AgentWorkgroups(agentJID); request.setTo(serviceJID); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID())); // Send the request connection.sendPacket(request); AgentWorkgroups response = (AgentWorkgroups)collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return response.getWorkgroups(); }
public IQ parseIQ(XmlPullParser parser) throws Exception { String agentJID = parser.getAttributeValue("", "jid"); List<String> workgroups = new ArrayList<String>(); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("workgroup")) { workgroups.add(parser.getAttributeValue("", "jid")); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("workgroups")) { done = true; } } } return new AgentWorkgroups(agentJID, workgroups); } }
public IQ parseIQ(XmlPullParser parser) throws Exception { String agentJID = parser.getAttributeValue("", "jid"); List<String> workgroups = new ArrayList<String>(); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("workgroup")) { workgroups.add(parser.getAttributeValue("", "jid")); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("workgroups")) { done = true; } } } return new AgentWorkgroups(agentJID, workgroups); } }