QueueUser.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.Date;

  19. /**
  20.  * An immutable class which wraps up customer-in-queue data return from the server; depending on
  21.  * the type of information dispatched from the server, not all information will be available in
  22.  * any given instance.
  23.  *
  24.  * @author loki der quaeler
  25.  */
  26. public class QueueUser {

  27.     private String userID;

  28.     private int queuePosition;
  29.     private int estimatedTime;
  30.     private Date joinDate;

  31.     /**
  32.      * @param uid the user jid of the customer in the queue
  33.      * @param position the position customer sits in the queue
  34.      * @param time the estimate of how much longer the customer will be in the queue in seconds
  35.      * @param joinedAt the timestamp of when the customer entered the queue
  36.      */
  37.     public QueueUser (String uid, int position, int time, Date joinedAt) {
  38.         super();

  39.         this.userID = uid;
  40.         this.queuePosition = position;
  41.         this.estimatedTime = time;
  42.         this.joinDate = joinedAt;
  43.     }

  44.     /**
  45.      * @return the user jid of the customer in the queue
  46.      */
  47.     public String getUserID () {
  48.         return this.userID;
  49.     }

  50.     /**
  51.      * @return the position in the queue at which the customer sits, or -1 if the update which
  52.      *          this instance embodies is only a time update instead
  53.      */
  54.     public int getQueuePosition () {
  55.         return this.queuePosition;
  56.     }

  57.     /**
  58.      * @return the estimated time remaining of the customer in the queue in seconds, or -1 if
  59.      *          if the update which this instance embodies is only a position update instead
  60.      */
  61.     public int getEstimatedRemainingTime () {
  62.         return this.estimatedTime;
  63.     }

  64.     /**
  65.      * @return the timestamp of when this customer entered the queue, or null if the server did not
  66.      *          provide this information
  67.      */
  68.     public Date getQueueJoinTimestamp () {
  69.         return this.joinDate;
  70.     }

  71. }