Search in sources :

Example 16 with TestProject

use of com.ngtesting.platform.entity.TestProject in project ngtesting-platform by aaronchen2k.

the class ProjectServiceImpl method updateNameInHisotyPers.

@Override
public void updateNameInHisotyPers(Long projectId, Long userId) {
    TestProject project = getDetail(projectId);
    getHistoryPers(project.getOrgId(), userId, projectId, project.getName());
}
Also used : TestProject(com.ngtesting.platform.entity.TestProject)

Example 17 with TestProject

use of com.ngtesting.platform.entity.TestProject 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;
}
Also used : TestProject(com.ngtesting.platform.entity.TestProject) TestProjectVo(com.ngtesting.platform.vo.TestProjectVo) TestCustomField(com.ngtesting.platform.entity.TestCustomField) LinkedList(java.util.LinkedList)

Aggregations

TestProject (com.ngtesting.platform.entity.TestProject)17 TestProjectVo (com.ngtesting.platform.vo.TestProjectVo)6 JSONObject (com.alibaba.fastjson.JSONObject)4 AuthPassport (com.ngtesting.platform.util.AuthPassport)4 HashMap (java.util.HashMap)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 TestCustomField (com.ngtesting.platform.entity.TestCustomField)3 LinkedList (java.util.LinkedList)3 TestRelationProjectRoleEntity (com.ngtesting.platform.entity.TestRelationProjectRoleEntity)2 Query (org.hibernate.Query)2 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)2 TestUser (com.ngtesting.platform.entity.TestUser)1 UserVo (com.ngtesting.platform.vo.UserVo)1 List (java.util.List)1 Filter (org.hibernate.Filter)1