1 /** 2 * The following comment prevents JSLint errors concerning undefined global variables. 3 * It tells JSLint that these identifiers are defined elsewhere. 4 */ 5 /*jslint bitwise:true, browser:true, nomen:true, regexp:true, sloppy:true, white:true */ 6 7 /** The following comment is to prevent jslint errors about 8 * using variables before they are defined. 9 */ 10 /*global $, jQuery, Handlebars, dojox, dojo, console, finesse */ 11 12 /** 13 * @fileOverview JavaScript representation of the Finesse PhoneBook Assignment object. 14 * 15 * @name finesse.restservices.TeamPhoneBook 16 * @requires finesse.clientservices.ClientServices 17 * @requires Class 18 * @requires finesse.FinesseBase 19 * @requires finesse.restservices.RestBase 20 */ 21 22 var finesse = finesse || {}; 23 finesse.restservices = finesse.restservices || {}; 24 25 /** @private */ 26 finesse.restservices.TeamPhoneBook = finesse.restservices.RestBase.extend(/** @lends finesse.restservices.TeamPhoneBook.prototype */{ 27 28 /** 29 * @class 30 * JavaScript representation of a PhoneBook object. Also exposes 31 * methods to operate on the object against the server. 32 * 33 * @param {Object} options 34 * An object with the following properties:<ul> 35 * <li><b>id:</b> The id of the object being constructed</li> 36 * <li><b>onLoad(this): (optional)</b> when the object is successfully loaded from the server</li> 37 * <li><b>onChange(this): (optional)</b> when an update notification of the object is received</li> 38 * <li><b>onAdd(this): (optional)</b> when a notification that the object is created is received</li> 39 * <li><b>onDelete(this): (optional)</b> when a notification that the object is deleted is received</li> 40 * <li><b>onError(rsp): (optional)</b> if loading of the object fails, invoked with the error response object:<ul> 41 * <li><b>status:</b> {Number} The HTTP status code returned</li> 42 * <li><b>content:</b> {String} Raw string of response</li> 43 * <li><b>object:</b> {Object} Parsed object of response</li> 44 * <li><b>error:</b> {Object} Wrapped exception that was caught:<ul> 45 * <li><b>errorType:</b> {String} Type of error that was caught</li> 46 * <li><b>errorMessage:</b> {String} Message associated with error</li> 47 * </ul></li> 48 * </ul></li> 49 * <li><b>parentObj: (optional)</b> The parent object</li></ul> 50 * @constructs finesse.restservices.TeamPhoneBook 51 **/ 52 init: function (options) { 53 this._super(options); 54 }, 55 56 /** 57 * @private 58 * Gets the REST class for the current object - this is the PhoneBooks class. 59 * @returns {Object} The PhoneBooks class. 60 */ 61 getRestClass: function () { 62 return finesse.restservices.TeamPhoneBook; 63 }, 64 65 /** 66 * @private 67 * Gets the REST type for the current object - this is a "PhoneBook". 68 * @returns {String} The PhoneBook string. 69 */ 70 getRestType: function () { 71 return "PhoneBook"; 72 }, 73 74 /** 75 * @private 76 * Override default to indicate that this object doesn't support making 77 * requests. 78 */ 79 supportsRequests: false, 80 81 /** 82 * @private 83 * Override default to indicate that this object doesn't support subscriptions. 84 */ 85 supportsSubscriptions: false, 86 87 /** 88 * Getter for the name. 89 * @returns {String} The name. 90 */ 91 getName: function () { 92 this.isLoaded(); 93 return this.getData().name; 94 }, 95 96 /** 97 * Getter for the Uri value. 98 * @returns {String} The Uri. 99 */ 100 getUri: function () { 101 this.isLoaded(); 102 return this.getData().uri; 103 } 104 105 }); 106 107