public int compare(GroupBean o1, GroupBean o2) {
return o1.getGroupDescriptor().getName().compareToIgnoreCase(o2.getGroupDescriptor().getName());
}
});
for(GroupBean g:children){
GroupJobTreeModel group=new GroupJobTreeModel();
group.setName(g.getGroupDescriptor().getName());
group.setId(g.getGroupDescriptor().getId());
group.setGroup(true);
group.setJob(false);
group.setOwner(g.getGroupDescriptor().getOwner());
group.setDirectory(g.isDirectory());
Boolean follow=groupFollow.get(g.getGroupDescriptor().getId());
group.setFollow(follow==null?false:(follow?true:false));
parent.getChildren().add(group);
if(g.isDirectory()){
setGroup(group,g.getChildrenGroupBeans(),groupFollow,jobFollow);
}else{
List<JobBean> list=new ArrayList<JobBean>();
for(JobBean jb:g.getJobBeans().values()){
list.add(jb);
}
Collections.sort(list, new Comparator<JobBean>() {
public int compare(JobBean o1, JobBean o2) {
return o1.getJobDescriptor().getName().compareTo(o2.getJobDescriptor().getName());
}
});
for(JobBean jb:list){
GroupJobTreeModel job=new GroupJobTreeModel();
job.setId(jb.getJobDescriptor().getId());
job.setGroup(false);
job.setDirectory(false);
job.setName(jb.getJobDescriptor().getName());
job.setJob(true);
Boolean jFollow=jobFollow.get(job.getId());
job.setFollow(jFollow==null?false:(jFollow?true:false));
group.getChildren().add(job);
}
}
}