1 /**
  2 * @fileOverview JavaScript representation of the Finesse Sign Out Reason Code collection
  3 * object which contains a list of Sign Out Reason Codes objects.
  4  *
  5  * @name finesse.restservices.SignOutReasonCodes
  6  * @requires finesse.clientservices.ClientServices
  7  * @requires Cl 
  8  * @requires finesse.FinesseBase
  9  * @requires finesse.restservices.RestBase
 10  * @requires finesse.restservices.Dialog
 11  * @requires finesse.restservices.RestCollectionBase
 12  */
 13 
 14 var finesse = finesse || {};
 15 finesse.restservices = finesse.restservices || {};
 16 
 17 /** @private */
 18 finesse.restservices.SignOutReasonCodes = finesse.restservices.RestCollectionBase.extend({/** @lends finesse.restservices.SignOutReasonCodes.prototype */
 19     /**
 20      * @class
 21      * JavaScript representation of a SignOutReasonCodes collection object. Also exposes
 22      * methods to operate on the object against the server.
 23      *
 24      * @param {Object} options
 25      *     An object with the following properties:<ul>
 26      *         <li><b>id:</b> The id of the object being constructed</li>
 27      *         <li><b>onLoad(this): (optional)</b> when the object is successfully loaded from the server</li>
 28      *         <li><b>onChange(this): (optional)</b> when an update notification of the object is received</li>
 29      *         <li><b>onAdd(this): (optional)</b> when a notification that the object is created is received</li>
 30      *         <li><b>onDelete(this): (optional)</b> when a notification that the object is deleted is received</li>
 31      *         <li><b>onError(rsp): (optional)</b> if loading of the object fails, invoked with the error response object:<ul>
 32      *             <li><b>status:</b> {Number} The HTTP status code returned</li>
 33      *             <li><b>content:</b> {String} Raw string of response</li>
 34      *             <li><b>object:</b> {Object} Parsed object of response</li>
 35      *             <li><b>error:</b> {Object} Wrapped exception that was caught:<ul>
 36      *                 <li><b>errorType:</b> {String} Type of error that was caught</li>
 37      *                 <li><b>errorMessage:</b> {String} Message associated with error</li>
 38      *             </ul></li>
 39      *         </ul></li>
 40      *         <li><b>parentObj: (optional)</b> The parent object</li></ul>
 41      * @constructs finesse.restservices.SignOutReasonCodes
 42      **/
 43     init: function (options) {
 44         this._super(options);
 45     },
 46 
 47     /**
 48      * @private
 49      * Gets the REST class for the current object - this is the SignOutReasonCodes class.
 50      */
 51     getRestClass: function () {
 52         return finesse.restservices.SignOutReasonCodes;
 53     },
 54 
 55     /**
 56      * @private
 57      * Gets the REST class for the objects that make up the collection. - this
 58      * is the SignOutReasonCodes class.
 59      */
 60     getRestItemClass: function () {
 61         return finesse.restservices.SignOutReasonCode;
 62     },
 63 
 64     /**
 65      * @private
 66      * Gets the REST type for the current object - this is a "ReasonCodes".
 67      */
 68     getRestType: function () {
 69         return "ReasonCodes";
 70     },
 71 
 72     /**
 73      * Overrides the parent class.  Returns the url for the SignOutReasonCodes resource
 74      */
 75     getRestUrl: function () {
 76         var restObj = this._restObj, restUrl = "";
 77 
 78         //Prepend the base REST object if one was provided.
 79         //Otherwise prepend with the default webapp name.
 80         if (restObj instanceof finesse.restservices.RestBase) {
 81             restUrl += restObj.getRestUrl();
 82         } else {
 83             restUrl += "/finesse/api";
 84         }
 85         //Append the REST type.
 86         restUrl += "/ReasonCodes?category=LOGOUT";
 87         //Append ID if it is not undefined, null, or empty.
 88         if (this._id) {
 89             restUrl += "/" + this._id;
 90         }
 91         return restUrl;
 92     },
 93 
 94     /**
 95      * @private
 96      * Gets the REST type for the objects that make up the collection - this is "ReasonCode".
 97      */
 98     getRestItemType: function () {
 99         return "ReasonCode";
100     },
101 
102     /**
103      * @private
104      * Override default to indicates that the collection supports making
105      * requests.
106      */
107     supportsRequests: true,
108 
109     /**
110      * @private
111      * Override default to indicates that the collection subscribes to its objects.
112      */
113     supportsRestItemSubscriptions: false,
114 
115     /**
116      * Retrieve the Sign Out Reason Codes.
117      *
118      * @returns {finesse.restservices.SignOutReasonCodes}
119      *     This ReadyReasonCodes object to allow cascading.
120      */
121     get: function () {
122         // set loaded to false so it will rebuild the collection after the get
123         this._loaded = false;
124         // reset collection
125         this._collection = {};
126         // perform get
127         this._synchronize();
128         return this;
129     }
130 
131 });