use of com.ngtesting.platform.entity.TestProjectPrivilegeDefine in project ngtesting-platform by aaronchen2k.
the class ProjectPrivilegeServiceImpl method listPrivilegesByOrgAndProjectRole.
@Override
public Map<String, List<ProjectPrivilegeDefineVo>> listPrivilegesByOrgAndProjectRole(Long orgId, Long projectRoleId) {
List<TestProjectPrivilegeDefine> allPrivileges = listAllProjectPrivileges();
List<TestProjectRolePriviledgeRelation> projectRolePrivileges;
if (projectRoleId == null) {
projectRolePrivileges = new LinkedList();
} else {
projectRolePrivileges = listProjectRolePrivileges(projectRoleId);
}
Map<String, List<ProjectPrivilegeDefineVo>> map = new LinkedHashMap<String, List<ProjectPrivilegeDefineVo>>();
for (TestProjectPrivilegeDefine po1 : allPrivileges) {
String key = po1.getName();
if (!map.containsKey(key)) {
List<ProjectPrivilegeDefineVo> vos = new LinkedList();
map.put(key, vos);
}
ProjectPrivilegeDefineVo vo = genVo(orgId, po1);
vo.setSelected(false);
vo.setSelecting(false);
for (TestProjectRolePriviledgeRelation po2 : projectRolePrivileges) {
if (po1.getId().longValue() == po2.getProjectPrivilegeDefineId().longValue()) {
vo.setSelected(true);
vo.setSelecting(true);
Long relationId = po2.getId();
vo.setRelationId(relationId);
}
}
map.get(key).add(vo);
}
return map;
}
use of com.ngtesting.platform.entity.TestProjectPrivilegeDefine in project ngtesting-platform by aaronchen2k.
the class ProjectPrivilegeServiceImpl method listAllProjectPrivileges.
@Override
public List<TestProjectPrivilegeDefine> listAllProjectPrivileges() {
DetachedCriteria dc = DetachedCriteria.forClass(TestProjectPrivilegeDefine.class);
dc.add(Restrictions.eq("deleted", Boolean.FALSE));
dc.add(Restrictions.eq("disabled", Boolean.FALSE));
dc.addOrder(Order.asc("id"));
List<TestProjectPrivilegeDefine> ls = findAllByCriteria(dc);
return ls;
}
Aggregations