@RequestMapping("role-input")
public String input(@RequestParam(value = "id", required = false) Long id,
Model model) {
if (id != null) {
Role role = roleManager.get(id);
model.addAttribute("role", role);
}
List<RoleDef> roleDefs = roleDefManager.find(
"from RoleDef where scopeId=?", ScopeHolder.getScopeId());
List<ScopeDTO> scopeDtos = scopeConnector.findSharedScopes();
for (ScopeDTO scopeDto : scopeDtos) {
roleDefs.addAll(roleDefManager.find(
"from RoleDef where scopeInfo=?", scopeDto.getId()));
}
List<Role> roles = roleManager.findBy("scopeId",
ScopeHolder.getScopeId());
List<RoleDef> removedRoleDefs = new ArrayList<RoleDef>();
for (Role role : roles) {
for (RoleDef roleDef : roleDefs) {
if (roleDef.getId().equals(role.getRoleDef().getId())) {
removedRoleDefs.add(roleDef);
break;
}
}