use of com.ngtesting.platform.vo.TestProjectVo in project ngtesting-platform by aaronchen2k.
the class ProjectServiceImpl method listProjectGroups.
@Override
public List<TestProjectVo> listProjectGroups(Long orgId) {
DetachedCriteria dc = DetachedCriteria.forClass(TestProject.class);
dc.add(Restrictions.eq("orgId", orgId));
dc.add(Restrictions.eq("type", ProjectType.group));
dc.add(Restrictions.eq("disabled", false));
dc.add(Restrictions.eq("deleted", Boolean.FALSE));
dc.addOrder(Order.asc("id"));
List<TestProject> pos = findAllByCriteria(dc);
List<TestProjectVo> vos = this.genGroupVos(pos);
return vos;
}
use of com.ngtesting.platform.vo.TestProjectVo in project ngtesting-platform by aaronchen2k.
the class ProjectServiceImpl method genVos.
@Override
public List<TestProjectVo> genVos(List<TestProject> pos, String keywords, String disabled) {
List<TestProjectVo> voList = new LinkedList<TestProjectVo>();
for (TestProject po : pos) {
TestProjectVo vo = genVo(po);
voList.add(vo);
List<TestProjectVo> voList2 = new LinkedList<TestProjectVo>();
List<TestProject> children = po.getChildren();
for (TestProject child : children) {
if ((StringUtil.IsEmpty(keywords) || child.getName().toLowerCase().indexOf(keywords.toLowerCase()) > -1) && (StringUtil.IsEmpty(disabled) || child.getDisabled() == Boolean.valueOf(disabled))) {
TestProjectVo childVo = genVo(child);
voList2.add(childVo);
}
}
vo.setChildrenNumb(voList2.size());
voList.addAll(voList2);
}
return voList;
}
use of com.ngtesting.platform.vo.TestProjectVo in project ngtesting-platform by aaronchen2k.
the class ProjectServiceImpl method viewPers.
@Override
public TestProjectVo viewPers(Long projectId, UserVo userVo) {
TestProject project = getDetail(projectId);
getHistoryPers(project.getOrgId(), userVo.getId(), projectId, project.getName());
TestUser userPo = (TestUser) get(TestUser.class, userVo.getId());
userPo.setDefaultPrjId(projectId);
saveOrUpdate(userPo);
userVo.setDefaultPrjId(projectId);
userVo.setDefaultPrjName(project.getName());
TestProjectVo vo = genVo(project);
return vo;
}
use of com.ngtesting.platform.vo.TestProjectVo in project ngtesting-platform by aaronchen2k.
the class CustomFieldServiceImpl method listProjectsForField.
@Override
public List<TestProjectVo> listProjectsForField(Long orgId, Long fieldId) {
List<TestProject> allProjects = projectService.list(orgId, null, null);
Set<TestProject> projectsForField;
if (fieldId == null) {
projectsForField = new HashSet<TestProject>();
} else {
TestCustomField field = (TestCustomField) get(TestCustomField.class, fieldId);
projectsForField = field.getProjectSet();
}
List<TestProjectVo> vos = new LinkedList<TestProjectVo>();
for (TestProject po1 : allProjects) {
TestProjectVo vo = projectService.genVo(po1);
vo.setSelected(false);
vo.setSelecting(false);
for (TestProject item : projectsForField) {
if (po1.getId().longValue() == item.getId().longValue()) {
vo.setSelected(true);
vo.setSelecting(true);
}
}
vos.add(vo);
for (TestProject child : po1.getChildren()) {
TestProjectVo childVo = projectService.genVo(child);
for (TestProject item : projectsForField) {
if (child.getId().longValue() == item.getId().longValue()) {
childVo.setSelected(true);
childVo.setSelecting(true);
}
}
vos.add(childVo);
}
}
return vos;
}
Aggregations