WorkgroupInvitation.java

  1. /**
  2.  *
  3.  * Copyright 2003-2007 Jive Software.
  4.  *
  5.  * Licensed under the Apache License, Version 2.0 (the "License");
  6.  * you may not use this file except in compliance with the License.
  7.  * You may obtain a copy of the License at
  8.  *
  9.  *     http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */

  17. package org.jivesoftware.smackx.workgroup;

  18. import java.util.List;
  19. import java.util.Map;

  20. import org.jxmpp.jid.Jid;

  21. /**
  22.  * An immutable class wrapping up the basic information which comprises a group chat invitation.
  23.  *
  24.  * @author loki der quaeler
  25.  */
  26. public class WorkgroupInvitation {

  27.     protected Jid uniqueID;

  28.     protected String sessionID;

  29.     protected Jid groupChatName;
  30.     protected Jid issuingWorkgroupName;
  31.     protected String messageBody;
  32.     protected Jid invitationSender;
  33.     protected Map<String, List<String>> metaData;

  34.     /**
  35.      * This calls the 5-argument constructor with a null MetaData argument value
  36.      *
  37.      * @param jid the jid string with which the issuing AgentSession or Workgroup instance
  38.      *                  was created
  39.      * @param group the jid of the room to which the person is invited
  40.      * @param workgroup the jid of the workgroup issuing the invitation
  41.      * @param sessID the session id associated with the pending chat
  42.      * @param msgBody the body of the message which contained the invitation
  43.      * @param from the user jid who issued the invitation, if known, null otherwise
  44.      */
  45.     public WorkgroupInvitation (Jid jid, Jid group, Jid workgroup,
  46.                        String sessID, String msgBody, Jid from) {
  47.         this(jid, group, workgroup, sessID, msgBody, from, null);
  48.     }

  49.     /**
  50.      * @param jid the jid string with which the issuing AgentSession or Workgroup instance
  51.      *                  was created
  52.      * @param group the jid of the room to which the person is invited
  53.      * @param workgroup the jid of the workgroup issuing the invitation
  54.      * @param sessID the session id associated with the pending chat
  55.      * @param msgBody the body of the message which contained the invitation
  56.      * @param from the user jid who issued the invitation, if known, null otherwise
  57.      * @param metaData the metadata sent with the invitation
  58.      */
  59.     public WorkgroupInvitation (Jid jid, Jid group, Jid workgroup, String sessID, String msgBody,
  60.                        Jid from, Map<String, List<String>> metaData) {
  61.         super();

  62.         this.uniqueID = jid;
  63.         this.sessionID = sessID;
  64.         this.groupChatName = group;
  65.         this.issuingWorkgroupName = workgroup;
  66.         this.messageBody = msgBody;
  67.         this.invitationSender = from;
  68.         this.metaData = metaData;
  69.     }

  70.     /**
  71.      * @return the jid string with which the issuing AgentSession or Workgroup instance
  72.      *  was created.
  73.      */
  74.     public Jid getUniqueID () {
  75.         return this.uniqueID;
  76.     }

  77.     /**
  78.      * @return the session id associated with the pending chat; working backwards temporally,
  79.      *              this session id should match the session id to the corresponding offer request
  80.      *              which resulted in this invitation.
  81.      */
  82.     public String getSessionID () {
  83.         return this.sessionID;
  84.     }

  85.     /**
  86.      * @return the jid of the room to which the person is invited.
  87.      */
  88.     public Jid getGroupChatName () {
  89.         return this.groupChatName;
  90.     }

  91.     /**
  92.      * @return the name of the workgroup from which the invitation was issued.
  93.      */
  94.     public Jid getWorkgroupName () {
  95.         return this.issuingWorkgroupName;
  96.     }

  97.     /**
  98.      * @return the contents of the body-block of the message that housed this invitation.
  99.      */
  100.     public String getMessageBody () {
  101.         return this.messageBody;
  102.     }

  103.     /**
  104.      * @return the user who issued the invitation, or null if it wasn't known.
  105.      */
  106.     public Jid getInvitationSender () {
  107.         return this.invitationSender;
  108.     }

  109.     /**
  110.      * @return the meta data associated with the invitation, or null if this instance was
  111.      *              constructed with none
  112.      */
  113.     public Map<String, List<String>> getMetaData () {
  114.         return this.metaData;
  115.     }

  116. }