1 /** 2 * @fileOverview JavaScript representation of the Finesse Teams collection. 3 * object which contains a list of Team objects 4 * @name finesse.restservices.Teams 5 * @requires finesse.clientservices.ClientServices 6 * @requires Class 7 * @requires finesse.FinesseBase 8 * @requires finesse.restservices.RestBase 9 * @requires finesse.restservices.RestCollectionBase 10 */ 11 12 var finesse = finesse || {}; 13 finesse.restservices = finesse.restservices || {}; 14 15 /** @private */ 16 finesse.restservices.Teams = finesse.restservices.RestCollectionBase.extend(/** @lends finesse.restservices.Teams.prototype */{ 17 18 /** 19 * @class 20 * JavaScript representation of a Teams collection object. Also exposes methods to operate 21 * on the object against the server. 22 * 23 * @param {Object} options 24 * An object with the following properties:<ul> 25 * <li><b>id:</b> The id of the object being constructed</li> 26 * <li><b>onLoad(this): (optional)</b> when the object is successfully loaded from the server</li> 27 * <li><b>onChange(this): (optional)</b> when an update notification of the object is received</li> 28 * <li><b>onAdd(this): (optional)</b> when a notification that the object is created is received</li> 29 * <li><b>onDelete(this): (optional)</b> when a notification that the object is deleted is received</li> 30 * <li><b>onError(rsp): (optional)</b> if loading of the object fails, invoked with the error response object:<ul> 31 * <li><b>status:</b> {Number} The HTTP status code returned</li> 32 * <li><b>content:</b> {String} Raw string of response</li> 33 * <li><b>object:</b> {Object} Parsed object of response</li> 34 * <li><b>error:</b> {Object} Wrapped exception that was caught:<ul> 35 * <li><b>errorType:</b> {String} Type of error that was caught</li> 36 * <li><b>errorMessage:</b> {String} Message associated with error</li> 37 * </ul></li> 38 * </ul></li> 39 * <li><b>parentObj: (optional)</b> The parent object</li></ul> 40 * @constructs finesse.restservices.Teams 41 **/ 42 init: function (options) { 43 this._super(options); 44 }, 45 46 /** 47 * @private 48 * Gets the REST class for the current object - this is the Teams class. 49 * @returns {Object} The Teams constructor. 50 */ 51 getRestClass: function () { 52 return finesse.restservices.Teams; 53 }, 54 55 /** 56 * @private 57 * Gets the REST class for the objects that make up the collection. - this 58 * is the Team class. 59 */ 60 getRestItemClass: function () { 61 return finesse.restservices.Team; 62 }, 63 64 /** 65 * @private 66 * Gets the REST type for the current object - this is a "Teams". 67 * @returns {String} The Teams string. 68 */ 69 getRestType: function () { 70 return "Teams"; 71 }, 72 73 /** 74 * @private 75 * Gets the REST type for the objects that make up the collection - this is "Team". 76 */ 77 getRestItemType: function () { 78 return "Team"; 79 }, 80 81 /** 82 * @private 83 * Override default to indicates that the collection supports making 84 * requests. 85 */ 86 supportsRequests: true, 87 88 /** 89 * @private 90 * Override default to indicate that this object doesn't support subscriptions. 91 */ 92 supportsRestItemSubscriptions: false, 93 94 /** 95 * Retrieve the Teams. 96 * 97 * @returns {finesse.restservices.Teams} 98 * This Teams object to allow cascading. 99 */ 100 get: function () { 101 // set loaded to false so it will rebuild the collection after the get 102 this._loaded = false; 103 // reset collection 104 this._collection = {}; 105 // perform get 106 this._synchronize(); 107 return this; 108 } 109 110 }); 111