use of com.ngtesting.platform.entity.TestCustomField in project ngtesting-platform by aaronchen2k.
the class CustomFieldServiceImpl method genVos.
@Override
public List<CustomFieldVo> genVos(List<TestCustomField> pos) {
List<CustomFieldVo> vos = new LinkedList<CustomFieldVo>();
for (TestCustomField po : pos) {
CustomFieldVo vo = genVo(po);
vos.add(vo);
}
return vos;
}
use of com.ngtesting.platform.entity.TestCustomField 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;
}
use of com.ngtesting.platform.entity.TestCustomField in project ngtesting-platform by aaronchen2k.
the class CustomFieldServiceImpl method delete.
@Override
public boolean delete(Long id) {
TestCustomField po = (TestCustomField) get(TestCustomField.class, id);
po.getProjectSet().clear();
getDao().delete(po);
return true;
}
use of com.ngtesting.platform.entity.TestCustomField in project ngtesting-platform by aaronchen2k.
the class CustomFieldServiceImpl method changeOrderPers.
@Override
public boolean changeOrderPers(Long id, String act) {
TestCustomField type = (TestCustomField) get(TestCustomField.class, id);
String hql = "from TestCustomField tp where tp.deleted = false and tp.disabled = false ";
if ("up".equals(act)) {
hql += "and tp.ordr < ? order by ordr desc";
} else if ("down".equals(act)) {
hql += "and tp.ordr > ? order by ordr asc";
} else {
return false;
}
TestCustomField neighbor = (TestCustomField) getDao().findFirstByHQL(hql, type.getOrdr());
Integer order = type.getOrdr();
type.setOrdr(neighbor.getOrdr());
neighbor.setOrdr(order);
saveOrUpdate(type);
saveOrUpdate(neighbor);
return true;
}
Aggregations