if(resource==null)
{
result.setFailed(RESOURCE_NOT_EXIST);
return result;
}
ResAccess resAccess = resAccessDAO.findById(resourceID);
if(resAccess!=null)
{
LazyDynaBean resultBean = ObjectListConvert2DynaBeanList.convert(resAccess);
String expression = resAccess.getExpression();
// 获得所有角色列表,并标识该角色是否拥有该资源
List<Srole>tmpRoles = sroleDAO.findAll();
List<LazyDynaBean>roles = new ArrayList<LazyDynaBean>();
for(Srole role:tmpRoles)
{
LazyDynaBean bean = ObjectListConvert2DynaBeanList.convert(role);
if(isRoleInResExpression(role.getAuthority(), expression))
bean.set("signal", true);
else bean.set("signal", false);
roles.add(bean);
}
resultBean.set("roles", roles);//设置资源对应的角色信息
resultBean.set("sigleSelection", getSSInfo4Expression(expression));//一些单选信息
resultBean.set("ip", getIpInfo4Expression(expression));//ip信息
result.setData(resultBean);
}
// result.setData(ObjectListConvert2DynaBeanList.convert(resAccess));
else
{
ResAccess tmp = new ResAccess();
tmp.setResourceId(resourceID);
tmp.setStatus(false);
LazyDynaBean resultBean = ObjectListConvert2DynaBeanList.convert(tmp);
List<Srole>tmpRoles = sroleDAO.findAll();
List<LazyDynaBean>roles = new ArrayList<LazyDynaBean>();
for(Srole role:tmpRoles)
{