001/**
002 *
003 * Copyright 2003-2007 Jive Software.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.jivesoftware.smackx.workgroup;
019
020import java.util.List;
021import java.util.Map;
022
023import org.jxmpp.jid.Jid;
024
025/**
026 * An immutable class wrapping up the basic information which comprises a group chat invitation.
027 *
028 * @author loki der quaeler
029 */
030public class WorkgroupInvitation {
031
032    protected Jid uniqueID;
033
034    protected String sessionID;
035
036    protected Jid groupChatName;
037    protected Jid issuingWorkgroupName;
038    protected String messageBody;
039    protected Jid invitationSender;
040    protected Map<String, List<String>> metaData;
041
042    /**
043     * This calls the 5-argument constructor with a null MetaData argument value.
044     *
045     * @param jid the jid string with which the issuing AgentSession or Workgroup instance
046     *                  was created
047     * @param group the jid of the room to which the person is invited
048     * @param workgroup the jid of the workgroup issuing the invitation
049     * @param sessID the session id associated with the pending chat
050     * @param msgBody the body of the message which contained the invitation
051     * @param from the user jid who issued the invitation, if known, null otherwise
052     */
053    public WorkgroupInvitation (Jid jid, Jid group, Jid workgroup,
054                       String sessID, String msgBody, Jid from) {
055        this(jid, group, workgroup, sessID, msgBody, from, null);
056    }
057
058    /**
059     * WorkgroupInvitation.
060     * @param jid the jid string with which the issuing AgentSession or Workgroup instance.
061     *                  was created
062     * @param group the jid of the room to which the person is invited
063     * @param workgroup the jid of the workgroup issuing the invitation
064     * @param sessID the session id associated with the pending chat
065     * @param msgBody the body of the message which contained the invitation
066     * @param from the user jid who issued the invitation, if known, null otherwise
067     * @param metaData the metadata sent with the invitation
068     */
069    public WorkgroupInvitation (Jid jid, Jid group, Jid workgroup, String sessID, String msgBody,
070                       Jid from, Map<String, List<String>> metaData) {
071        super();
072
073        this.uniqueID = jid;
074        this.sessionID = sessID;
075        this.groupChatName = group;
076        this.issuingWorkgroupName = workgroup;
077        this.messageBody = msgBody;
078        this.invitationSender = from;
079        this.metaData = metaData;
080    }
081
082    /**
083     * Get the unique id.
084     * @return the jid string with which the issuing AgentSession or Workgroup instance
085     *  was created.
086     */
087    public Jid getUniqueID () {
088        return this.uniqueID;
089    }
090
091    /**
092     * Get the session id.
093     * @return the session id associated with the pending chat; working backwards temporally
094     *              this session id should match the session id to the corresponding offer request
095     *              which resulted in this invitation.
096     */
097    public String getSessionID () {
098        return this.sessionID;
099    }
100
101    /**
102     * Get the group chat name.
103     * @return the jid of the room to which the person is invited.
104     */
105    public Jid getGroupChatName () {
106        return this.groupChatName;
107    }
108
109    /**
110     * Get workgroup name.
111     * @return the name of the workgroup from which the invitation was issued.
112     */
113    public Jid getWorkgroupName () {
114        return this.issuingWorkgroupName;
115    }
116
117    /**
118     * Get the message body.
119     * @return the contents of the body-block of the message that housed this invitation.
120     */
121    public String getMessageBody () {
122        return this.messageBody;
123    }
124
125    /**
126     * Get invitation sender.
127     * @return the user who issued the invitation, or null if it wasn't known.
128     */
129    public Jid getInvitationSender () {
130        return this.invitationSender;
131    }
132
133    /**
134     * Get meta data.
135     * @return the meta data associated with the invitation, or null if this instance was
136     *              constructed with none
137     */
138    public Map<String, List<String>> getMetaData () {
139        return this.metaData;
140    }
141
142}