use of com.baidu.disconf.web.service.roleres.bo.RoleResource in project disconf by knightliao.
the class RoleResourceMgrImpl method getAllAsMap.
/**
* @return
*/
@Override
@Cacheable(value = "${role_res_cache_name}")
public Map<String, Map<RequestMethod, List<Integer>>> getAllAsMap() {
Map<String, Map<RequestMethod, List<Integer>>> infoMap = new HashMap<String, Map<RequestMethod, List<Integer>>>();
LOG.info("Querying role_resource table to get all...");
List<RoleResource> roleResList = roleResDao.findAll();
// 遍历列表,把数据按<url, <method, List<roleId>>>的形式加到infoMap
for (RoleResource roleRes : roleResList) {
String urlPattern = roleRes.getUrlPattern();
if (!urlPattern.endsWith(RoleResourceConstant.URL_SPLITOR)) {
urlPattern += RoleResourceConstant.URL_SPLITOR;
}
// LOG.info(urlPattern);
Map<RequestMethod, List<Integer>> value = infoMap.get(urlPattern);
if (value == null) {
value = new HashMap<RequestMethod, List<Integer>>();
infoMap.put(urlPattern, value);
}
updateMethodMap(value, roleRes.getRoleId(), roleRes.getMethodMask());
}
return infoMap;
}
Aggregations