return model;
}
public GroupModel getUpstreamGroup(String groupId) throws GwtException{
GroupBean bean=permissionGroupManager.getUpstreamGroupBean(groupId);
GroupDescriptor gd=bean.getGroupDescriptor();
GroupModel model=new GroupModel();
model.setParent(bean.getParentGroupBean()==null?null:bean.getParentGroupBean().getGroupDescriptor().getId());
model.setLocalResources(gd.getResources());
model.setAllResources(bean.getHierarchyResources());
model.setLocalProperties(new HashMap<String, String>(gd.getProperties()));
model.setDesc(gd.getDesc());
model.setDirectory(gd.isDirectory());
model.setId(gd.getId());
model.setName(gd.getName());
model.setOwner(gd.getOwner());
String ownerName=userManager.findByUid(gd.getOwner()).getName();
if(ownerName==null || "".equals(ownerName.trim()) || "null".equals(ownerName)){
ownerName=gd.getOwner();
}
model.setOwnerName(ownerName);
model.setParent(gd.getParent());
model.setAllProperties(bean.getHierarchyProperties().getAllProperties());
model.setAdmin(permissionGroupManager.hasGroupPermission(LoginUser.getUser().getUid(), groupId));
List<ZeusFollow> follows=followManager.findGroupFollowers(Arrays.asList(groupId));
if(follows!=null){
List<String> followsName=new ArrayList<String>();
for(ZeusFollow zf:follows){
String name=userManager.findByUid(zf.getUid()).getName();
if(name==null || "".equals(name.trim())){
name=zf.getUid();
}
followsName.add(name);
}
model.setFollows(followsName);
}
List<String> ladmins=permissionManager.getGroupAdmins(bean.getGroupDescriptor().getId());
List<String> admins=new ArrayList<String>();
for(String s:ladmins){
String name=userManager.findByUid(s).getName();
if(name==null || "".equals(name.trim())){
name=s;
}
admins.add(name);
}
model.setAdmins(admins);
List<String> owners=new ArrayList<String>();
owners.add(bean.getGroupDescriptor().getOwner());
GroupBean parent=bean.getParentGroupBean();
while(parent!=null){
if(!owners.contains(parent.getGroupDescriptor().getOwner())){
owners.add(parent.getGroupDescriptor().getOwner());
}
parent=parent.getParentGroupBean();
}
model.setOwners(owners);
//所有secret. 开头的配置项都进行权限控制
for(String key:model.getAllProperties().keySet()){