Use generic map config adapter

This commit is contained in:
Raul Ochoa 2016-05-23 23:35:42 +02:00
parent 5e6529363b
commit faa24caf5b
2 changed files with 4 additions and 25 deletions

View File

@ -15,12 +15,8 @@ var Datasource = windshaft.model.Datasource;
var NamedMapsCacheEntry = require('../cache/model/named_maps_entry'); var NamedMapsCacheEntry = require('../cache/model/named_maps_entry');
var MapConfigNamedLayersAdapter = require('../models/mapconfig/adapter/mapconfig-named-layers-adapter');
var AnalysisMapConfigAdapter = require('../models/mapconfig/adapter/analysis-mapconfig-adapter');
var NamedMapMapConfigProvider = require('../models/mapconfig/provider/named-map-provider'); var NamedMapMapConfigProvider = require('../models/mapconfig/provider/named-map-provider');
var CreateLayergroupMapConfigProvider = require('../models/mapconfig/provider/create-layergroup-provider'); var CreateLayergroupMapConfigProvider = require('../models/mapconfig/provider/create-layergroup-provider');
var SqlWrapMapConfigAdapter = require('../models/mapconfig/adapter/sql-wrap-mapconfig-adapter');
var MapConfigAdapter = require('../models/mapconfig/adapter');
/** /**
* @param {AuthApi} authApi * @param {AuthApi} authApi
@ -31,14 +27,11 @@ var MapConfigAdapter = require('../models/mapconfig/adapter');
* @param {SurrogateKeysCache} surrogateKeysCache * @param {SurrogateKeysCache} surrogateKeysCache
* @param {UserLimitsApi} userLimitsApi * @param {UserLimitsApi} userLimitsApi
* @param {LayergroupAffectedTables} layergroupAffectedTables * @param {LayergroupAffectedTables} layergroupAffectedTables
* @param {MapConfigOverviewsAdapter} overviewsAdapter * @param {MapConfigAdapter} mapConfigAdapter
* @param {TurboCartoAdapter} turboCartoAdapter
* @param {AnalysisBackend} analysisBackend
* @constructor * @constructor
*/ */
function MapController(authApi, pgConnection, templateMaps, mapBackend, metadataBackend, function MapController(authApi, pgConnection, templateMaps, mapBackend, metadataBackend,
surrogateKeysCache, userLimitsApi, layergroupAffectedTables, surrogateKeysCache, userLimitsApi, layergroupAffectedTables, mapConfigAdapter) {
overviewsAdapter, turboCartoAdapter, analysisBackend) {
BaseController.call(this, authApi, pgConnection); BaseController.call(this, authApi, pgConnection);
@ -49,20 +42,8 @@ function MapController(authApi, pgConnection, templateMaps, mapBackend, metadata
this.surrogateKeysCache = surrogateKeysCache; this.surrogateKeysCache = surrogateKeysCache;
this.userLimitsApi = userLimitsApi; this.userLimitsApi = userLimitsApi;
this.layergroupAffectedTables = layergroupAffectedTables; this.layergroupAffectedTables = layergroupAffectedTables;
this.turboCartoAdapter = turboCartoAdapter;
this.analysisMapConfigAdapter = new AnalysisMapConfigAdapter(analysisBackend); this.mapConfigAdapter = mapConfigAdapter;
this.namedLayersAdapter = new MapConfigNamedLayersAdapter(templateMaps, pgConnection);
this.overviewsAdapter = overviewsAdapter;
this.sqlWrapMapConfigAdapter = new SqlWrapMapConfigAdapter();
this.mapConfigAdapter = new MapConfigAdapter([
this.sqlWrapMapConfigAdapter,
this.analysisMapConfigAdapter,
this.namedLayersAdapter,
this.overviewsAdapter,
this.turboCartoAdapter
]);
} }
util.inherits(MapController, BaseController); util.inherits(MapController, BaseController);

View File

@ -212,9 +212,7 @@ module.exports = function(serverOptions) {
surrogateKeysCache, surrogateKeysCache,
userLimitsApi, userLimitsApi,
layergroupAffectedTablesCache, layergroupAffectedTablesCache,
overviewsAdapter, mapConfigAdapter
turboCartoAdapter,
analysisBackend
).register(app); ).register(app);
new controller.NamedMaps( new controller.NamedMaps(