public void addMapInterceptors(MapContainer mapContainer) { List<MapInterceptor> interceptorList = mapContainer.getInterceptors(); Map<String, MapInterceptor> interceptorMap = mapContainer.getInterceptorMap(); Map<MapInterceptor, String> revMap = new HashMap<MapInterceptor, String>(); for (Map.Entry<String, MapInterceptor> entry : interceptorMap.entrySet()) { revMap.put(entry.getValue(), entry.getKey()); } InterceptorInfo interceptorInfo = new InterceptorInfo(mapContainer.getName()); for (MapInterceptor interceptor : interceptorList) { interceptorInfo.addInterceptor(revMap.get(interceptor), interceptor); } interceptorInfoList.add(interceptorInfo); }
@Override public void run() throws Exception { MapService mapService = getService(); for (MapIndexInfo mapIndex : indexInfoList) { final MapContainer mapContainer = mapService.getMapContainer(mapIndex.mapName); final IndexService indexService = mapContainer.getIndexService(); for (MapIndexInfo.IndexInfo indexInfo : mapIndex.lsIndexes) { indexService.addOrGetIndex(indexInfo.attributeName, indexInfo.ordered); } } for (InterceptorInfo interceptorInfo : interceptorInfoList) { final MapContainer mapContainer = mapService.getMapContainer(interceptorInfo.mapName); Map<String, MapInterceptor> interceptorMap = mapContainer.getInterceptorMap(); List<Map.Entry<String, MapInterceptor>> entryList = interceptorInfo.interceptors; for (Map.Entry<String, MapInterceptor> entry : entryList) { if (!interceptorMap.containsKey(entry.getKey())) { mapContainer.addInterceptor(entry.getKey(), entry.getValue()); } } } }