1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 17:19:39 +02:00

Fix minor codestyle issues

This commit is contained in:
Paul Schaub 2017-12-13 23:10:11 +01:00 committed by Florian Schmaus
parent 200f90ffdc
commit cb18056613
422 changed files with 1404 additions and 1444 deletions

View file

@ -39,7 +39,7 @@ public class MetaData implements ExtensionElement {
*/
public static final String NAMESPACE = "http://jivesoftware.com/protocol/workgroup";
private Map<String, List<String>> metaData;
private final Map<String, List<String>> metaData;
public MetaData(Map<String, List<String>> metaData) {
this.metaData = metaData;

View file

@ -28,11 +28,11 @@ import java.util.Date;
*/
public class QueueUser {
private String userID;
private final String userID;
private int queuePosition;
private int estimatedTime;
private Date joinDate;
private final int queuePosition;
private final int estimatedTime;
private final Date joinDate;
/**
* Queue user.

View file

@ -32,6 +32,6 @@ public interface WorkgroupInvitationListener {
* @param invitation an Invitation instance embodying the information pertaining to the
* invitation
*/
public void invitationReceived(WorkgroupInvitation invitation);
void invitationReceived(WorkgroupInvitation invitation);
}

View file

@ -42,7 +42,7 @@ public class Agent {
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 = (AgentWorkgroups) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
AgentWorkgroups response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response.getWorkgroups();
}
@ -77,7 +77,7 @@ public class Agent {
agentInfo.setType(IQ.Type.get);
agentInfo.setTo(workgroupJID);
agentInfo.setFrom(getUser());
AgentInfo response = (AgentInfo) connection.createStanzaCollectorAndSend(agentInfo).nextResultOrThrow();
AgentInfo response = connection.createStanzaCollectorAndSend(agentInfo).nextResultOrThrow();
return response.getName();
}

View file

@ -56,9 +56,9 @@ public class AgentRoster {
private static final int EVENT_AGENT_REMOVED = 1;
private static final int EVENT_PRESENCE_CHANGED = 2;
private XMPPConnection connection;
private Jid workgroupJID;
private final List<String> entries = new ArrayList<String>();
private final XMPPConnection connection;
private final Jid workgroupJID;
private final List<String> entries = new ArrayList<>();
private final List<AgentRosterListener> listeners = new ArrayList<>();
private final Map<Jid, Map<Resourcepart, Presence>> presenceMap = new HashMap<>();
// The roster is marked as initialized when at least a single roster packet
@ -168,7 +168,7 @@ public class AgentRoster {
* @return all entries in the roster.
*/
public Set<String> getAgents() {
Set<String> agents = new HashSet<String>();
Set<String> agents = new HashSet<>();
synchronized (entries) {
for (Iterator<String> i = entries.iterator(); i.hasNext();) {
agents.add(i.next());
@ -270,7 +270,7 @@ public class AgentRoster {
* Fires event to listeners.
*/
private void fireEvent(int eventType, Object eventObject) {
AgentRosterListener[] listeners = null;
AgentRosterListener[] listeners;
synchronized (this.listeners) {
listeners = new AgentRosterListener[this.listeners.size()];
this.listeners.toArray(listeners);
@ -310,7 +310,7 @@ public class AgentRoster {
// for a particular user a map with the presence packets saved for each resource.
if (presence.getType() == Presence.Type.available) {
// Ignore the presence packet unless it has an agent status extension.
AgentStatus agentStatus = (AgentStatus) presence.getExtension(
AgentStatus agentStatus = presence.getExtension(
AgentStatus.ELEMENT_NAME, AgentStatus.NAMESPACE);
if (agentStatus == null) {
return;

View file

@ -25,9 +25,9 @@ import org.jivesoftware.smack.packet.Presence;
*/
public interface AgentRosterListener {
public void agentAdded(String jid);
void agentAdded(String jid);
public void agentRemoved(String jid);
void agentRemoved(String jid);
public void presenceChanged(Presence presence);
void presenceChanged(Presence presence);
}

View file

@ -94,9 +94,9 @@ import org.jxmpp.stringprep.XmppStringprepException;
public class AgentSession {
private static final Logger LOGGER = Logger.getLogger(AgentSession.class.getName());
private XMPPConnection connection;
private final XMPPConnection connection;
private Jid workgroupJID;
private final Jid workgroupJID;
private boolean online = false;
private Presence.Mode presenceMode;
@ -110,10 +110,10 @@ public class AgentSession {
private final List<QueueUsersListener> queueUsersListeners;
private AgentRoster agentRoster = null;
private TranscriptManager transcriptManager;
private TranscriptSearchManager transcriptSearchManager;
private Agent agent;
private StanzaListener packetListener;
private final TranscriptManager transcriptManager;
private final TranscriptSearchManager transcriptSearchManager;
private final Agent agent;
private final StanzaListener packetListener;
/**
* Constructs a new agent session instance. Note, the {@link #setOnline(boolean)}
@ -137,11 +137,11 @@ public class AgentSession {
this.maxChats = -1;
this.metaData = new HashMap<String, List<String>>();
this.metaData = new HashMap<>();
offerListeners = new ArrayList<OfferListener>();
invitationListeners = new ArrayList<WorkgroupInvitationListener>();
queueUsersListeners = new ArrayList<QueueUsersListener>();
offerListeners = new ArrayList<>();
invitationListeners = new ArrayList<>();
queueUsersListeners = new ArrayList<>();
// Create a filter to listen for packets we're interested in.
OrFilter filter = new OrFilter(
@ -341,7 +341,7 @@ public class AgentSession {
StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(
new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence);
presence = (Presence) collector.nextResultOrThrow();
presence = collector.nextResultOrThrow();
// We can safely update this iv since we didn't get any error
this.online = online;
@ -773,7 +773,7 @@ public class AgentSession {
}
// QueueOverview packet extensions contain basic information about a queue.
QueueOverview queueOverview = (QueueOverview) presence.getExtension(QueueOverview.ELEMENT_NAME, QueueOverview.NAMESPACE);
QueueOverview queueOverview = presence.getExtension(QueueOverview.ELEMENT_NAME, QueueOverview.NAMESPACE);
if (queueOverview != null) {
if (queueOverview.getStatus() == null) {
queue.setStatus(WorkgroupQueue.Status.CLOSED);
@ -792,7 +792,7 @@ public class AgentSession {
// QueueDetails packet extensions contain information about the users in
// a queue.
QueueDetails queueDetails = (QueueDetails) packet.getExtension(QueueDetails.ELEMENT_NAME, QueueDetails.NAMESPACE);
QueueDetails queueDetails = packet.getExtension(QueueDetails.ELEMENT_NAME, QueueDetails.NAMESPACE);
if (queueDetails != null) {
queue.setUsers(queueDetails.getUsers());
// Fire event.
@ -816,20 +816,20 @@ public class AgentSession {
Message message = (Message) packet;
// Check if a room invitation was sent and if the sender is the workgroup
MUCUser mucUser = (MUCUser) message.getExtension("x",
MUCUser mucUser = message.getExtension("x",
"http://jabber.org/protocol/muc#user");
MUCUser.Invite invite = mucUser != null ? mucUser.getInvite() : null;
if (invite != null && workgroupJID.equals(invite.getFrom())) {
String sessionID = null;
Map<String, List<String>> metaData = null;
SessionID sessionIDExt = (SessionID) message.getExtension(SessionID.ELEMENT_NAME,
SessionID sessionIDExt = message.getExtension(SessionID.ELEMENT_NAME,
SessionID.NAMESPACE);
if (sessionIDExt != null) {
sessionID = sessionIDExt.getSessionID();
}
MetaData metaDataExt = (MetaData) message.getExtension(MetaData.ELEMENT_NAME,
MetaData metaDataExt = message.getExtension(MetaData.ELEMENT_NAME,
MetaData.NAMESPACE);
if (metaDataExt != null) {
metaData = metaDataExt.getMetaData();
@ -876,7 +876,7 @@ public class AgentSession {
request.setTo(workgroupJID);
request.setSessionID(sessionID);
ChatNotes response = (ChatNotes) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
ChatNotes response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
}
@ -922,7 +922,7 @@ public class AgentSession {
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
SearchSettings response = (SearchSettings) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
SearchSettings response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
}
@ -942,7 +942,7 @@ public class AgentSession {
request.setTo(workgroupJID);
request.setPersonal(!global);
Macros response = (Macros) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
Macros response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response.getRootGroup();
}
@ -990,7 +990,7 @@ public class AgentSession {
* a user, an agent, a queue or a workgroup. In the case of a queue or a workgroup the workgroup service
* will decide the best agent to receive the invitation.<p>
*
* This method will return either when the service returned an ACK of the request or if an error occured
* This method will return either when the service returned an ACK of the request or if an error occurred
* while requesting the invitation. After sending the ACK the service will send the invitation to the target
* entity. When dealing with agents the common sequence of offer-response will be followed. However, when
* sending an invitation to a user a standard MUC invitation will be sent.<p>
@ -1000,7 +1000,7 @@ public class AgentSession {
* accepted the offer but failed to join the room.
*
* Different situations may lead to a failed invitation. Possible cases are: 1) all agents rejected the
* offer and ther are no agents available, 2) the agent that accepted the offer failed to join the room or
* offer and there are no agents available, 2) the agent that accepted the offer failed to join the room or
* 2) the user that received the MUC invitation never replied or joined the room. In any of these cases
* (or other failing cases) the inviter will get an error message with the failed notification.
*
@ -1030,7 +1030,7 @@ public class AgentSession {
* a user, an agent, a queue or a workgroup. In the case of a queue or a workgroup the workgroup service
* will decide the best agent to receive the invitation.<p>
*
* This method will return either when the service returned an ACK of the request or if an error occured
* This method will return either when the service returned an ACK of the request or if an error occurred
* while requesting the transfer. After sending the ACK the service will send the invitation to the target
* entity. When dealing with agents the common sequence of offer-response will be followed. However, when
* sending an invitation to a user a standard MUC invitation will be sent.<p>
@ -1079,7 +1079,7 @@ public class AgentSession {
setting.setType(IQ.Type.get);
setting.setTo(workgroupJID);
GenericSettings response = (GenericSettings) connection.createStanzaCollectorAndSend(
GenericSettings response = connection.createStanzaCollectorAndSend(
setting).nextResultOrThrow();
return response;
}
@ -1089,7 +1089,7 @@ public class AgentSession {
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
MonitorPacket response = (MonitorPacket) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
MonitorPacket response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response.isMonitor();
}

View file

@ -24,9 +24,9 @@ package org.jivesoftware.smackx.workgroup.agent;
*/
public class InvitationRequest extends OfferContent {
private String inviter;
private String room;
private String reason;
private final String inviter;
private final String room;
private final String reason;
public InvitationRequest(String inviter, String room, String reason) {
this.inviter = inviter;

View file

@ -38,16 +38,16 @@ import org.jxmpp.jid.Jid;
*/
public class Offer {
private XMPPConnection connection;
private AgentSession session;
private final XMPPConnection connection;
private final AgentSession session;
private String sessionID;
private Jid userJID;
private Jid userID;
private Jid workgroupName;
private Date expiresDate;
private Map<String, List<String>> metaData;
private OfferContent content;
private final String sessionID;
private final Jid userJID;
private final Jid userID;
private final Jid workgroupName;
private final Date expiresDate;
private final Map<String, List<String>> metaData;
private final OfferContent content;
private boolean accepted = false;
private boolean rejected = false;

View file

@ -34,7 +34,7 @@ public interface OfferListener {
*
* @param request the Offer instance embodying the details of the offer
*/
public void offerReceived (Offer request);
void offerReceived (Offer request);
/**
* The implementing class instance will be notified via this when the AgentSessino has received
@ -42,6 +42,6 @@ public interface OfferListener {
*
* @param revokedOffer the RevokedOffer instance embodying the details of the revoked offer
*/
public void offerRevoked (RevokedOffer revokedOffer);
void offerRevoked (RevokedOffer revokedOffer);
}

View file

@ -30,7 +30,7 @@ public interface QueueUsersListener {
* @param queue the workgroup queue.
* @param status the status of queue.
*/
public void statusUpdated(WorkgroupQueue queue, WorkgroupQueue.Status status);
void statusUpdated(WorkgroupQueue queue, WorkgroupQueue.Status status);
/**
* The average wait time of the queue was updated.
@ -38,7 +38,7 @@ public interface QueueUsersListener {
* @param queue the workgroup queue.
* @param averageWaitTime the average wait time of the queue.
*/
public void averageWaitTimeUpdated(WorkgroupQueue queue, int averageWaitTime);
void averageWaitTimeUpdated(WorkgroupQueue queue, int averageWaitTime);
/**
* The date of oldest entry waiting in the queue was updated.
@ -46,7 +46,7 @@ public interface QueueUsersListener {
* @param queue the workgroup queue.
* @param oldestEntry the date of the oldest entry waiting in the queue.
*/
public void oldestEntryUpdated(WorkgroupQueue queue, Date oldestEntry);
void oldestEntryUpdated(WorkgroupQueue queue, Date oldestEntry);
/**
* The list of users waiting in the queue was updated.
@ -54,5 +54,5 @@ public interface QueueUsersListener {
* @param queue the workgroup queue.
* @param users the list of users waiting in the queue.
*/
public void usersUpdated(WorkgroupQueue queue, Set<QueueUser> users);
void usersUpdated(WorkgroupQueue queue, Set<QueueUser> users);
}

View file

@ -29,12 +29,12 @@ import org.jxmpp.jid.Jid;
*/
public class RevokedOffer {
private Jid userJID;
private Jid userID;
private Jid workgroupName;
private String sessionID;
private String reason;
private Date timestamp;
private final Jid userJID;
private final Jid userID;
private final Jid workgroupName;
private final String sessionID;
private final String reason;
private final Date timestamp;
/**
*
@ -78,7 +78,7 @@ public class RevokedOffer {
}
/**
* Get the sesion id.
* Get the session id.
* @return the session id which will associate all packets for the pending chat
*/
public String getSessionID() {

View file

@ -55,7 +55,7 @@ public class TranscriptManager {
public Transcript getTranscript(Jid workgroupJID, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Transcript request = new Transcript(sessionID);
request.setTo(workgroupJID);
Transcript response = (Transcript) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
Transcript response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
}
@ -74,7 +74,7 @@ public class TranscriptManager {
public Transcripts getTranscripts(Jid workgroupJID, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Transcripts request = new Transcripts(userID);
request.setTo(workgroupJID);
Transcripts response = (Transcripts) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
Transcripts response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
}
}

View file

@ -37,7 +37,7 @@ import org.jxmpp.jid.DomainBareJid;
* @author Gaston Dombiak
*/
public class TranscriptSearchManager {
private XMPPConnection connection;
private final XMPPConnection connection;
public TranscriptSearchManager(XMPPConnection connection) {
this.connection = connection;
@ -60,7 +60,7 @@ public class TranscriptSearchManager {
search.setType(IQ.Type.get);
search.setTo(serviceJID);
TranscriptSearch response = (TranscriptSearch) connection.createStanzaCollectorAndSend(
TranscriptSearch response = connection.createStanzaCollectorAndSend(
search).nextResultOrThrow();
return Form.getFormFrom(response);
}
@ -84,7 +84,7 @@ public class TranscriptSearchManager {
search.setTo(serviceJID);
search.addExtension(completedForm.getDataFormToSend());
TranscriptSearch response = (TranscriptSearch) connection.createStanzaCollectorAndSend(
TranscriptSearch response = connection.createStanzaCollectorAndSend(
search).nextResultOrThrow();
return ReportedData.getReportedDataFrom(response);
}

View file

@ -24,9 +24,9 @@ package org.jivesoftware.smackx.workgroup.agent;
*/
public class TransferRequest extends OfferContent {
private String inviter;
private String room;
private String reason;
private final String inviter;
private final String room;
private final String reason;
public TransferRequest(String inviter, String room, String reason) {
this.inviter = inviter;

View file

@ -24,7 +24,7 @@ package org.jivesoftware.smackx.workgroup.agent;
*/
public class UserRequest extends OfferContent {
// TODO Do we want to use a singleton? Should we store the userID here?
private static UserRequest instance = new UserRequest();
private static final UserRequest instance = new UserRequest();
public static OfferContent getInstance() {
return instance;

View file

@ -49,7 +49,7 @@ public class AgentChatHistory extends IQ {
private int maxSessions;
private long startDate;
private List<AgentChatSession> agentChatSessions = new ArrayList<AgentChatSession>();
private final List<AgentChatSession> agentChatSessions = new ArrayList<>();
public AgentChatHistory(String agentJID, int maxSessions, Date startDate) {
this();

View file

@ -35,8 +35,8 @@ public class MacroGroup {
private String title;
public MacroGroup() {
macros = new ArrayList<Macro>();
macroGroups = new ArrayList<MacroGroup>();
macros = new ArrayList<>();
macroGroups = new ArrayList<>();
}
public void addMacro(Macro macro) {

View file

@ -56,7 +56,7 @@ public class AgentStatus implements ExtensionElement {
public static final String NAMESPACE = "http://jabber.org/protocol/workgroup";
private String workgroupJID;
private List<ChatInfo> currentChats = new ArrayList<ChatInfo>();
private final List<ChatInfo> currentChats = new ArrayList<>();
private int maxChats = -1;
AgentStatus() {
@ -122,12 +122,12 @@ public class AgentStatus implements ExtensionElement {
*/
public static class ChatInfo {
private String sessionID;
private String userID;
private Date date;
private String email;
private String username;
private String question;
private final String sessionID;
private final String userID;
private final Date date;
private final String email;
private final String username;
private final String question;
public ChatInfo(String sessionID, String userID, Date date, String email, String username, String question) {
this.sessionID = sessionID;

View file

@ -90,9 +90,9 @@ public class AgentStatusRequest extends IQ {
public static class Item {
private String jid;
private String type;
private String name;
private final String jid;
private final String type;
private final String name;
public Item(String jid, String type, String name) {
this.jid = jid;

View file

@ -56,7 +56,7 @@ public class AgentWorkgroups extends IQ {
public AgentWorkgroups(Jid agentJID) {
this();
this.agentJID = agentJID;
this.workgroups = new ArrayList<String>();
this.workgroups = new ArrayList<>();
}
/**
@ -107,7 +107,7 @@ public class AgentWorkgroups extends IQ {
@Override
public AgentWorkgroups parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
final Jid agentJID = ParserUtils.getJidAttribute(parser);
List<String> workgroups = new ArrayList<String>();
List<String> workgroups = new ArrayList<>();
boolean done = false;
while (!done) {

View file

@ -57,13 +57,13 @@ public class OccupantsInfo extends IQ {
*/
public static final String NAMESPACE = "http://jivesoftware.com/protocol/workgroup";
private String roomID;
private final String roomID;
private final Set<OccupantInfo> occupants;
public OccupantsInfo(String roomID) {
super(ELEMENT_NAME, NAMESPACE);
this.roomID = roomID;
this.occupants = new HashSet<OccupantInfo>();
this.occupants = new HashSet<>();
}
public String getRoomID() {
@ -104,9 +104,9 @@ public class OccupantsInfo extends IQ {
public static class OccupantInfo {
private String jid;
private String nickname;
private Date joined;
private final String jid;
private final String nickname;
private final Date joined;
public OccupantInfo(String jid, String nickname, Date joined) {
this.jid = jid;

View file

@ -54,7 +54,7 @@ public class OfferRequestProvider extends IQProvider<IQ> {
int timeout = -1;
OfferContent content = null;
boolean done = false;
Map<String, List<String>> metaData = new HashMap<String, List<String>>();
Map<String, List<String>> metaData = new HashMap<>();
if (eventType != XmlPullParser.START_TAG) {
// throw exception
@ -116,12 +116,12 @@ public class OfferRequestProvider extends IQProvider<IQ> {
public static final String ELEMENT = "offer";
public static final String NAMESPACE = "http://jabber.org/protocol/workgroup";
private int timeout;
private Jid userID;
private Jid userJID;
private Map<String, List<String>> metaData;
private String sessionID;
private OfferContent content;
private final int timeout;
private final Jid userID;
private final Jid userJID;
private final Map<String, List<String>> metaData;
private final String sessionID;
private final OfferContent content;
public OfferRequestPacket(Jid userJID, Jid userID, int timeout, Map<String, List<String>> metaData,
String sessionID, OfferContent content)

View file

@ -72,10 +72,10 @@ public class OfferRevokeProvider extends IQProvider<IQ> {
public static final String ELEMENT = "offer-revoke";
public static final String NAMESPACE = "http://jabber.org/protocol/workgroup";
private Jid userJID;
private Jid userID;
private String sessionID;
private String reason;
private final Jid userJID;
private final Jid userID;
private final String sessionID;
private final String reason;
public OfferRevokePacket (Jid userJID, Jid userID, String cause, String sessionID) {
super(ELEMENT, NAMESPACE);

View file

@ -54,7 +54,7 @@ public final class QueueDetails implements ExtensionElement {
private static final String DATE_FORMAT = "yyyyMMdd'T'HH:mm:ss";
private SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
private final SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
/**
* The list of users in the queue.
*/
@ -157,7 +157,7 @@ public final class QueueDetails implements ExtensionElement {
{
eventType = parser.next();
while ((eventType == XmlPullParser.START_TAG) && "user".equals(parser.getName())) {
String uid = null;
String uid;
int position = -1;
int time = -1;
Date joinTime = null;

View file

@ -44,7 +44,7 @@ public class QueueOverview implements ExtensionElement {
public static String NAMESPACE = "http://jabber.org/protocol/workgroup";
private static final String DATE_FORMAT = "yyyyMMdd'T'HH:mm:ss";
private SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
private final SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
private int averageWaitTime;
private Date oldestEntry;

View file

@ -42,8 +42,8 @@ public class QueueUpdate implements ExtensionElement {
*/
public static final String NAMESPACE = "http://jabber.org/protocol/workgroup";
private int position;
private int remainingTime;
private final int position;
private final int remainingTime;
public QueueUpdate(int position, int remainingTime) {
this.position = position;

View file

@ -133,7 +133,7 @@ public class RoomInvitation implements ExtensionElement {
/**
* Type of entity being invited to a groupchat support session.
*/
public static enum Type {
public enum Type {
/**
* A user is being invited to a groupchat support session. The user could be another agent
* or just a regular XMPP user.

View file

@ -37,7 +37,7 @@ public class SessionID implements ExtensionElement {
*/
public static final String NAMESPACE = "http://jivesoftware.com/protocol/workgroup";
private String sessionID;
private final String sessionID;
public SessionID(String sessionID) {
this.sessionID = sessionID;

View file

@ -19,22 +19,21 @@ package org.jivesoftware.smackx.workgroup.packet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Stanza;
/**
* Represents the conversation transcript that occured in a group chat room between an Agent
* Represents the conversation transcript that occurred in a group chat room between an Agent
* and a user that requested assistance. The transcript contains all the Messages that were sent
* to the room as well as the sent presences.
*
* @author Gaston Dombiak
*/
public class Transcript extends IQ {
private String sessionID;
private List<Stanza> packets;
private final String sessionID;
private final List<Stanza> packets;
/**
* Creates a transcript request for the given sessionID.
@ -83,8 +82,7 @@ public class Transcript extends IQ {
.append(sessionID)
.append("\">");
for (Iterator<Stanza> it = packets.iterator(); it.hasNext();) {
Stanza packet = it.next();
for (Stanza packet : packets) {
buf.append(packet.toXML());
}

View file

@ -36,7 +36,7 @@ public class TranscriptProvider extends IQProvider<Transcript> {
@Override
public Transcript parse(XmlPullParser parser, int initialDepth) throws Exception {
String sessionID = parser.getAttributeValue("", "sessionID");
List<Stanza> packets = new ArrayList<Stanza>();
List<Stanza> packets = new ArrayList<>();
boolean done = false;
while (!done) {

View file

@ -24,7 +24,7 @@ import org.jivesoftware.smack.util.PacketParserUtils;
import org.xmlpull.v1.XmlPullParser;
/**
* IQ stanza(/packet) for retrieving the transcript search form, submiting the completed search form
* IQ stanza(/packet) for retrieving the transcript search form, submitting the completed search form
* or retrieving the answer of a transcript search.
*
* @author Gaston Dombiak

View file

@ -42,8 +42,8 @@ public class Transcripts extends IQ {
UTC_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT+0"));
}
private Jid userID;
private List<Transcripts.TranscriptSummary> summaries;
private final Jid userID;
private final List<Transcripts.TranscriptSummary> summaries;
/**
@ -71,7 +71,7 @@ public class Transcripts extends IQ {
/**
* Returns the id of the user that was involved in the conversations. The userID could be a
* real JID if the connected user was not anonymous. Otherwise, the userID will be a String
* that was provided by the anonymous user as a way to idenitify the user across many user
* that was provided by the anonymous user as a way to identify the user across many user
* sessions.
*
* @return the id of the user that was involved in the conversations.
@ -111,10 +111,10 @@ public class Transcripts extends IQ {
* sessionID to get the full conversation transcript.
*/
public static class TranscriptSummary {
private String sessionID;
private Date joinTime;
private Date leftTime;
private List<AgentDetail> agentDetails;
private final String sessionID;
private final Date joinTime;
private final Date leftTime;
private final List<AgentDetail> agentDetails;
public TranscriptSummary(String sessionID, Date joinTime, Date leftTime, List<AgentDetail> agentDetails) {
this.sessionID = sessionID;
@ -189,9 +189,9 @@ public class Transcripts extends IQ {
* An AgentDetail contains information of an Agent that was involved in a conversation.
*/
public static class AgentDetail {
private String agentJID;
private Date joinTime;
private Date leftTime;
private final String agentJID;
private final Date joinTime;
private final Date leftTime;
public AgentDetail(String agentJID, Date joinTime, Date leftTime) {
this.agentJID = agentJID;

View file

@ -47,7 +47,7 @@ public class TranscriptsProvider extends IQProvider<Transcripts> {
@Override
public Transcripts parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
Jid userID = ParserUtils.getJidAttribute(parser, "userID");
List<Transcripts.TranscriptSummary> summaries = new ArrayList<Transcripts.TranscriptSummary>();
List<Transcripts.TranscriptSummary> summaries = new ArrayList<>();
boolean done = false;
while (!done) {
@ -72,7 +72,7 @@ public class TranscriptsProvider extends IQProvider<Transcripts> {
String sessionID = parser.getAttributeValue("", "sessionID");
Date joinTime = null;
Date leftTime = null;
List<Transcripts.AgentDetail> agents = new ArrayList<Transcripts.AgentDetail>();
List<Transcripts.AgentDetail> agents = new ArrayList<>();
boolean done = false;
while (!done) {
@ -103,7 +103,7 @@ public class TranscriptsProvider extends IQProvider<Transcripts> {
}
private List<Transcripts.AgentDetail> parseAgents(XmlPullParser parser) throws IOException, XmlPullParserException {
List<Transcripts.AgentDetail> agents = new ArrayList<Transcripts.AgentDetail>();
List<Transcripts.AgentDetail> agents = new ArrayList<>();
String agentJID = null;
Date joinTime = null;
Date leftTime = null;

View file

@ -39,7 +39,7 @@ public class UserID implements ExtensionElement {
*/
public static final String NAMESPACE = "http://jivesoftware.com/protocol/workgroup";
private Jid userID;
private final Jid userID;
public UserID(Jid userID) {
this.userID = userID;

View file

@ -41,7 +41,7 @@ public class WorkgroupInformation implements ExtensionElement {
*/
public static final String NAMESPACE = "http://jabber.org/protocol/workgroup";
private String workgroupJID;
private final String workgroupJID;
public WorkgroupInformation(String workgroupJID) {
this.workgroupJID = workgroupJID;

View file

@ -46,7 +46,7 @@ public class ChatSettings extends IQ {
*/
public static final int BOT_SETTINGS = 2;
private List<ChatSetting> settings;
private final List<ChatSetting> settings;
private String key;
private int type = -1;
@ -62,7 +62,7 @@ public class ChatSettings extends IQ {
public ChatSettings() {
super(ELEMENT_NAME, NAMESPACE);
settings = new ArrayList<ChatSetting>();
settings = new ArrayList<>();
}
public ChatSettings(String key) {

View file

@ -30,7 +30,7 @@ import org.xmlpull.v1.XmlPullParserException;
public class GenericSettings extends IQ {
private Map<String, String> map = new HashMap<String, String>();
private Map<String, String> map = new HashMap<>();
private String query;

View file

@ -28,19 +28,19 @@ public interface QueueListener {
/**
* The user joined the workgroup queue.
*/
public void joinedQueue();
void joinedQueue();
/**
* The user departed the workgroup queue.
*/
public void departedQueue();
void departedQueue();
/**
* The user's queue position has been updated to a new value.
*
* @param currentPosition the user's current position in the queue.
*/
public void queuePositionUpdated(int currentPosition);
void queuePositionUpdated(int currentPosition);
/**
* The user's estimated remaining wait time in the queue has been updated.
@ -48,6 +48,6 @@ public interface QueueListener {
* @param secondsRemaining the estimated number of seconds remaining until the
* the user is routed to the agent.
*/
public void queueWaitTimeUpdated(int secondsRemaining);
void queueWaitTimeUpdated(int secondsRemaining);
}

View file

@ -77,11 +77,11 @@ import org.jxmpp.jid.Jid;
*/
public class Workgroup {
private Jid workgroupJID;
private XMPPConnection connection;
private final Jid workgroupJID;
private final XMPPConnection connection;
private boolean inQueue;
private CopyOnWriteArraySet<WorkgroupInvitationListener> invitationListeners;
private CopyOnWriteArraySet<QueueListener> queueListeners;
private final CopyOnWriteArraySet<WorkgroupInvitationListener> invitationListeners;
private final CopyOnWriteArraySet<QueueListener> queueListeners;
private int queuePosition = -1;
private int queueRemainingTime = -1;
@ -194,7 +194,7 @@ public class Workgroup {
StanzaCollector collector = connection.createStanzaCollectorAndSend(new AndFilter(fromFilter,
typeFilter), directedPresence);
Presence response = (Presence) collector.nextResultOrThrow();
Presence response = collector.nextResultOrThrow();
return Presence.Type.available == response.getType();
}
@ -220,7 +220,7 @@ public class Workgroup {
* returned.
*
* @return the estimated time remaining (in seconds) that the user has to
* wait inthe workgroupu queue, or -1 if time information isn't available
* wait in the workgroup queue, or -1 if time information isn't available
* or if the user isn't int the queue.
*/
public int getQueueRemainingTime() {
@ -256,8 +256,8 @@ public class Workgroup {
* server will ignore a manually specified userID if the user's connection to the server
* is not anonymous.
*
* @throws XMPPException if an error occured joining the queue. An error may indicate
* that a connection failure occured or that the server explicitly rejected the
* @throws XMPPException if an error occurred joining the queue. An error may indicate
* that a connection failure occurred or that the server explicitly rejected the
* request to join the queue.
* @throws SmackException
* @throws InterruptedException
@ -295,8 +295,8 @@ public class Workgroup {
* is not anonymous.
*
* @param answerForm the completed form the send for the join request.
* @throws XMPPException if an error occured joining the queue. An error may indicate
* that a connection failure occured or that the server explicitly rejected the
* @throws XMPPException if an error occurred joining the queue. An error may indicate
* that a connection failure occurred or that the server explicitly rejected the
* request to join the queue.
* @throws SmackException
* @throws InterruptedException
@ -331,11 +331,11 @@ public class Workgroup {
* be used instead of the user's JID to track conversations. The server will ignore a
* manually specified userID if the user's connection to the server is not anonymous.
*
* @param answerForm the completed form associated with the join reqest.
* @param answerForm the completed form associated with the join request.
* @param userID String that represents the ID of the user when using anonymous sessions
* or <tt>null</tt> if a userID should not be used.
* @throws XMPPErrorException if an error occured joining the queue. An error may indicate
* that a connection failure occured or that the server explicitly rejected the
* @throws XMPPErrorException if an error occurred joining the queue. An error may indicate
* that a connection failure occurred or that the server explicitly rejected the
* request to join the queue.
* @throws NoResponseException
* @throws NotConnectedException
@ -383,8 +383,8 @@ public class Workgroup {
* @param metadata metadata to create a dataform from.
* @param userID String that represents the ID of the user when using anonymous sessions
* or <tt>null</tt> if a userID should not be used.
* @throws XMPPException if an error occured joining the queue. An error may indicate
* that a connection failure occured or that the server explicitly rejected the
* @throws XMPPException if an error occurred joining the queue. An error may indicate
* that a connection failure occurred or that the server explicitly rejected the
* request to join the queue.
* @throws SmackException
* @throws InterruptedException
@ -418,7 +418,7 @@ public class Workgroup {
* under certain circumstances -- for example, if they no longer wish to be routed
* to an agent because they've been waiting too long.
*
* @throws XMPPErrorException if an error occured trying to send the depart queue
* @throws XMPPErrorException if an error occurred trying to send the depart queue
* request to the server.
* @throws NoResponseException
* @throws NotConnectedException
@ -533,7 +533,7 @@ public class Workgroup {
else {
// Check if a room invitation was sent and if the sender is the workgroup
MUCUser mucUser = (MUCUser) msg.getExtension("x", "http://jabber.org/protocol/muc#user");
MUCUser mucUser = msg.getExtension("x", "http://jabber.org/protocol/muc#user");
MUCUser.Invite invite = mucUser != null ? mucUser.getInvite() : null;
if (invite != null && workgroupJID.equals(invite.getFrom())) {
String sessionID = null;
@ -566,8 +566,8 @@ public class Workgroup {
*/
private class JoinQueuePacket extends IQ {
private Jid userID;
private DataForm form;
private final Jid userID;
private final DataForm form;
public JoinQueuePacket(Jid workgroup, Form answerForm, Jid userID) {
super("join-queue", "http://jabber.org/protocol/workgroup");
@ -656,7 +656,7 @@ public class Workgroup {
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
ChatSettings response = (ChatSettings) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
ChatSettings response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
}
@ -696,9 +696,7 @@ public class Workgroup {
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
OfflineSettings response = (OfflineSettings) connection.createStanzaCollectorAndSend(
request).nextResultOrThrow();
return response;
return connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
}
/**
@ -715,8 +713,7 @@ public class Workgroup {
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
SoundSettings response = (SoundSettings) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
return connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
}
/**
@ -733,9 +730,7 @@ public class Workgroup {
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
WorkgroupProperties response = (WorkgroupProperties) connection.createStanzaCollectorAndSend(
request).nextResultOrThrow();
return response;
return connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
}
/**
@ -754,9 +749,8 @@ public class Workgroup {
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
WorkgroupProperties response = (WorkgroupProperties) connection.createStanzaCollectorAndSend(
return connection.createStanzaCollectorAndSend(
request).nextResultOrThrow();
return response;
}
@ -776,7 +770,7 @@ public class Workgroup {
workgroupForm.setType(IQ.Type.get);
workgroupForm.setTo(workgroupJID);
WorkgroupForm response = (WorkgroupForm) connection.createStanzaCollectorAndSend(
WorkgroupForm response = connection.createStanzaCollectorAndSend(
workgroupForm).nextResultOrThrow();
return Form.getFormFrom(response);
}

View file

@ -45,7 +45,7 @@ public class ListenerEventDispatcher implements Runnable {
public ListenerEventDispatcher () {
super();
this.triplets = new ArrayList<TripletContainer>();
this.triplets = new ArrayList<>();
this.hasFinishedDispatching = false;
this.isRunning = false;
@ -86,7 +86,7 @@ public class ListenerEventDispatcher implements Runnable {
@Override
public void run() {
ListIterator<TripletContainer> li = null;
ListIterator<TripletContainer> li;
this.isRunning = true;

View file

@ -20,12 +20,10 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.workgroup.MetaData;
import org.xmlpull.v1.XmlPullParser;
@ -54,7 +52,7 @@ public class MetaDataUtils {
if ((eventType == XmlPullParser.START_TAG)
&& parser.getName().equals(MetaData.ELEMENT_NAME)
&& parser.getNamespace().equals(MetaData.NAMESPACE)) {
Map<String, List<String>> metaData = new Hashtable<String, List<String>>();
Map<String, List<String>> metaData = new Hashtable<>();
eventType = parser.nextTag();
@ -69,7 +67,7 @@ public class MetaDataUtils {
values.add(value);
}
else {
List<String> values = new ArrayList<String>();
List<String> values = new ArrayList<>();
values.add(value);
metaData.put(name, values);
}
@ -93,11 +91,9 @@ public class MetaDataUtils {
StringBuilder buf = new StringBuilder();
if (metaData != null && metaData.size() > 0) {
buf.append("<metadata xmlns=\"http://jivesoftware.com/protocol/workgroup\">");
for (Iterator<String> i = metaData.keySet().iterator(); i.hasNext();) {
String key = i.next();
for (String key : metaData.keySet()) {
List<String> value = metaData.get(key);
for (Iterator<String> it = value.iterator(); it.hasNext();) {
String v = it.next();
for (String v : value) {
buf.append("<value name=\"").append(key).append("\">");
buf.append(StringUtils.escapeForXmlText(v));
buf.append("</value>");

View file

@ -58,8 +58,8 @@ public final class MessageEventManager extends Manager {
private static final StanzaFilter PACKET_FILTER = new AndFilter(new StanzaExtensionFilter(
new MessageEvent()), new NotFilter(MessageTypeFilter.ERROR));
private List<MessageEventNotificationListener> messageEventNotificationListeners = new CopyOnWriteArrayList<MessageEventNotificationListener>();
private List<MessageEventRequestListener> messageEventRequestListeners = new CopyOnWriteArrayList<MessageEventRequestListener>();
private final List<MessageEventNotificationListener> messageEventNotificationListeners = new CopyOnWriteArrayList<>();
private final List<MessageEventRequestListener> messageEventRequestListeners = new CopyOnWriteArrayList<>();
public synchronized static MessageEventManager getInstanceFor(XMPPConnection connection) {
MessageEventManager messageEventManager = INSTANCES.get(connection);
@ -73,7 +73,7 @@ public final class MessageEventManager extends Manager {
/**
* Creates a new message event manager.
*
* @param con an XMPPConnection to a XMPP server.
* @param connection an XMPPConnection to a XMPP server.
*/
private MessageEventManager(XMPPConnection connection) {
super(connection);
@ -82,8 +82,7 @@ public final class MessageEventManager extends Manager {
@Override
public void processStanza(Stanza packet) {
Message message = (Message) packet;
MessageEvent messageEvent =
(MessageEvent) message.getExtension("x", "jabber:x:event");
MessageEvent messageEvent = message.getExtension("x", "jabber:x:event");
if (messageEvent.isMessageEventRequest()) {
// Fire event for requests of message events
for (String eventType : messageEvent.getEventTypes())
@ -104,7 +103,7 @@ public final class MessageEventManager extends Manager {
/**
* Adds event notification requests to a message. For each event type that
* the user wishes event notifications from the message recepient for, <tt>true</tt>
* the user wishes event notifications from the message recipient for, <tt>true</tt>
* should be passed in to this method.
*
* @param message the message to add the requested notifications.

View file

@ -35,7 +35,7 @@ public interface MessageEventNotificationListener {
* @param from the user that sent the notification.
* @param packetID the id of the message that was sent.
*/
public void deliveredNotification(Jid from, String packetID);
void deliveredNotification(Jid from, String packetID);
/**
* Called when a notification of message displayed is received.
@ -43,7 +43,7 @@ public interface MessageEventNotificationListener {
* @param from the user that sent the notification.
* @param packetID the id of the message that was sent.
*/
public void displayedNotification(Jid from, String packetID);
void displayedNotification(Jid from, String packetID);
/**
* Called when a notification that the receiver of the message is composing a reply is
@ -52,7 +52,7 @@ public interface MessageEventNotificationListener {
* @param from the user that sent the notification.
* @param packetID the id of the message that was sent.
*/
public void composingNotification(Jid from, String packetID);
void composingNotification(Jid from, String packetID);
/**
* Called when a notification that the receiver of the message is offline is received.
@ -60,7 +60,7 @@ public interface MessageEventNotificationListener {
* @param from the user that sent the notification.
* @param packetID the id of the message that was sent.
*/
public void offlineNotification(Jid from, String packetID);
void offlineNotification(Jid from, String packetID);
/**
* Called when a notification that the receiver of the message cancelled the reply
@ -69,5 +69,5 @@ public interface MessageEventNotificationListener {
* @param from the user that sent the notification.
* @param packetID the id of the message that was sent.
*/
public void cancelledNotification(Jid from, String packetID);
void cancelledNotification(Jid from, String packetID);
}

View file

@ -52,7 +52,7 @@ public interface MessageEventRequestListener {
* @throws NotConnectedException
* @throws InterruptedException
*/
public void deliveredNotificationRequested(Jid from, String packetID,
void deliveredNotificationRequested(Jid from, String packetID,
MessageEventManager messageEventManager) throws NotConnectedException, InterruptedException;
/**
@ -62,7 +62,7 @@ public interface MessageEventRequestListener {
* @param packetID the id of the message that was sent.
* @param messageEventManager the messageEventManager that fired the listener.
*/
public void displayedNotificationRequested(Jid from, String packetID,
void displayedNotificationRequested(Jid from, String packetID,
MessageEventManager messageEventManager);
/**
@ -73,7 +73,7 @@ public interface MessageEventRequestListener {
* @param packetID the id of the message that was sent.
* @param messageEventManager the messageEventManager that fired the listener.
*/
public void composingNotificationRequested(Jid from, String packetID,
void composingNotificationRequested(Jid from, String packetID,
MessageEventManager messageEventManager);
/**
@ -83,7 +83,7 @@ public interface MessageEventRequestListener {
* @param packetID the id of the message that was sent.
* @param messageEventManager the messageEventManager that fired the listener.
*/
public void offlineNotificationRequested(Jid from, String packetID,
void offlineNotificationRequested(Jid from, String packetID,
MessageEventManager messageEventManager);
}

View file

@ -170,7 +170,7 @@ public class MessageEvent implements ExtensionElement {
* @return a List of all the types of events of the MessageEvent.
*/
public List<String> getEventTypes() {
ArrayList<String> allEvents = new ArrayList<String>();
ArrayList<String> allEvents = new ArrayList<>();
if (isDelivered()) {
allEvents.add(MessageEvent.DELIVERED);
}

View file

@ -36,9 +36,9 @@ import org.jxmpp.jid.Jid;
*/
public class RemoteRosterEntry {
private Jid user;
private String name;
private final List<String> groupNames = new ArrayList<String>();
private final Jid user;
private final String name;
private final List<String> groupNames = new ArrayList<>();
/**
* Creates a new remote roster entry.

View file

@ -36,6 +36,6 @@ public interface RosterExchangeListener {
* @param remoteRosterEntries the entries sent by the user. The entries are instances of
* RemoteRosterEntry.
*/
public void entriesReceived(Jid from, Iterator<RemoteRosterEntry> remoteRosterEntries);
void entriesReceived(Jid from, Iterator<RemoteRosterEntry> remoteRosterEntries);
}

View file

@ -77,14 +77,13 @@ public class RosterExchangeManager {
* @param connection an XMPPConnection which is used to send and receive messages.
*/
public RosterExchangeManager(XMPPConnection connection) {
weakRefConnection = new WeakReference<XMPPConnection>(connection);
weakRefConnection = new WeakReference<>(connection);
// Listens for all roster exchange packets and fire the roster exchange listeners.
packetListener = new StanzaListener() {
@Override
public void processStanza(Stanza packet) {
Message message = (Message) packet;
RosterExchange rosterExchange =
(RosterExchange) message.getExtension(ELEMENT, NAMESPACE);
RosterExchange rosterExchange = message.getExtension(ELEMENT, NAMESPACE);
// Fire event for roster exchange listeners
fireRosterExchangeListeners(message.getFrom(), rosterExchange.getRosterEntries());
}
@ -182,13 +181,13 @@ public class RosterExchangeManager {
* Fires roster exchange listeners.
*/
private void fireRosterExchangeListeners(Jid from, Iterator<RemoteRosterEntry> remoteRosterEntries) {
RosterExchangeListener[] listeners = null;
RosterExchangeListener[] listeners;
synchronized (rosterExchangeListeners) {
listeners = new RosterExchangeListener[rosterExchangeListeners.size()];
rosterExchangeListeners.toArray(listeners);
}
for (int i = 0; i < listeners.length; i++) {
listeners[i].entriesReceived(from, remoteRosterEntries);
for (RosterExchangeListener listener : listeners) {
listener.entriesReceived(from, remoteRosterEntries);
}
}
}

View file

@ -80,7 +80,7 @@ public class RosterExchange implements ExtensionElement {
*/
public void addRosterEntry(RosterEntry rosterEntry) {
// Obtain a String[] from the roster entry groups name
List<String> groupNamesList = new ArrayList<String>();
List<String> groupNamesList = new ArrayList<>();
String[] groupNames;
for (RosterGroup group : rosterEntry.getGroups()) {
groupNamesList.add(group.getName());
@ -135,7 +135,7 @@ public class RosterExchange implements ExtensionElement {
*/
public Iterator<RemoteRosterEntry> getRosterEntries() {
synchronized (remoteRosterEntries) {
List<RemoteRosterEntry> entries = Collections.unmodifiableList(new ArrayList<RemoteRosterEntry>(remoteRosterEntries));
List<RemoteRosterEntry> entries = Collections.unmodifiableList(new ArrayList<>(remoteRosterEntries));
return entries.iterator();
}
}

View file

@ -52,16 +52,16 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
// CHECKSTYLE:OFF
RosterExchange rosterExchange = new RosterExchange();
boolean done = false;
RemoteRosterEntry remoteRosterEntry = null;
RemoteRosterEntry remoteRosterEntry;
Jid jid = null;
String name = "";
ArrayList<String> groupsName = new ArrayList<String>();
ArrayList<String> groupsName = new ArrayList<>();
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("item")) {
// Reset this variable since they are optional for each item
groupsName = new ArrayList<String>();
groupsName = new ArrayList<>();
// Initialize the variables from the parsed XML
jid = ParserUtils.getJidAttribute(parser);
name = parser.getAttributeValue("", "name");