1 /**
  2  * @fileOverview JavaScript representation of the Finesse Queue object
  3  * @author <a href="mailto:tchan2@cisco.com">Tony Chan</a>
  4  * @name finesse.restservices.Queue
  5  * @requires finesse.clientservices.ClientServices
  6  * @requires Class
  7  * @requires finesse.FinesseBase
  8  * @requires finesse.restservices.RestBase
  9  */
 10 
 11 var finesse = finesse || {};
 12 finesse.restservices = finesse.restservices || {};
 13 
 14 /**
 15  * @class
 16  * JavaScript representation of a Queue object. Also exposes methods to operate
 17  * on the object against the server.
 18  *
 19  * @constructor
 20  * @borrows finesse.restservices.RestBase as finesse.restservices.Queue
 21  */
 22 finesse.restservices.Queue = finesse.restservices.RestBase.extend({
 23 
 24     /**
 25      * Initialize the user object.
 26      * @param id is the REST id
 27      * @param callbacks are the callback handlers (onLoad & onError)
 28      **/
 29     init: function (id, callbacks, restObj) {
 30         this._super(id, callbacks, restObj);
 31     },
 32 
 33     /**
 34      * Gets the REST class for the current object - this is the Queue object.
 35      */
 36     getRestClass: function () {
 37         return finesse.restservices.Queue;
 38     },
 39 
 40     /**
 41      * Gets the REST type for the current object - this is a "Queue".
 42      */
 43     getRestType: function () {
 44         return "Queue";
 45     },
 46 
 47     /**
 48      * Returns whether this object supports subscriptions
 49      */
 50     supportsSubscriptions: function () {
 51         return true;
 52     },
 53     
 54     /**
 55      * Specifies whether this object's subscriptions need to be explicitly requested
 56      */
 57     explicitSubscription: true,
 58 
 59     /**
 60      * Specifies that this object should not be refreshed; possible reasons are that
 61      * it's encapsulating collection already does it
 62      */
 63     doNotRefresh: true,
 64     
 65     /**
 66      * Gets the node path for the current object - this is the team Users node
 67      * @returns {String} The node path
 68      */
 69     getXMPPNodePath: function () {
 70         return this.getRestUrl();
 71     },
 72     
 73     /**
 74      * Getter for the queue id
 75      * @returns (String)
 76      *     The id of the Queue
 77      */
 78     getId: function () {
 79         this.isLoaded();
 80         return this._id;
 81     },
 82 	
 83 	/**
 84 	 * Getter for the queue name
 85 	 * @returns (String)
 86 	 *		The name of the Queue
 87 	 */
 88     getName: function () {
 89         this.isLoaded();
 90         return this.getData().name;
 91 	},
 92 	
 93 	/**
 94      * Getter for the queue statistics.
 95      * Supported statistics include:
 96      *  - callsInQueue
 97      *  - startTimeOfLongestCallInQueue
 98      *  
 99      *  These statistics can be accessed via dot notation:
100      *  i.e.: getStatistics().callsInQueue
101      * @returns (Object)
102      *      The Object with different statistics as properties.
103      */
104 	getStatistics: function () {
105 	    this.isLoaded();
106 	    return this.getData().statistics;	    
107 	},
108 
109     /**
110      * Parses a uriString to retrieve the id portion
111      * @param {String} uriString
112      * @return {String} id
113      */
114     _parseIdFromUriString : function (uriString) {
115         return finesse.utilities.Utilities.getId(uriString);
116     }
117 
118 });
119