public class AgentSession
extends java.lang.Object
Constructor and Description |
---|
AgentSession(org.jxmpp.jid.EntityBareJid workgroupJID,
org.jivesoftware.smack.XMPPConnection connection)
Constructs a new agent session instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addInvitationListener(WorkgroupInvitationListener invitationListener)
Adds an invitation listener.
|
void |
addOfferListener(OfferListener offerListener)
Adds an offer listener.
|
void |
addQueueUsersListener(QueueUsersListener listener) |
void |
close()
Close the agent session.
|
void |
dequeueUser(org.jxmpp.jid.EntityJid userID)
Removes a user from the workgroup queue.
|
Agent |
getAgent()
Returns the Agent associated to this session.
|
AgentChatHistory |
getAgentHistory(org.jxmpp.jid.EntityBareJid jid,
int maxSessions,
java.util.Date startDate)
Retrieves the AgentChatHistory associated with a particular agent jid.
|
AgentRoster |
getAgentRoster()
Returns the agent roster for the workgroup, which contains.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getChatMetadata(java.lang.String sessionID)
Query for metadata associated with a session id.
|
GenericSettings |
getGenericSettings(org.jivesoftware.smack.XMPPConnection con,
java.lang.String query)
Returns the generic metadata of the workgroup the agent belongs to.
|
MacroGroup |
getMacros(boolean global)
Asks the workgroup for it's Global Macros.
|
int |
getMaxChats()
Returns the maximum number of chats the agent can participate in.
|
java.util.List<java.lang.String> |
getMetaData(java.lang.String key)
Allows the retrieval of meta data for a specified key.
|
ChatNotes |
getNote(java.lang.String sessionID)
Retrieves the ChatNote associated with a given chat session.
|
OccupantsInfo |
getOccupantsInfo(java.lang.String roomID)
Asks the workgroup for information about the occupants of the specified room.
|
org.jivesoftware.smack.packet.Presence.Mode |
getPresenceMode()
Returns the agent's current presence mode.
|
WorkgroupQueue |
getQueue(org.jxmpp.jid.parts.Resourcepart queueName)
Get queue.
|
WorkgroupQueue |
getQueue(java.lang.String queueName)
Get queue.
|
java.util.Iterator<WorkgroupQueue> |
getQueues() |
SearchSettings |
getSearchSettings()
Asks the workgroup for it's Search Settings.
|
Transcript |
getTranscript(java.lang.String sessionID)
Returns the full conversation transcript of a given session.
|
Transcripts |
getTranscripts(org.jxmpp.jid.Jid userID)
Returns the transcripts of a given user.
|
org.jivesoftware.smackx.xdata.Form |
getTranscriptSearchForm()
Returns the Form to use for searching transcripts.
|
org.jxmpp.jid.Jid |
getWorkgroupJID()
Get workgroup JID.
|
boolean |
hasMonitorPrivileges(org.jivesoftware.smack.XMPPConnection con) |
boolean |
isOnline()
Returns true if the agent is online with the workgroup.
|
void |
makeRoomOwner(org.jivesoftware.smack.XMPPConnection con,
java.lang.String sessionID) |
void |
removeInvitationListener(WorkgroupInvitationListener invitationListener)
Removes an invitation listener.
|
void |
removeMetaData(java.lang.String key)
Allows the removal of data from the agent's meta data, if the key represents existing data,
the revised meta data will be rebroadcast in an agent's presence broadcast.
|
void |
removeOfferListener(OfferListener offerListener)
Removes an offer listener.
|
void |
removeQueueUsersListener(QueueUsersListener listener) |
void |
saveMacros(MacroGroup group)
Persists the Personal Macro for an agent.
|
org.jivesoftware.smackx.search.ReportedData |
searchTranscripts(org.jivesoftware.smackx.xdata.Form completedForm)
Submits the completed form and returns the result of the transcript search.
|
void |
sendRoomInvitation(RoomInvitation.Type type,
org.jxmpp.jid.Jid invitee,
java.lang.String sessionID,
java.lang.String reason)
Invites a user or agent to an existing session support.
|
void |
sendRoomTransfer(RoomTransfer.Type type,
java.lang.String invitee,
java.lang.String sessionID,
java.lang.String reason)
Transfer an existing session support to another user or agent.
|
void |
setMetaData(java.lang.String key,
java.lang.String val)
Allows the addition of a new key-value pair to the agent's meta data, if the value is
new data, the revised meta data will be rebroadcast in an agent's presence broadcast.
|
void |
setNote(java.lang.String sessionID,
java.lang.String note)
Creates a ChatNote that will be mapped to the given chat session.
|
void |
setOnline(boolean online)
Sets whether the agent is online with the workgroup.
|
void |
setStatus(org.jivesoftware.smack.packet.Presence.Mode presenceMode,
int maxChats)
Sets the agent's current status with the workgroup.
|
void |
setStatus(org.jivesoftware.smack.packet.Presence.Mode presenceMode,
int maxChats,
java.lang.String status)
Sets the agent's current status with the workgroup.
|
void |
setStatus(org.jivesoftware.smack.packet.Presence.Mode presenceMode,
java.lang.String status)
Sets the agent's current status with the workgroup.
|
public AgentSession(org.jxmpp.jid.EntityBareJid workgroupJID, org.jivesoftware.smack.XMPPConnection connection)
setOnline(boolean)
method must be called with an argument of true
to mark the agent
as available to accept chat requests.connection
- a connection instance which must have already gone through
authentication.workgroupJID
- the fully qualified JID of the workgroup.public void close()
public AgentRoster getAgentRoster() throws org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public org.jivesoftware.smack.packet.Presence.Mode getPresenceMode()
public int getMaxChats()
public boolean isOnline()
public void setMetaData(java.lang.String key, java.lang.String val) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException, java.lang.InterruptedException
key
- the meta data keyval
- the non-null meta data valueorg.jivesoftware.smack.XMPPException
- if an exception occurs.org.jivesoftware.smack.SmackException
- if Smack detected an exceptional situation.java.lang.InterruptedException
- if the calling thread was interrupted.public void removeMetaData(java.lang.String key) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException, java.lang.InterruptedException
key
- the meta data key.org.jivesoftware.smack.XMPPException
- if an exception occurs.org.jivesoftware.smack.SmackException
- if Smack detected an exceptional situation.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<java.lang.String> getMetaData(java.lang.String key)
key
- the meta data keynull
if the meta-data
doesn't exist..public void setOnline(boolean online) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException, java.lang.InterruptedException
online
- true to set the agent as online with the workgroup.org.jivesoftware.smack.XMPPException
- if an error occurs setting the online status.org.jivesoftware.smack.SmackException
- assertEquals(SmackException.Type.NO_RESPONSE_FROM_SERVER, e.getType());
return;java.lang.InterruptedException
- if the calling thread was interrupted.public void setStatus(org.jivesoftware.smack.packet.Presence.Mode presenceMode, int maxChats) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException, java.lang.InterruptedException
presenceMode
- the presence mode of the agent.maxChats
- the maximum number of chats the agent is willing to accept.org.jivesoftware.smack.XMPPException
- if an error occurs setting the agent status.org.jivesoftware.smack.SmackException
- if Smack detected an exceptional situation.java.lang.InterruptedException
- if the calling thread was interrupted.java.lang.IllegalStateException
- if the agent is not online with the workgroup.public void setStatus(org.jivesoftware.smack.packet.Presence.Mode presenceMode, int maxChats, java.lang.String status) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
presenceMode
- the presence mode of the agent.maxChats
- the maximum number of chats the agent is willing to accept.status
- sets the status message of the presence update.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.java.lang.IllegalStateException
- if the agent is not online with the workgroup.public void setStatus(org.jivesoftware.smack.packet.Presence.Mode presenceMode, java.lang.String status) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
presenceMode
- the presence mode of the agent.status
- sets the status message of the presence update.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.java.lang.IllegalStateException
- if the agent is not online with the workgroup.public void dequeueUser(org.jxmpp.jid.EntityJid userID) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
userID
- the ID of the user to remove.org.jivesoftware.smack.XMPPException
- if an exception occurs.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public Transcripts getTranscripts(org.jxmpp.jid.Jid userID) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException, java.lang.InterruptedException
userID
- the id of the user to get his conversations.org.jivesoftware.smack.XMPPException
- if an error occurs while getting the information.org.jivesoftware.smack.SmackException
- if Smack detected an exceptional situation.java.lang.InterruptedException
- if the calling thread was interrupted.public Transcript getTranscript(java.lang.String sessionID) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException, java.lang.InterruptedException
sessionID
- the id of the session to get the full transcript.org.jivesoftware.smack.XMPPException
- if an error occurs while getting the information.org.jivesoftware.smack.SmackException
- if Smack detected an exceptional situation.java.lang.InterruptedException
- if the calling thread was interrupted.public org.jivesoftware.smackx.xdata.Form getTranscriptSearchForm() throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException, java.lang.InterruptedException
org.jivesoftware.smack.XMPPException
- if an error occurs while sending the request to the server.org.jivesoftware.smack.SmackException
- if Smack detected an exceptional situation.java.lang.InterruptedException
- if the calling thread was interrupted.public org.jivesoftware.smackx.search.ReportedData searchTranscripts(org.jivesoftware.smackx.xdata.Form completedForm) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException, java.lang.InterruptedException
completedForm
- the filled out search form.org.jivesoftware.smack.SmackException
- if Smack detected an exceptional situation.org.jivesoftware.smack.XMPPException
- if an XMPP protocol error was received.java.lang.InterruptedException
- if the calling thread was interrupted.public OccupantsInfo getOccupantsInfo(java.lang.String roomID) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
roomID
- the room to get information about its occupants.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public org.jxmpp.jid.Jid getWorkgroupJID()
public Agent getAgent()
public WorkgroupQueue getQueue(java.lang.String queueName)
queueName
- the name of the queuepublic WorkgroupQueue getQueue(org.jxmpp.jid.parts.Resourcepart queueName)
queueName
- the name of the queuepublic java.util.Iterator<WorkgroupQueue> getQueues()
public void addQueueUsersListener(QueueUsersListener listener)
public void removeQueueUsersListener(QueueUsersListener listener)
public void addOfferListener(OfferListener offerListener)
offerListener
- the offer listener.public void removeOfferListener(OfferListener offerListener)
offerListener
- the offer listener.public void addInvitationListener(WorkgroupInvitationListener invitationListener)
invitationListener
- the invitation listener.public void removeInvitationListener(WorkgroupInvitationListener invitationListener)
invitationListener
- the invitation listener.public void setNote(java.lang.String sessionID, java.lang.String note) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
sessionID
- the session id of a Chat Session.note
- the chat note to add.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public ChatNotes getNote(java.lang.String sessionID) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
sessionID
- the sessionID of the chat session.ChatNote
associated with a given chat session.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if an error occurs while retrieving the ChatNote.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public AgentChatHistory getAgentHistory(org.jxmpp.jid.EntityBareJid jid, int maxSessions, java.util.Date startDate) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
jid
- the jid of the agent.maxSessions
- the max number of sessions to retrieve.startDate
- point in time from which on history should get retrieved.org.jivesoftware.smack.XMPPException
- if an error occurs while retrieving the AgentChatHistory.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public SearchSettings getSearchSettings() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public MacroGroup getMacros(boolean global) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
global
- true to retrieve global macros, otherwise false for personal macros.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if an error occurs while getting information from the server.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public void saveMacros(MacroGroup group) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
group
- the macro group to save.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getChatMetadata(java.lang.String sessionID) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
sessionID
- the sessionID to query for.org.jivesoftware.smack.XMPPException
- if an error occurs while getting information from the server.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public void sendRoomInvitation(RoomInvitation.Type type, org.jxmpp.jid.Jid invitee, java.lang.String sessionID, java.lang.String reason) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
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.
The agent or user that accepted the offer MUST join the room. Failing to do so will make the invitation to fail. The inviter will eventually receive a message error indicating that the invitee 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 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.
type
- type of entity that will get the invitation.invitee
- JID of entity that will get the invitation.sessionID
- ID of the support session that the invitee is being invited.reason
- the reason of the invitation.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if the sender of the invitation is not an agent or the service failed to process
the request.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public void sendRoomTransfer(RoomTransfer.Type type, java.lang.String invitee, java.lang.String sessionID, java.lang.String reason) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
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.
Once the invitee joins the support room the workgroup service will kick the inviter from the room.
Different situations may lead to a failed transfers. Possible cases are: 1) all agents rejected the 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.
type
- type of entity that will get the invitation.invitee
- JID of entity that will get the invitation.sessionID
- ID of the support session that the invitee is being invited.reason
- the reason of the invitation.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if the sender of the invitation is not an agent or the service failed to process
the request.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public GenericSettings getGenericSettings(org.jivesoftware.smack.XMPPConnection con, java.lang.String query) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
con
- the XMPPConnection to use.query
- an optional query object used to tell the server what metadata to retrieve. This can be null.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if an error occurs while sending the request to the server.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public boolean hasMonitorPrivileges(org.jivesoftware.smack.XMPPConnection con) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException
public void makeRoomOwner(org.jivesoftware.smack.XMPPConnection con, java.lang.String sessionID) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException