Commit fe6aabc5 authored by Tristan Cavelier's avatar Tristan Cavelier

query{,factory}.js: updated to manage no query

parent 0d528f2a
......@@ -50,9 +50,7 @@ var Query = newClass(function (spec) {
item_list.splice(option.limit[1]);
}
}
if (option.select_list) {
Query.filterListSelect(option.select_list, item_list);
}
Query.filterListSelect(option.select_list || [], item_list);
};
/**
......@@ -62,7 +60,9 @@ var Query = newClass(function (spec) {
* @param {Object} item The object to test
* @return {Boolean} true if match, false otherwise
*/
this.match = null; // function (item, wildcard_character) {};
this.match = function (item, wildcard_character) {
return true;
};
/**
......@@ -71,7 +71,9 @@ var Query = newClass(function (spec) {
* @method toString
* @return {String} The string version of this query
*/
this.toString = null; // function () {};
this.toString = function () {
return "";
};
/**
* Convert this query to an jsonable object in order to be remake thanks to
......@@ -80,7 +82,9 @@ var Query = newClass(function (spec) {
* @method serialized
* @return {Object} The jsonable object
*/
this.serialized = null; // function () {};
this.serialized = function () {
return undefined;
};
}, {"static_methods": {
......
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */
/*global _export: true, ComplexQuery: true, SimpleQuery: true,
newClass: true */
newClass: true, Query: true */
// XXX
var query_class_dict = {}, QueryFactory;
......@@ -10,7 +10,13 @@ QueryFactory = newClass({
"static_methods": {
// XXX
"create": function (object) {
if (typeof object.type === "string" &&
if (object === "") {
return new Query();
}
if (typeof object === "string") {
object = Query.parseStringToObject(object);
}
if (typeof (object || {}).type === "string" &&
query_class_dict[object.type]) {
return new query_class_dict[object.type](object);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment