aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/data/query.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/data/query.js')
-rwxr-xr-xnode_modules/montage/data/query.js123
1 files changed, 56 insertions, 67 deletions
diff --git a/node_modules/montage/data/query.js b/node_modules/montage/data/query.js
index 9fce9dae..0f0d71fb 100755
--- a/node_modules/montage/data/query.js
+++ b/node_modules/montage/data/query.js
@@ -1,70 +1,69 @@
1/* <copyright> 1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/> 2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<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. 4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5 </copyright> */
6/** 6/**
7 @module montage/data/query 7 @module montage/data/query
8 @requires montage/core/core 8 @requires montage/core/core
9 @requires montage/data/selector 9 @requires montage/core/logger
10 @requires montage/core/logger 10 */
11*/
12var Montage = require("montage").Montage; 11var Montage = require("montage").Montage;
13var Selector = require("data/selector").Selector;
14var Key = require("data/selector").Key;
15var logger = require("core/logger").logger("query"); 12var logger = require("core/logger").logger("query");
16/** 13/**
17 @class module:montage/data/query.Query 14 @class module:montage/data/query.Query
18 @extends module:montage/data/selector.Selector 15 */
19*/ 16var Query = exports.Query = Montage.create(Montage, /** @lends module:montage/data/query.Query# */ {
20var Query = exports.Query = Montage.create(Selector,/** @lends module:montage/data/query.Query# */ { 17 /**
21/** 18 Description TODO
22 Description TODO 19 @type {Property}
23 @type {Property} 20 @default {Function} null
24 @default {Function} null 21 */
25 */
26 blueprint: { 22 blueprint: {
27 value: null, 23 value: null,
28 serializable: true 24 serializable: true
29 }, 25 },
30/** 26
31 Description TODO 27 /**
32 @type {Property} 28 Description TODO
33 @default {Selector} null 29 @type {Property}
34 */ 30 @default {Selector} null
31 */
35 selector: { 32 selector: {
36 value: null, 33 value: null,
37 serializable: true 34 serializable: true
38 }, 35 },
39/** 36
40 Description TODO 37 /**
41 @type {Property} 38 Description TODO
42 @default {String} "" 39 @type {Property}
43 */ 40 @default {String} ""
41 */
44 name: { 42 name: {
45 serializable: true, 43 serializable: true,
46 enumerable: true, 44 enumerable: true,
47 value: "" 45 value: ""
48 }, 46 },
49/** 47
50 Description TODO 48 /**
51 @function 49 Description TODO
52 @param {Function} blueprint TODO 50 @function
53 @returns this.initWithBlueprintAndSelector(blueprint, null) 51 @param {Function} blueprint TODO
54 */ 52 @returns this.initWithBlueprintAndSelector(blueprint, null)
53 */
55 initWithBlueprint: { 54 initWithBlueprint: {
56 enumerable: true, 55 enumerable: true,
57 value: function(blueprint) { 56 value: function(blueprint) {
58 return this.initWithBlueprintAndSelector(blueprint, null); 57 return this.initWithBlueprintAndSelector(blueprint, null);
59 } 58 }
60 }, 59 },
61/** 60 /**
62 Description TODO 61 Description TODO
63 @function 62 @function
64 @param {Function} blueprint TODO 63 @param {Function} blueprint TODO
65 @param {Selector} selector TODO 64 @param {Selector} selector TODO
66 @returns itself 65 @returns itself
67 */ 66 */
68 initWithBlueprintAndSelector: { 67 initWithBlueprintAndSelector: {
69 enumerable: true, 68 enumerable: true,
70 value: function(blueprint, selector) { 69 value: function(blueprint, selector) {
@@ -78,36 +77,26 @@ var Query = exports.Query = Montage.create(Selector,/** @lends module:montage/da
78 return this; 77 return this;
79 } 78 }
80 }, 79 },
81/** 80 /**
82 Description TODO 81 Description TODO
83 @function 82 @function
84 @param {Function} propertyPath TODO 83 @param {Function} propertyPath TODO
85 @returns this.selector 84 @returns this.selector
86 */ 85 */
87 where: { 86 where: {
88 value: function(propertyPath) { 87 value: function(propertyPath) {
89 // where clause with an empty key path is a noop. 88 return this.selector.and.property(propertyPath)
90 if ((propertyPath != null) && (typeof propertyPath == 'string') && (propertyPath.length > 0)) {
91 // TODO [PJYF Aug 23 2011] We should check that the key path is valid
92 return Key.create().init(this, [propertyPath]);
93 }
94 return this.selector;
95 } 89 }
96 }, 90 },
97/** 91 /**
98 Description TODO 92 Description TODO
99 @function 93 @function
100 @param {Function} propertyPath TODO 94 @param {Function} propertyPath TODO
101 @returns this.selector 95 @returns this.selector
102 */ 96 */
103 property: { 97 property: {
104 value: function(propertyPath) { 98 value: function(propertyPath) {
105 if (((propertyPath) != null) && (typeof (propertyPath) == 'string') && (propertyPath.length > 0)) { 99 return this.selector.and.property(propertyPath)
106 // TODO [PJYF Aug 23 2011] We should check that the key path is valid
107 return Key.create().init(this, [(propertyPath)]);
108 }
109 // TODO [PJYF Aug 23 2011] We should raise here.
110 return this.selector;
111 } 100 }
112 } 101 }
113 102