本文整理汇总了Java中org.jivesoftware.smackx.workgroup.MetaData类的典型用法代码示例。如果您正苦于以下问题:Java MetaData类的具体用法?Java MetaData怎么用?Java MetaData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetaData类属于org.jivesoftware.smackx.workgroup包,在下文中一共展示了MetaData类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setStatus
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
/**
* Sets the agent's current status with the workgroup. The presence mode affects how offers
* are routed to the agent. The possible presence modes with their meanings are as follows:<ul>
* <p/>
* <li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats
* (equivalent to Presence.Mode.CHAT).
* <li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed.
* However, special case, or extreme urgency chats may still be offered to the agent.
* <li>Presence.Mode.AWAY -- the agent is not available and should not
* have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul>
*
* @param presenceMode the presence mode of the agent.
* @param status sets the status message of the presence update.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
* @throws IllegalStateException if the agent is not online with the workgroup.
*/
public void setStatus(Presence.Mode presenceMode, String status) throws NoResponseException, XMPPErrorException, NotConnectedException {
if (!online) {
throw new IllegalStateException("Cannot set status when the agent is not online.");
}
if (presenceMode == null) {
presenceMode = Presence.Mode.available;
}
this.presenceMode = presenceMode;
Presence presence = new Presence(Presence.Type.available);
presence.setMode(presenceMode);
presence.setTo(this.getWorkgroupJID());
if (status != null) {
presence.setStatus(status);
}
presence.addExtension(new MetaData(this.metaData));
PacketCollector collector = this.connection.createPacketCollectorAndSend(new AndFilter(new StanzaTypeFilter(Presence.class),
FromMatchesFilter.create(workgroupJID)), presence);
collector.nextResultOrThrow();
}
示例2: getMessage
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
private Message getMessage(String messageText, RequestUtils util, boolean transfer) {
Map metadata = new HashMap();
metadata.put("messageText", messageText);
metadata.put("username", util.getUsername());
metadata.put("userID", util.getUserID());
metadata.put("transfer", Boolean.toString(transfer));
metadata.put("question", util.getQuestion());
metadata.put("email", util.getEmailAddress());
metadata.put("workgroup", util.getWorkgroup());
if (ModelUtil.hasLength(util.getRequestLocation())) {
metadata.put("Location", util.getRequestLocation());
}
// Add Metadata as message extension
final MetaData data = new MetaData(metadata);
Message message = new Message();
message.addExtension(data);
return message;
}
示例3: setStatus
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
/**
* Sets the agent's current status with the workgroup. The presence mode affects how offers
* are routed to the agent. The possible presence modes with their meanings are as follows:<ul>
* <p/>
* <li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats
* (equivalent to Presence.Mode.CHAT).
* <li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed.
* However, special case, or extreme urgency chats may still be offered to the agent.
* <li>Presence.Mode.AWAY -- the agent is not available and should not
* have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul>
*
* @param presenceMode the presence mode of the agent.
* @param status sets the status message of the presence update.
* @throws XMPPException if an error occurs setting the agent status.
* @throws IllegalStateException if the agent is not online with the workgroup.
*/
public void setStatus(Presence.Mode presenceMode, String status) throws XMPPException {
if (!online) {
throw new IllegalStateException("Cannot set status when the agent is not online.");
}
if (presenceMode == null) {
presenceMode = Presence.Mode.available;
}
this.presenceMode = presenceMode;
Presence presence = new Presence(Presence.Type.available);
presence.setMode(presenceMode);
presence.setTo(this.getWorkgroupJID());
if (status != null) {
presence.setStatus(status);
}
presence.addExtension(new MetaData(this.metaData));
PacketCollector collector = this.connection.createPacketCollector(new AndFilter(new PacketTypeFilter(Presence.class),
new FromContainsFilter(workgroupJID)));
this.connection.sendPacket(presence);
presence = (Presence)collector.nextResult(5000);
collector.cancel();
if (!presence.isAvailable()) {
throw new XMPPException("No response from server on status set.");
}
if (presence.getError() != null) {
throw new XMPPException(presence.getError());
}
}
示例4: parseExtension
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
/**
* PacketExtensionProvider implementation
*/
public PacketExtension parseExtension (XmlPullParser parser)
throws Exception {
Map metaData = MetaDataUtils.parseMetaData(parser);
return new MetaData(metaData);
}
示例5: parseExtension
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
/**
* PacketExtensionProvider implementation
*/
public PacketExtension parseExtension (XmlPullParser parser)
throws Exception {
Map<String, List<String>> metaData = MetaDataUtils.parseMetaData(parser);
return new MetaData(metaData);
}
示例6: setStatus
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
/**
* Sets the agent's current status with the workgroup. The presence mode
* affects how offers are routed to the agent. The possible presence modes
* with their meanings are as follows:
* <ul>
* <p/>
* <li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more
* chats (equivalent to Presence.Mode.CHAT).
* <li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be
* disturbed. However, special case, or extreme urgency chats may still be
* offered to the agent.
* <li>Presence.Mode.AWAY -- the agent is not available and should not have
* a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).
* </ul>
*
* @param presenceMode
* the presence mode of the agent.
* @param status
* sets the status message of the presence update.
* @throws XMPPException
* if an error occurs setting the agent status.
* @throws IllegalStateException
* if the agent is not online with the workgroup.
*/
public void setStatus(Presence.Mode presenceMode, String status)
throws XMPPException {
if (!online) {
throw new IllegalStateException(
"Cannot set status when the agent is not online.");
}
if (presenceMode == null) {
presenceMode = Presence.Mode.available;
}
this.presenceMode = presenceMode;
Presence presence = new Presence(Presence.Type.available);
presence.setMode(presenceMode);
presence.setTo(this.getWorkgroupJID());
if (status != null) {
presence.setStatus(status);
}
presence.addExtension(new MetaData(this.metaData));
PacketCollector collector = this.connection
.createPacketCollector(new AndFilter(new PacketTypeFilter(
Presence.class), new FromContainsFilter(workgroupJID)));
this.connection.sendPacket(presence);
presence = (Presence) collector.nextResult(5000);
collector.cancel();
if (!presence.isAvailable()) {
throw new XMPPException("No response from server on status set.");
}
if (presence.getError() != null) {
throw new XMPPException(presence.getError());
}
}
示例7: parseExtension
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
/**
* PacketExtensionProvider implementation
*/
public PacketExtension parseExtension(XmlPullParser parser)
throws Exception {
Map metaData = MetaDataUtils.parseMetaData(parser);
return new MetaData(metaData);
}
示例8: handlePacket
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
private void handlePacket(Stanza packet) {
if (packet instanceof Message) {
Message msg = (Message)packet;
// Check to see if the user left the queue.
ExtensionElement pe = msg.getExtension("depart-queue", "http://jabber.org/protocol/workgroup");
ExtensionElement queueStatus = msg.getExtension("queue-status", "http://jabber.org/protocol/workgroup");
if (pe != null) {
fireQueueDepartedEvent();
}
else if (queueStatus != null) {
QueueUpdate queueUpdate = (QueueUpdate)queueStatus;
if (queueUpdate.getPosition() != -1) {
fireQueuePositionEvent(queueUpdate.getPosition());
}
if (queueUpdate.getRemaingTime() != -1) {
fireQueueTimeEvent(queueUpdate.getRemaingTime());
}
}
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.Invite invite = mucUser != null ? mucUser.getInvite() : null;
if (invite != null && workgroupJID.equals(invite.getFrom())) {
String sessionID = null;
Map<String, List<String>> metaData = null;
pe = msg.getExtension(SessionID.ELEMENT_NAME,
SessionID.NAMESPACE);
if (pe != null) {
sessionID = ((SessionID)pe).getSessionID();
}
pe = msg.getExtension(MetaData.ELEMENT_NAME,
MetaData.NAMESPACE);
if (pe != null) {
metaData = ((MetaData)pe).getMetaData();
}
WorkgroupInvitation inv = new WorkgroupInvitation(connection.getUser(), msg.getFrom(),
workgroupJID, sessionID, msg.getBody(),
msg.getFrom(), metaData);
fireInvitationEvent(inv);
}
}
}
}
示例9: parse
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
/**
* PacketExtensionProvider implementation
* @throws IOException
* @throws XmlPullParserException
*/
public MetaData parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
Map<String, List<String>> metaData = MetaDataUtils.parseMetaData(parser);
return new MetaData(metaData);
}
示例10: handlePacket
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
private void handlePacket(Packet packet) {
if (packet instanceof Message) {
Message msg = (Message)packet;
// Check to see if the user left the queue.
PacketExtension pe = msg.getExtension("depart-queue", "http://jabber.org/protocol/workgroup");
PacketExtension queueStatus = msg.getExtension("queue-status", "http://jabber.org/protocol/workgroup");
if (pe != null) {
fireQueueDepartedEvent();
}
else if (queueStatus != null) {
QueueUpdate queueUpdate = (QueueUpdate)queueStatus;
if (queueUpdate.getPosition() != -1) {
fireQueuePositionEvent(queueUpdate.getPosition());
}
if (queueUpdate.getRemaingTime() != -1) {
fireQueueTimeEvent(queueUpdate.getRemaingTime());
}
}
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.Invite invite = mucUser != null ? mucUser.getInvite() : null;
if (invite != null && workgroupJID.equals(invite.getFrom())) {
String sessionID = null;
Map metaData = null;
pe = msg.getExtension(SessionID.ELEMENT_NAME,
SessionID.NAMESPACE);
if (pe != null) {
sessionID = ((SessionID)pe).getSessionID();
}
pe = msg.getExtension(MetaData.ELEMENT_NAME,
MetaData.NAMESPACE);
if (pe != null) {
metaData = ((MetaData)pe).getMetaData();
}
WorkgroupInvitation inv = new WorkgroupInvitation(connection.getUser(), msg.getFrom(),
workgroupJID, sessionID, msg.getBody(),
msg.getFrom(), metaData);
fireInvitationEvent(inv);
}
}
}
}
示例11: handlePacket
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
private void handlePacket(Packet packet) {
if (packet instanceof Message) {
Message msg = (Message)packet;
// Check to see if the user left the queue.
PacketExtension pe = msg.getExtension("depart-queue", "http://jabber.org/protocol/workgroup");
PacketExtension queueStatus = msg.getExtension("queue-status", "http://jabber.org/protocol/workgroup");
if (pe != null) {
fireQueueDepartedEvent();
}
else if (queueStatus != null) {
QueueUpdate queueUpdate = (QueueUpdate)queueStatus;
if (queueUpdate.getPosition() != -1) {
fireQueuePositionEvent(queueUpdate.getPosition());
}
if (queueUpdate.getRemaingTime() != -1) {
fireQueueTimeEvent(queueUpdate.getRemaingTime());
}
}
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.Invite invite = mucUser != null ? mucUser.getInvite() : null;
if (invite != null && workgroupJID.equals(invite.getFrom())) {
String sessionID = null;
Map<String, List<String>> metaData = null;
pe = msg.getExtension(SessionID.ELEMENT_NAME,
SessionID.NAMESPACE);
if (pe != null) {
sessionID = ((SessionID)pe).getSessionID();
}
pe = msg.getExtension(MetaData.ELEMENT_NAME,
MetaData.NAMESPACE);
if (pe != null) {
metaData = ((MetaData)pe).getMetaData();
}
WorkgroupInvitation inv = new WorkgroupInvitation(connection.getUser(), msg.getFrom(),
workgroupJID, sessionID, msg.getBody(),
msg.getFrom(), metaData);
fireInvitationEvent(inv);
}
}
}
}
示例12: handlePacket
import org.jivesoftware.smackx.workgroup.MetaData; //导入依赖的package包/类
private void handlePacket(Packet packet) {
if (packet instanceof Message) {
Message msg = (Message) packet;
// Check to see if the user left the queue.
PacketExtension pe = msg.getExtension("depart-queue",
"http://jabber.org/protocol/workgroup");
PacketExtension queueStatus = msg.getExtension("queue-status",
"http://jabber.org/protocol/workgroup");
if (pe != null) {
fireQueueDepartedEvent();
} else if (queueStatus != null) {
QueueUpdate queueUpdate = (QueueUpdate) queueStatus;
if (queueUpdate.getPosition() != -1) {
fireQueuePositionEvent(queueUpdate.getPosition());
}
if (queueUpdate.getRemaingTime() != -1) {
fireQueueTimeEvent(queueUpdate.getRemaingTime());
}
}
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.Invite invite = mucUser != null ? mucUser.getInvite()
: null;
if (invite != null && workgroupJID.equals(invite.getFrom())) {
String sessionID = null;
Map metaData = null;
pe = msg.getExtension(SessionID.ELEMENT_NAME,
SessionID.NAMESPACE);
if (pe != null) {
sessionID = ((SessionID) pe).getSessionID();
}
pe = msg.getExtension(MetaData.ELEMENT_NAME,
MetaData.NAMESPACE);
if (pe != null) {
metaData = ((MetaData) pe).getMetaData();
}
WorkgroupInvitation inv = new WorkgroupInvitation(
connection.getUser(), msg.getFrom(), workgroupJID,
sessionID, msg.getBody(), msg.getFrom(), metaData);
fireInvitationEvent(inv);
}
}
}
}