aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/data/query.js
blob: 0f0d71fb95830b89a711a6754fd86ea516966766 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* <copyright>
 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
 (c) Copyright 2011 Motorola Mobility, Inc.  All Rights Reserved.
 </copyright> */
/**
 @module montage/data/query
 @requires montage/core/core
 @requires montage/core/logger
 */
var Montage = require("montage").Montage;
var logger = require("core/logger").logger("query");
/**
 @class module:montage/data/query.Query
 */
var Query = exports.Query = Montage.create(Montage, /** @lends module:montage/data/query.Query# */ {
    /**
     Description TODO
     @type {Property}
     @default {Function} null
     */
    blueprint: {
        value: null,
        serializable: true
    },

    /**
     Description TODO
     @type {Property}
     @default {Selector} null
     */
    selector: {
        value: null,
        serializable: true
    },

    /**
     Description TODO
     @type {Property}
     @default {String} ""
     */
    name: {
        serializable: true,
        enumerable: true,
        value: ""
    },

    /**
     Description TODO
     @function
     @param {Function} blueprint TODO
     @returns this.initWithBlueprintAndSelector(blueprint, null)
     */
    initWithBlueprint: {
        enumerable: true,
        value: function(blueprint) {
            return this.initWithBlueprintAndSelector(blueprint, null);
        }
    },
    /**
     Description TODO
     @function
     @param {Function} blueprint TODO
     @param {Selector} selector TODO
     @returns itself
     */
    initWithBlueprintAndSelector: {
        enumerable: true,
        value: function(blueprint, selector) {
            this.blueprint = blueprint;
            Object.defineProperty(this, "blueprint", {writable: false});
            if ((selector != null) && (typeof selector === 'object')) {
                this.selector = selector;
            } else {
                this.selector = this;
            }
            return this;
        }
    },
    /**
     Description TODO
     @function
     @param {Function} propertyPath TODO
     @returns this.selector
     */
    where: {
        value: function(propertyPath) {
            return this.selector.and.property(propertyPath)
        }
    },
    /**
     Description TODO
     @function
     @param {Function} propertyPath TODO
     @returns this.selector
     */
    property: {
        value: function(propertyPath) {
            return this.selector.and.property(propertyPath)
        }
    }

});