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 final String userID; 032 033 private final int queuePosition; 034 private final int estimatedTime; 035 private final Date joinDate; 036 037 /** 038 * Queue user. 039 * 040 * @param uid the user jid of the customer in the queue 041 * @param position the position customer sits in the queue 042 * @param time the estimate of how much longer the customer will be in the queue in seconds 043 * @param joinedAt the timestamp of when the customer entered the queue 044 */ 045 public QueueUser (String uid, int position, int time, Date joinedAt) { 046 super(); 047 048 this.userID = uid; 049 this.queuePosition = position; 050 this.estimatedTime = time; 051 this.joinDate = joinedAt; 052 } 053 054 /** 055 * Get user id. 056 * @return the user jid of the customer in the queue 057 */ 058 public String getUserID () { 059 return this.userID; 060 } 061 062 /** 063 * Get queue position. 064 * @return the position in the queue at which the customer sits, or -1 if the update which 065 * this instance embodies is only a time update instead 066 */ 067 public int getQueuePosition () { 068 return this.queuePosition; 069 } 070 071 /** 072 * Get the estimated remaining time. 073 * @return the estimated time remaining of the customer in the queue in seconds, or -1 if 074 * if the update which this instance embodies is only a position update instead 075 */ 076 public int getEstimatedRemainingTime () { 077 return this.estimatedTime; 078 } 079 080 /** 081 * Get queue join timestamp. 082 * @return the timestamp of when this customer entered the queue, or null if the server did not 083 * provide this information 084 */ 085 public Date getQueueJoinTimestamp () { 086 return this.joinDate; 087 } 088 089}