srv/handler/rest/ResourceHandler.js
function (context, callback, checkParents) {
            if (this.$parentResource) {
                var self = this;
                flow()
                    .seq("parentCollection", function (cb) {
                        self.$parentResource._findCollection(context, cb);
                    })
                    .seq("parent", function (cb) {
                        var parentCollection = this.vars.parentCollection,
                            id = parentCollection.$modelFactory.prototype.convertIdentifier(self.$parentResource.$resourceId),
                            parent = parentCollection.createItem(id);

                        if (checkParents) {
                            parent.fetch(null, cb);
                        } else {
                            cb(null, parent);
                        }
                    })
                    .exec(function (err, results) {
                        if (!err) {
                            var collection = results.parent.getCollection(self.$resourceConfiguration.$.path);
                            callback && callback(null, collection);
                        } else {
                            callback && callback(err);
                        }
                    });
            } else {
                var dataSource = this.$restHandler.getDataSource(context, this);
                callback && callback(null, dataSource.createCollection(Collection.of(this._getModelFactory()), {pageSize: 100}));
            }
        }
function (context, callback, checkParents) {
            if (this.$parentResource) {
                var self = this;
                flow()
                    .seq("parentCollection", function (cb) {
                        self.$parentResource._findCollection(context, cb);
                    })
                    .seq("parent", function (cb) {
                        var parentCollection = this.vars.parentCollection,
                            id = parentCollection.$modelFactory.prototype.convertIdentifier(self.$parentResource.$resourceId),
                            parent = parentCollection.createItem(id);

                        if (checkParents) {
                            parent.fetch(null, cb);
                        } else {
                            cb(null, parent);
                        }
                    })
                    .exec(function (err, results) {
                        if (!err) {
                            var collection = results.parent.getCollection(self.$resourceConfiguration.$.path);
                            callback && callback(null, collection);
                        } else {
                            callback && callback(err);
                        }
                    });
            } else {
                var dataSource = this.$restHandler.getDataSource(context, this);
                callback && callback(null, dataSource.createCollection(Collection.of(this._getModelFactory()), {pageSize: 100}));
            }
        }
function ( context , callback , checkParents ) { if ( this . $parentResource ) { var self = this ; flow ( ) . seq ( "parentCollection" , function ( cb ) { self . $parentResource . _findCollection ( context , cb ) ; } ) . seq ( "parent" , function ( cb ) { var parentCollection = this . vars . parentCollection , id = parentCollection . $modelFactory . prototype . convertIdentifier ( self . $parentResource . $resourceId ) , parent = parentCollection . createItem ( id ) ; if ( checkParents ) { parent . fetch ( null , cb ) ; } else { cb ( null , parent ) ; } } ) . exec ( function ( err , results ) { if ( ! err ) { var collection = results . parent . getCollection ( self . $resourceConfiguration . $ . path ) ; callback && callback ( null , collection ) ; } else { callback && callback ( err ) ; } } ) ; } else { var dataSource = this . $restHandler . getDataSource ( context , this ) ; callback && callback ( null , dataSource . createCollection ( Collection . of ( this . _getModelFactory ( ) ) , { pageSize : 100 } ) ) ; } }
Returns a collection for this resource in the right context
@param {srv.core.Context} context
@param {Function} callback
@param {Boolean} [checkParents] - default true
@return {*}
@private
Returns a collection for this resource in the right context