1/**
2 * $Revision$
3 * $Date$
4 *
5 * Copyright 2003-2007 Jive Software.
6 *
7 * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20package org.jivesoftware.smackx.workgroup;
21
22import java.util.List;
23import java.util.Map;
24
25/**
26 * An immutable class wrapping up the basic information which comprises a group chat invitation.
27 *
28 * @author loki der quaeler
29 */
30public class WorkgroupInvitation {
31
32    protected String uniqueID;
33
34    protected String sessionID;
35
36    protected String groupChatName;
37    protected String issuingWorkgroupName;
38    protected String messageBody;
39    protected String invitationSender;
40    protected Map<String, List<String>> metaData;
41
42    /**
43     * This calls the 5-argument constructor with a null MetaData argument value
44     *
45     * @param jid the jid string with which the issuing AgentSession or Workgroup instance
46     *                  was created
47     * @param group the jid of the room to which the person is invited
48     * @param workgroup the jid of the workgroup issuing the invitation
49     * @param sessID the session id associated with the pending chat
50     * @param msgBody the body of the message which contained the invitation
51     * @param from the user jid who issued the invitation, if known, null otherwise
52     */
53    public WorkgroupInvitation (String jid, String group, String workgroup,
54                       String sessID, String msgBody, String from) {
55        this(jid, group, workgroup, sessID, msgBody, from, null);
56    }
57
58    /**
59     * @param jid the jid string with which the issuing AgentSession or Workgroup instance
60     *                  was created
61     * @param group the jid of the room to which the person is invited
62     * @param workgroup the jid of the workgroup issuing the invitation
63     * @param sessID the session id associated with the pending chat
64     * @param msgBody the body of the message which contained the invitation
65     * @param from the user jid who issued the invitation, if known, null otherwise
66     * @param metaData the metadata sent with the invitation
67     */
68    public WorkgroupInvitation (String jid, String group, String workgroup, String sessID, String msgBody,
69                       String from, Map<String, List<String>> metaData) {
70        super();
71
72        this.uniqueID = jid;
73        this.sessionID = sessID;
74        this.groupChatName = group;
75        this.issuingWorkgroupName = workgroup;
76        this.messageBody = msgBody;
77        this.invitationSender = from;
78        this.metaData = metaData;
79    }
80
81    /**
82     * @return the jid string with which the issuing AgentSession or Workgroup instance
83     *  was created.
84     */
85    public String getUniqueID () {
86        return this.uniqueID;
87    }
88
89    /**
90     * @return the session id associated with the pending chat; working backwards temporally,
91     *              this session id should match the session id to the corresponding offer request
92     *              which resulted in this invitation.
93     */
94    public String getSessionID () {
95        return this.sessionID;
96    }
97
98    /**
99     * @return the jid of the room to which the person is invited.
100     */
101    public String getGroupChatName () {
102        return this.groupChatName;
103    }
104
105    /**
106     * @return the name of the workgroup from which the invitation was issued.
107     */
108    public String getWorkgroupName () {
109        return this.issuingWorkgroupName;
110    }
111
112    /**
113     * @return the contents of the body-block of the message that housed this invitation.
114     */
115    public String getMessageBody () {
116        return this.messageBody;
117    }
118
119    /**
120     * @return the user who issued the invitation, or null if it wasn't known.
121     */
122    public String getInvitationSender () {
123        return this.invitationSender;
124    }
125
126    /**
127     * @return the meta data associated with the invitation, or null if this instance was
128     *              constructed with none
129     */
130    public Map<String, List<String>> getMetaData () {
131        return this.metaData;
132    }
133
134}
135