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 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 static Collection<String> getWorkgroups(String serviceJID, String agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException { AgentWorkgroups request = new AgentWorkgroups(agentJID); request.setTo(serviceJID); AgentWorkgroups response = (AgentWorkgroups) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); return response.getWorkgroups(); }