flexmonster-mongo-connector
Version:
Custom data source API implementation for MongoDB
55 lines • 1.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SchemaValueObject = void 0;
class SchemaValueObject {
constructor(uniqueName, type, caption, folder = "", aggregations = []) {
this.uniqueName = "";
this.type = "";
this.caption = "";
this.uniqueName = uniqueName;
this.type = type;
this.caption = caption;
this.folder = folder;
this.aggregations = aggregations;
this.fieldStats = {};
}
static fromObject(obj) {
let uniqueName = "";
let type = "";
let caption = "";
let folder = "";
let aggregations = [];
if (obj.hasOwnProject("uniqueName")) {
uniqueName = obj["uniqueName"];
}
if (obj.hasOwnProject("type")) {
type = obj["type"];
}
if (obj.hasOwnProject("caption")) {
caption = obj["caption"];
}
if (obj.hasOwnProject("folder")) {
folder = obj["folder"];
}
if (obj.hasOwnProject("aggregations")) {
aggregations = obj["aggregations"];
}
return new SchemaValueObject(uniqueName, type, caption, folder, aggregations);
}
toObject() {
let resultObject = {
"uniqueName": this.uniqueName,
"type": this.type,
"caption": this.caption
};
if (this.folder != "") {
resultObject["folder"] = this.folder;
}
if (this.aggregations.length > 0) {
resultObject["aggregations"] = this.aggregations;
}
return resultObject;
}
}
exports.SchemaValueObject = SchemaValueObject;
//# sourceMappingURL=SchemaValueObject.js.map