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.Date; 021 022/** 023 * An immutable class which wraps up customer-in-queue data return from the server; depending on 024 * the type of information dispatched from the server, not all information will be available in 025 * any given instance. 026 * 027 * @author loki der quaeler 028 */ 029public class QueueUser { 030 031 private String userID; 032 033 private int queuePosition; 034 private int estimatedTime; 035 private Date joinDate; 036 037 /** 038 * @param uid the user jid of the customer in the queue 039 * @param position the position customer sits in the queue 040 * @param time the estimate of how much longer the customer will be in the queue in seconds 041 * @param joinedAt the timestamp of when the customer entered the queue 042 */ 043 public QueueUser (String uid, int position, int time, Date joinedAt) { 044 super(); 045 046 this.userID = uid; 047 this.queuePosition = position; 048 this.estimatedTime = time; 049 this.joinDate = joinedAt; 050 } 051 052 /** 053 * @return the user jid of the customer in the queue 054 */ 055 public String getUserID () { 056 return this.userID; 057 } 058 059 /** 060 * @return the position in the queue at which the customer sits, or -1 if the update which 061 * this instance embodies is only a time update instead 062 */ 063 public int getQueuePosition () { 064 return this.queuePosition; 065 } 066 067 /** 068 * @return the estimated time remaining of the customer in the queue in seconds, or -1 if 069 * if the update which this instance embodies is only a position update instead 070 */ 071 public int getEstimatedRemainingTime () { 072 return this.estimatedTime; 073 } 074 075 /** 076 * @return the timestamp of when this customer entered the queue, or null if the server did not 077 * provide this information 078 */ 079 public Date getQueueJoinTimestamp () { 080 return this.joinDate; 081 } 082 083}