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
023/**
024 * An immutable class wrapping up the basic information which comprises a group chat invitation.
025 *
026 * @author loki der quaeler
027 */
028public class WorkgroupInvitation {
029
030    protected String uniqueID;
031
032    protected String sessionID;
033
034    protected String groupChatName;
035    protected String issuingWorkgroupName;
036    protected String messageBody;
037    protected String invitationSender;
038    protected Map<String, List<String>> metaData;
039
040    /**
041     * This calls the 5-argument constructor with a null MetaData argument value
042     *
043     * @param jid the jid string with which the issuing AgentSession or Workgroup instance
044     *                  was created
045     * @param group the jid of the room to which the person is invited
046     * @param workgroup the jid of the workgroup issuing the invitation
047     * @param sessID the session id associated with the pending chat
048     * @param msgBody the body of the message which contained the invitation
049     * @param from the user jid who issued the invitation, if known, null otherwise
050     */
051    public WorkgroupInvitation (String jid, String group, String workgroup,
052                       String sessID, String msgBody, String from) {
053        this(jid, group, workgroup, sessID, msgBody, from, null);
054    }
055
056    /**
057     * @param jid the jid string with which the issuing AgentSession or Workgroup instance
058     *                  was created
059     * @param group the jid of the room to which the person is invited
060     * @param workgroup the jid of the workgroup issuing the invitation
061     * @param sessID the session id associated with the pending chat
062     * @param msgBody the body of the message which contained the invitation
063     * @param from the user jid who issued the invitation, if known, null otherwise
064     * @param metaData the metadata sent with the invitation
065     */
066    public WorkgroupInvitation (String jid, String group, String workgroup, String sessID, String msgBody,
067                       String from, Map<String, List<String>> metaData) {
068        super();
069
070        this.uniqueID = jid;
071        this.sessionID = sessID;
072        this.groupChatName = group;
073        this.issuingWorkgroupName = workgroup;
074        this.messageBody = msgBody;
075        this.invitationSender = from;
076        this.metaData = metaData;
077    }
078
079    /**
080     * @return the jid string with which the issuing AgentSession or Workgroup instance
081     *  was created.
082     */
083    public String getUniqueID () {
084        return this.uniqueID;
085    }
086
087    /**
088     * @return the session id associated with the pending chat; working backwards temporally,
089     *              this session id should match the session id to the corresponding offer request
090     *              which resulted in this invitation.
091     */
092    public String getSessionID () {
093        return this.sessionID;
094    }
095
096    /**
097     * @return the jid of the room to which the person is invited.
098     */
099    public String getGroupChatName () {
100        return this.groupChatName;
101    }
102
103    /**
104     * @return the name of the workgroup from which the invitation was issued.
105     */
106    public String getWorkgroupName () {
107        return this.issuingWorkgroupName;
108    }
109
110    /**
111     * @return the contents of the body-block of the message that housed this invitation.
112     */
113    public String getMessageBody () {
114        return this.messageBody;
115    }
116
117    /**
118     * @return the user who issued the invitation, or null if it wasn't known.
119     */
120    public String getInvitationSender () {
121        return this.invitationSender;
122    }
123
124    /**
125     * @return the meta data associated with the invitation, or null if this instance was
126     *              constructed with none
127     */
128    public Map<String, List<String>> getMetaData () {
129        return this.metaData;
130    }
131
132}