diff options
Diffstat (limited to 'node_modules/montage/data/restriction.js')
-rwxr-xr-x | node_modules/montage/data/restriction.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/node_modules/montage/data/restriction.js b/node_modules/montage/data/restriction.js new file mode 100755 index 00000000..53c2f19d --- /dev/null +++ b/node_modules/montage/data/restriction.js | |||
@@ -0,0 +1,66 @@ | |||
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/restriction | ||
8 | @requires montage/core/core | ||
9 | @requires montage/core/logger | ||
10 | */ | ||
11 | var Montage = require("montage").Montage; | ||
12 | // var Selector = require("data/selector").Selector; | ||
13 | var logger = require("core/logger").logger("restrictions"); | ||
14 | /** | ||
15 | @class module:montage/data/restriction.Restriction | ||
16 | @extends module:montage/core/core.Montage | ||
17 | */ | ||
18 | var Restriction = exports.Restriction = Montage.create(Montage,/** @lends module:montage/data/restriction.Restriction# */ { | ||
19 | /** | ||
20 | Description TODO | ||
21 | @type {Property} | ||
22 | @default {String} "" | ||
23 | */ | ||
24 | name: { | ||
25 | serializable: true, | ||
26 | enumerable: true, | ||
27 | value: "" | ||
28 | }, | ||
29 | /** | ||
30 | Description TODO | ||
31 | @type {Property} | ||
32 | @default {String}{} | ||
33 | */ | ||
34 | parameters: { | ||
35 | value: {}, | ||
36 | serializable: true, | ||
37 | distinct: true, | ||
38 | enumerable: false, | ||
39 | writable: false | ||
40 | }, | ||
41 | /** | ||
42 | Description TODO | ||
43 | @function | ||
44 | @param {String} name To be initialized | ||
45 | @param {String} parameters To be initialized | ||
46 | @returns itself | ||
47 | */ | ||
48 | initWithNameAndParameters: { | ||
49 | enumerable: false, | ||
50 | value: function(name, parameters) { | ||
51 | this.name = (name != null ? name : "default"); | ||
52 | Object.defineProperty(this, "name", {writable: false}); | ||
53 | if (parameters != null) { | ||
54 | var parametersNames = Object.getOwnPropertyNames(parameters); | ||
55 | var parameter, parameterName, index; | ||
56 | for (index = 0; typeof (parameterName = parametersNames[index]) !== "undefined"; index++) { | ||
57 | parameter = parameters[parameterName]; | ||
58 | this.parameters[parameterName] = parameter; | ||
59 | } | ||
60 | } | ||
61 | Object.freeze(this.parameters); | ||
62 | return this; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | }); | ||