1 /**
  2  * @fileOverview JavaScript representation of the Finesse SystemInfo object
  3  *
  4  * @name SystemInfo
  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 /** @private */
 15 finesse.restservices.SystemInfo = finesse.restservices.RestBase.extend(/** @lends finesse.restservices.SystemInfo.prototype */{
 16   
 17     /**
 18      * @private
 19      * Returns whether this object supports subscriptions
 20      */
 21     supportsSubscriptions: false,
 22   
 23     /**
 24      * @class
 25 	 * JavaScript representation of a SystemInfo object. Also exposes methods to operate
 26 	 * on the object against the server.
 27      *
 28 	 * @param {Object} options
 29 	 *     An object with the following properties:<ul>
 30      *         <li><b>id:</b> The id of the object being constructed</li>
 31      *         <li><b>onLoad(this): (optional)</b> when the object is successfully loaded from the server</li>
 32      *         <li><b>onChange(this): (optional)</b> when an update notification of the object is received</li>
 33      *         <li><b>onAdd(this): (optional)</b> when a notification that the object is created is received</li>
 34      *         <li><b>onDelete(this): (optional)</b> when a notification that the object is deleted is received</li>
 35      *         <li><b>onError(rsp): (optional)</b> if loading of the object fails, invoked with the error response object:<ul>
 36      *             <li><b>status:</b> {Number} The HTTP status code returned</li>
 37      *             <li><b>content:</b> {String} Raw string of response</li>
 38      *             <li><b>object:</b> {Object} Parsed object of response</li>
 39      *             <li><b>error:</b> {Object} Wrapped exception that was caught:<ul>
 40      *                 <li><b>errorType:</b> {String} Type of error that was caught</li>
 41      *                 <li><b>errorMessage:</b> {String} Message associated with error</li>
 42      *             </ul></li>
 43      *         </ul></li>
 44      *         <li><b>parentObj: (optional)</b> The parent object</li></ul>
 45      * @constructs finesse.restservices.MediaPropertiesLayout
 46      **/
 47     init: function (id, callbacks, restObj)
 48     {
 49         this._super(id, callbacks, restObj);
 50     },
 51 
 52     /**
 53      * @private
 54      * Gets the REST class for the current object - this is the SystemInfo object.
 55      */
 56     getRestClass: function () {
 57         return finesse.restservices.SystemInfo;
 58     },
 59 
 60     /**
 61      * @private
 62      * Gets the REST type for the current object - this is a "SystemInfo".
 63      */
 64     getRestType: function ()
 65     {
 66         return "SystemInfo";
 67     },
 68     
 69     _validate: function (obj)
 70     {
 71         return true;
 72     },
 73     
 74     /**
 75      * Returns the status coresponding to this SystemInfo object:
 76      *   IN_SERVICE if the Finesse API reports that it is in service,
 77      *   OUT_OF_SERVICE otherwise.
 78      */
 79     getStatus: function () {
 80         this.isLoaded();
 81         return this.getData().status;
 82     },
 83     
 84     /**
 85      * Getter for the xmpp domain of the system
 86      * @returns {String} The xmpp domain coresponding to this SystemInfo object
 87      */
 88     getXmppDomain: function () {
 89         this.isLoaded();
 90         return this.getData().xmppDomain;
 91     },
 92     
 93     /**
 94      * Getter for the xmpp pubsub domain of the system
 95      * @returns {String} The xmpp pubsub domain coresponding to this SystemInfo object:
 96      */
 97     getXmppPubSubDomain: function () {
 98         this.isLoaded();
 99         return this.getData().xmppPubSubDomain;
100     }
101 });
102 
103 /**
104  * State constants
105  */
106 finesse.restservices.SystemInfo.Statuses = {
107     IN_SERVICE: "IN_SERVICE",
108     OUT_OF_SERVICE: "OUT_OF_SERVICE"
109 };
110