diff options
Diffstat (limited to 'node_modules/montage-user/data/pledge.js')
-rwxr-xr-x | node_modules/montage-user/data/pledge.js | 270 |
1 files changed, 270 insertions, 0 deletions
diff --git a/node_modules/montage-user/data/pledge.js b/node_modules/montage-user/data/pledge.js new file mode 100755 index 00000000..49cb0441 --- /dev/null +++ b/node_modules/montage-user/data/pledge.js | |||
@@ -0,0 +1,270 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | /** | ||
7 | @module montage/data/pledge | ||
8 | @requires montage/core/core | ||
9 | @requires montage/core/promise | ||
10 | @requires montage/core/logger | ||
11 | */ | ||
12 | var Montage = require("montage").Montage; | ||
13 | var Q = require("core/promise"); | ||
14 | var logger = require("core/logger").logger("pledge"); | ||
15 | /** | ||
16 | @class module:montage/data/pledge.Pledge | ||
17 | @extends module:montage/core/core.Montage | ||
18 | */ | ||
19 | var Pledge = exports.Pledge = Montage.create(Montage, /** @lends module:montage/data/pledge.Pledge# */ { | ||
20 | |||
21 | /** | ||
22 | Description TODO | ||
23 | @type {Property} | ||
24 | @default {Object} null | ||
25 | */ | ||
26 | objectId: { | ||
27 | serializable: true, | ||
28 | enumerable: false, | ||
29 | value: null | ||
30 | }, | ||
31 | |||
32 | /** | ||
33 | Description TODO | ||
34 | @private | ||
35 | */ | ||
36 | _context: { | ||
37 | serializable: true, | ||
38 | enumerable: false, | ||
39 | value: null | ||
40 | }, | ||
41 | |||
42 | /** | ||
43 | Description TODO | ||
44 | @type {Property} | ||
45 | @default {String} null | ||
46 | */ | ||
47 | context: { | ||
48 | enumerable: false, | ||
49 | get: function() { | ||
50 | return this._query; | ||
51 | } | ||
52 | }, | ||
53 | |||
54 | /** | ||
55 | Stores the blueprint associated with this pledge | ||
56 | @private | ||
57 | */ | ||
58 | _blueprint: { | ||
59 | serializable: true, | ||
60 | enumerable: false, | ||
61 | value: null | ||
62 | }, | ||
63 | /** | ||
64 | Returns the blueprint associated with this pledge | ||
65 | @function | ||
66 | @returns this._blueprint | ||
67 | @default null | ||
68 | */ | ||
69 | blueprint: { | ||
70 | serializable: false, | ||
71 | enumerable: false, | ||
72 | get: function() { | ||
73 | return this._blueprint; | ||
74 | } | ||
75 | }, | ||
76 | |||
77 | /** | ||
78 | Description TODO | ||
79 | @function | ||
80 | @param {Instance} instance | ||
81 | @returns instance.isPledge | ||
82 | */ | ||
83 | isPledge: { | ||
84 | value: function(instance) { | ||
85 | if (instance === null) { | ||
86 | return false; | ||
87 | } | ||
88 | if (typeof instance.isPledge === 'undefined') { | ||
89 | return false; | ||
90 | } | ||
91 | return instance.isPledge; | ||
92 | } | ||
93 | }, | ||
94 | |||
95 | |||
96 | /** | ||
97 | Description TODO | ||
98 | @function | ||
99 | @param {String} propertyPaths | ||
100 | @returns this object | ||
101 | */ | ||
102 | withProperties: { | ||
103 | value: function(/* propertyPaths */) { | ||
104 | var propertyPaths = Array.prototype.slice.call(arguments); | ||
105 | return this; | ||
106 | } | ||
107 | }, | ||
108 | |||
109 | /** | ||
110 | Description TODO | ||
111 | @function | ||
112 | @returns undefined | ||
113 | */ | ||
114 | valueOf: { | ||
115 | value: function() { | ||
116 | return undefined; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | }); | ||
121 | |||
122 | /** | ||
123 | @class module:montage/data/pledge.PledgedSortedSet | ||
124 | @extends module:montage/data/pledge.Pledged | ||
125 | */ | ||
126 | var PledgedSortedSet = exports.PledgedSortedSet = Montage.create(Pledge, /** @lends module:montage/data/pledge.PledgedSortedSet# */ { | ||
127 | |||
128 | /** | ||
129 | Description TODO | ||
130 | @private | ||
131 | */ | ||
132 | _query: { | ||
133 | serializable: true, | ||
134 | enumerable: false, | ||
135 | value: null | ||
136 | }, | ||
137 | |||
138 | /** | ||
139 | Description TODO | ||
140 | @function | ||
141 | @returns this._query | ||
142 | @default null | ||
143 | */ | ||
144 | query: { | ||
145 | enumerable: false, | ||
146 | get: function() { | ||
147 | return this._query; | ||
148 | } | ||
149 | }, | ||
150 | |||
151 | /** | ||
152 | Description TODO | ||
153 | @function | ||
154 | @returns this._query.blueprint | ||
155 | */ | ||
156 | blueprint: { | ||
157 | enumerable: false, | ||
158 | get: function() { | ||
159 | return this._query.blueprint; | ||
160 | } | ||
161 | }, | ||
162 | |||
163 | /** | ||
164 | Description TODO | ||
165 | @function | ||
166 | @param {Property} query TODO | ||
167 | @param {Property} context TODO | ||
168 | */ | ||
169 | initWithQueryAndContext: { | ||
170 | value: function(query, context) { | ||
171 | this._query = query; | ||
172 | this._context = context; | ||
173 | } | ||
174 | }, | ||
175 | |||
176 | /** | ||
177 | Description TODO | ||
178 | @type {Property} | ||
179 | @default {Boolean} true | ||
180 | */ | ||
181 | isPledge: { | ||
182 | serializable: false, | ||
183 | enumerable: false, | ||
184 | value: true | ||
185 | }, | ||
186 | |||
187 | /** | ||
188 | Returns the expected number of item for this array.<br/> | ||
189 | <b>Note:</b> This value is not constant as depending upon the type of backing store, the number of objects returned may vary over time. | ||
190 | @function | ||
191 | @returns {Number} 0 The expected number of items in the pledged array. | ||
192 | */ | ||
193 | length: { | ||
194 | value: function () { | ||
195 | return 0; | ||
196 | } | ||
197 | }, | ||
198 | |||
199 | /** | ||
200 | Checks if the pledged array is empty.<br/> | ||
201 | <b>Note:</b> This value is not constant as depending upon the type of backing store, the number of objects returned may vary over time. | ||
202 | @function | ||
203 | @returns {Boolean} <code>true</code> if the array is not empty, <code>false</code> otherwise. | ||
204 | */ | ||
205 | empty: { | ||
206 | value: function () { | ||
207 | return length == 0; | ||
208 | } | ||
209 | }, | ||
210 | |||
211 | /** | ||
212 | Description TODO | ||
213 | @function | ||
214 | @param {Property} value TODO | ||
215 | @returns false | ||
216 | */ | ||
217 | has: { | ||
218 | value: function (value) { | ||
219 | return false; | ||
220 | } | ||
221 | }, | ||
222 | |||
223 | /** | ||
224 | Description TODO | ||
225 | @function | ||
226 | @param {Property} value TODO | ||
227 | @returns value The obtained value. | ||
228 | */ | ||
229 | get: { | ||
230 | value: function (value) { | ||
231 | return value; | ||
232 | } | ||
233 | }, | ||
234 | |||
235 | /** | ||
236 | Description TODO | ||
237 | @function | ||
238 | @param {Property} value TODO | ||
239 | @returns value The added value. | ||