glutenfree
Version:
A profiler/loganalyzer for nginx/Cetrea Aw.
64 lines (50 loc) • 2.13 kB
JavaScript
// Generated by CoffeeScript 1.6.3
var GenericListsMapper, Mapper, util, winston, _,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
_ = require("underscore");
winston = require("winston");
util = require("util");
Mapper = require("../Mapper.js").mapper;
/*
/json/genericlists/genericListDataFromHints/{"Organizations":["Organization.Seng","Organization.OP","Organization.Opv"],"Tasks":["PatientLogisticsTask.PatientLogisticsActivity.InternalMove"],"GenericListType":"Activity","States":["NotBegun","Ongoing"]}/Name,MovePatient,SSN,Gender,Specialty,Diagnosis,Start,State,FromOrganization,Advis,ToOrganization,Receiver,Sender
*/
GenericListsMapper = (function(_super) {
__extends(GenericListsMapper, _super);
function GenericListsMapper() {
this.identifier = "genericlists";
}
GenericListsMapper.prototype.schema = function(method, action, endpoint, fun, args) {
switch (fun.toLowerCase()) {
case "genericlistdata":
case "genericlistdatafromdefinition":
return this.map([
{
"Organizations": "Organization.Oid",
"Tasks": {
type: "Task",
property: "Oid",
depth: 1,
filter: function(task, schema) {
return task.Oid.length > 0;
}
}
}
], args);
case "listdatabyid":
return this.map(["conf#genericlistid"], args);
}
};
GenericListsMapper.prototype.applySchema = function(method, action, endpoint, fun, schema) {
switch (fun.toLowerCase()) {
case "genericlistdata":
case "genericlistdatafromdefinition":
case "listdatabyid":
return this.unmap(schema);
default:
return winston.warn("no such fun", fun);
}
};
return GenericListsMapper;
})(Mapper);
exports.mapper = new GenericListsMapper();