aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/data/query.js
diff options
context:
space:
mode:
authorPierre Frisch2011-12-22 07:25:50 -0800
committerValerio Virgillito2012-01-27 11:18:17 -0800
commitb89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch)
tree0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /node_modules/montage/data/query.js
parent2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff)
downloadninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'node_modules/montage/data/query.js')
-rwxr-xr-xnode_modules/montage/data/query.js114
1 files changed, 114 insertions, 0 deletions
diff --git a/node_modules/montage/data/query.js b/node_modules/montage/data/query.js
new file mode 100755
index 00000000..9fce9dae
--- /dev/null
+++ b/node_modules/montage/data/query.js
@@ -0,0 +1,114 @@
1/* <copyright>
2This 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/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6/**
7 @module montage/data/query
8 @requires montage/core/core
9 @requires montage/data/selector
10 @requires montage/core/logger
11*/
12var Montage = require("montage").Montage;
13var Selector = require("data/selector").Selector;
14var Key = require("data/selector").Key;
15var logger = require("core/logger").logger("query");
16/**
17 @class module:montage/data/query.Query
18 @extends module:montage/data/selector.Selector
19*/
20var Query = exports.Query = Montage.create(Selector,/** @lends module:montage/data/query.Query# */ {
21/**
22 Description TODO
23 @type {Property}
24 @default {Function} null
25 */
26 blueprint: {
27 value: null,
28 serializable: true
29 },
30/**
31 Description TODO
32 @type {Property}
33 @default {Selector} null
34 */
35 selector: {
36 value: null,
37 serializable: true
38 },
39/**
40 Description TODO
41 @type {Property}
42 @default {String} ""
43 */
44 name: {
45 serializable: true,
46 enumerable: true,
47 value: ""
48 },
49/**
50 Description TODO
51 @function
52 @param {Function} blueprint TODO
53 @returns this.initWithBlueprintAndSelector(blueprint, null)
54 */
55 initWithBlueprint: {
56 enumerable: true,
57 value: function(blueprint) {
58 return this.initWithBlueprintAndSelector(blueprint, null);
59 }
60 },
61/**
62 Description TODO
63 @function
64 @param {Function} blueprint TODO
65 @param {Selector} selector TODO
66 @returns itself
67 */
68 initWithBlueprintAndSelector: {
69 enumerable: true,
70 value: function(blueprint, selector) {
71 this.blueprint = blueprint;
72 Object.defineProperty(this, "blueprint", {writable: false});
73 if ((selector != null) && (typeof selector === 'object')) {
74 this.selector = selector;
75 } else {
76 this.selector = this;
77 }
78 return this;
79 }
80 },
81/**
82 Description TODO
83 @function
84 @param {Function} propertyPath TODO
85 @returns this.selector
86 */
87 where: {
88 value: function(propertyPath) {
89 // where clause with an empty key path is a noop.
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 }
96 },
97/**
98 Description TODO
99 @function
100 @param {Function} propertyPath TODO
101 @returns this.selector
102 */
103 property: {
104 value: function(propertyPath) {
105 if (((propertyPath) != null) && (typeof (propertyPath) == 'string') && (propertyPath.length > 0)) {
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 }
112 }
113
114});