config.getServletContext().setAttribute("sys.roles", roles);
}
for (String roleName : roleNames) {
if (roles.containsKey(roleName))
continue;
Role role = dao.findOne(Role.class, new BasicDBObject("name", roleName));
if (role == null) {
if (log.isInfoEnabled())
log.info("Create new role = " + roleName);
role = new Role();
role.setName(roleName);
dao.save(role);
}
roles.put(roleName, role);
if (log.isDebugEnabled())
log.debug("Cache role = " + roleName);