use of com.ngtesting.platform.entity.TestOrgGroup in project ngtesting-platform by aaronchen2k.
the class RelationOrgGroupUserServiceImpl method listAllOrgGroups.
private List<TestOrgGroup> listAllOrgGroups(Long orgId) {
DetachedCriteria dc = DetachedCriteria.forClass(TestOrgGroup.class);
dc.add(Restrictions.eq("orgId", orgId));
dc.add(Restrictions.eq("deleted", Boolean.FALSE));
dc.add(Restrictions.eq("disabled", Boolean.FALSE));
dc.addOrder(Order.asc("id"));
List<TestOrgGroup> ls = findAllByCriteria(dc);
return ls;
}
use of com.ngtesting.platform.entity.TestOrgGroup in project ngtesting-platform by aaronchen2k.
the class RelationOrgGroupUserServiceImpl method genVo.
private RelationOrgGroupUserVo genVo(Long orgId, Long orgGroupId, Long userId) {
RelationOrgGroupUserVo vo = new RelationOrgGroupUserVo();
vo.setOrgId(orgId);
if (orgGroupId != null) {
TestOrgGroup orgGroup = (TestOrgGroup) get(TestOrgGroup.class, orgGroupId);
vo.setOrgGroupId(orgGroupId);
vo.setOrgGroupName(orgGroup.getName());
}
if (userId != null) {
TestUser user = (TestUser) get(TestUser.class, userId);
vo.setUserId(user.getId());
vo.setUserName(user.getName());
}
return vo;
}
use of com.ngtesting.platform.entity.TestOrgGroup in project ngtesting-platform by aaronchen2k.
the class RelationOrgGroupUserServiceImpl method listRelationsByUser.
@Override
public List<RelationOrgGroupUserVo> listRelationsByUser(Long orgId, Long userId) {
List<TestOrgGroup> allOrgGroups = listAllOrgGroups(orgId);
List<TestRelationOrgGroupUser> relations;
if (userId == null) {
relations = new LinkedList<>();
} else {
relations = listRelations(orgId, null, userId);
}
List<RelationOrgGroupUserVo> vos = new LinkedList<>();
for (TestOrgGroup orgGroup : allOrgGroups) {
RelationOrgGroupUserVo vo = genVo(orgId, orgGroup.getId(), userId);
vo.setSelected(false);
vo.setSelecting(false);
for (TestRelationOrgGroupUser po : relations) {
if (po.getOrgGroupId() == orgGroup.getId() && po.getUserId() == userId) {
vo.setSelected(true);
vo.setSelecting(true);
}
}
vos.add(vo);
}
return vos;
}
use of com.ngtesting.platform.entity.TestOrgGroup in project ngtesting-platform by aaronchen2k.
the class OrgGroupServiceImpl method genVos.
@Override
public List<OrgGroupVo> genVos(List<TestOrgGroup> pos) {
List<OrgGroupVo> vos = new LinkedList<OrgGroupVo>();
for (TestOrgGroup po : pos) {
OrgGroupVo vo = genVo(po);
vos.add(vo);
}
return vos;
}
use of com.ngtesting.platform.entity.TestOrgGroup in project ngtesting-platform by aaronchen2k.
the class OrgGroupServiceImpl method save.
@Override
public TestOrgGroup save(OrgGroupVo vo, Long orgId) {
if (vo == null) {
return null;
}
TestOrgGroup po = new TestOrgGroup();
if (vo.getId() != null) {
po = (TestOrgGroup) get(TestOrgGroup.class, vo.getId());
}
po.setName(vo.getName());
po.setDescr(vo.getDescr());
po.setDisabled(vo.getDisabled());
po.setOrgId(orgId);
saveOrUpdate(po);
return po;
}
Aggregations