diff options
Diffstat (limited to 'node_modules/montage/data/object-id.js')
-rwxr-xr-x | node_modules/montage/data/object-id.js | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/node_modules/montage/data/object-id.js b/node_modules/montage/data/object-id.js new file mode 100755 index 00000000..d1e10cf5 --- /dev/null +++ b/node_modules/montage/data/object-id.js | |||
@@ -0,0 +1,96 @@ | |||
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/object-id | ||
8 | @requires montage/core/core | ||
9 | @requires montage/core/uuid | ||
10 | @requires montage/core/logger | ||
11 | */ | ||
12 | var Montage = require("montage").Montage; | ||
13 | var Uuid = require("core/uuid").Uuid; | ||
14 | var logger = require("core/logger").logger("objectId"); | ||
15 | /** | ||
16 | @class module:montage/data/object-id.ObjectId | ||
17 | @extends module:montage/core/core.Montage | ||
18 | */ | ||
19 | var ObjectId = exports.ObjectId = Montage.create(Montage, /** @lends module:montage/data/object-id.ObjectId# */ { | ||
20 | /** | ||
21 | Description TODO | ||
22 | @type {Property} | ||
23 | @default {Boolean} false | ||
24 | */ | ||
25 | isTemporary:{ | ||
26 | get function () { | ||
27 | return false; | ||
28 | } | ||
29 | }, | ||
30 | |||
31 | /** | ||
32 | Description TODO | ||
33 | @type {Property} | ||
34 | @default {Object} null | ||
35 | */ | ||
36 | _blueprint:{ | ||
37 | serializable: true, | ||
38 | enumerable: false, | ||
39 | value:null | ||
40 | }, | ||
41 | |||
42 | /** | ||
43 | Description TODO | ||
44 | @type {Property} | ||
45 | @default {Object} null | ||
46 | */ | ||
47 | blueprint:{ | ||
48 | get function () { | ||
49 | return this._blueprint; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | }); | ||
54 | /** | ||
55 | @class module:montage/data/object-id.TemporaryObjectId | ||
56 | */ | ||
57 | var TemporaryObjectId = exports.TemporaryObjectId = Montage.create(ObjectId, /** @lends module:montage/data/object-id.TemporaryObjectId# */ { | ||
58 | /** | ||
59 | Description TODO | ||
60 | @type {Property} | ||
61 | @default {Boolean} true | ||
62 | */ | ||
63 | isTemporary:{ | ||
64 | get function () { | ||
65 | return true; | ||
66 | } | ||
67 | }, | ||
68 | /** | ||
69 | Description TODO | ||
70 | @private | ||
71 | */ | ||
72 | _uuid:{ | ||
73 | serializable:true, | ||
74 | enumerable:false, | ||
75 | value:null | ||
76 | }, | ||
77 | /** | ||
78 | Description TODO | ||
79 | @function | ||
80 | @returns itself | ||
81 | */ | ||
82 | initWithBlueprint:{ | ||
83 | serializable:false, | ||
84 | enumerable:false, | ||
85 | value:function (blueprint) { | ||
86 | this._blueprint = blueprint; | ||
87 | this._uuid = Uuid.generate(); | ||
88 | if (logger.isDebug) { | ||
89 | logger.debug(this, "New Temporary Object ID: " + this._uuid); | ||
90 | } | ||
91 | Object.freeze(this); | ||
92 | return this; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | }); | ||