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 20 package org.jivesoftware.smackx.workgroup; 21 22 import java.util.Date; 23 24 /** 25 * An immutable class which wraps up customer-in-queue data return from the server; depending on 26 * the type of information dispatched from the server, not all information will be available in 27 * any given instance. 28 * 29 * @author loki der quaeler 30 */ 31 public class QueueUser { 32 33 private String userID; 34 35 private int queuePosition; 36 private int estimatedTime; 37 private Date joinDate; 38 39 /** 40 * @param uid the user jid of the customer in the queue 41 * @param position the position customer sits in the queue 42 * @param time the estimate of how much longer the customer will be in the queue in seconds 43 * @param joinedAt the timestamp of when the customer entered the queue 44 */ 45 public QueueUser (String uid, int position, int time, Date joinedAt) { 46 super(); 47 48 this.userID = uid; 49 this.queuePosition = position; 50 this.estimatedTime = time; 51 this.joinDate = joinedAt; 52 } 53 54 /** 55 * @return the user jid of the customer in the queue 56 */ 57 public String getUserID () { 58 return this.userID; 59 } 60 61 /** 62 * @return the position in the queue at which the customer sits, or -1 if the update which 63 * this instance embodies is only a time update instead 64 */ 65 public int getQueuePosition () { 66 return this.queuePosition; 67 } 68 69 /** 70 * @return the estimated time remaining of the customer in the queue in seconds, or -1 if 71 * if the update which this instance embodies is only a position update instead 72 */ 73 public int getEstimatedRemainingTime () { 74 return this.estimatedTime; 75 } 76 77 /** 78 * @return the timestamp of when this customer entered the queue, or null if the server did not 79 * provide this information 80 */ 81 public Date getQueueJoinTimestamp () { 82 return this.joinDate; 83 } 84 85 } 86