use of com.ngtesting.platform.entity.TestPlan in project ngtesting-platform by aaronchen2k.
the class PlanServiceImpl method genVos.
@Override
public List<TestPlanVo> genVos(List<TestPlan> pos) {
List<TestPlanVo> vos = new LinkedList<TestPlanVo>();
for (TestPlan po : pos) {
TestPlanVo vo = genVo(po);
vos.add(vo);
}
return vos;
}
use of com.ngtesting.platform.entity.TestPlan in project ngtesting-platform by aaronchen2k.
the class PlanServiceImpl method save.
@Override
public TestPlan save(JSONObject json, UserVo optUser) {
Long id = json.getLong("id");
TestPlan po;
TestPlanVo vo = JSON.parseObject(JSON.toJSONString(json), TestPlanVo.class);
Constant.MsgType action;
if (id != null) {
po = (TestPlan) get(TestPlan.class, id);
action = Constant.MsgType.update;
} else {
po = new TestPlan();
action = Constant.MsgType.create;
}
po.setName(vo.getName());
po.setEstimate(vo.getEstimate());
po.setStartTime(vo.getStartTime());
po.setEndTime(vo.getEndTime());
po.setDescr(vo.getDescr());
po.setProjectId(vo.getProjectId());
saveOrUpdate(po);
historyService.create(po.getProjectId(), optUser, action.msg, TestHistory.TargetType.plan, po.getId(), po.getName());
return po;
}
use of com.ngtesting.platform.entity.TestPlan in project ngtesting-platform by aaronchen2k.
the class PlanServiceImpl method delete.
@Override
public TestPlan delete(Long id, Long clientId) {
TestPlan po = (TestPlan) get(TestPlan.class, id);
po.setDeleted(true);
saveOrUpdate(po);
return po;
}
use of com.ngtesting.platform.entity.TestPlan in project ngtesting-platform by aaronchen2k.
the class PlanServiceImpl method query.
@Override
public List<TestPlan> query(JSONObject json) {
Long projectId = json.getLong("projectId");
String status = json.getString("status");
String keywords = json.getString("keywords");
DetachedCriteria dc = DetachedCriteria.forClass(TestPlan.class);
if (projectId != null) {
dc.add(Restrictions.eq("projectId", projectId));
}
if (StringUtils.isNotEmpty(status)) {
dc.add(Restrictions.eq("status", TestPlan.PlanStatus.valueOf(status)));
}
if (StringUtils.isNotEmpty(keywords)) {
dc.add(Restrictions.like("name", "%" + keywords + "%"));
}
dc.add(Restrictions.eq("deleted", Boolean.FALSE));
dc.add(Restrictions.eq("disabled", Boolean.FALSE));
dc.addOrder(Order.desc("createTime"));
dc.addOrder(Order.asc("id"));
List<TestPlan> ls = findAllByCriteria(dc);
return ls;
}
use of com.ngtesting.platform.entity.TestPlan in project ngtesting-platform by aaronchen2k.
the class PlanAction method save.
@AuthPassport(validate = true)
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> save(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
TestPlan po = planService.save(json, userVo);
TestPlanVo vo = planService.genVo(po);
optFacade.opt(WsConstant.WS_TODO, userVo.getId().toString());
ret.put("data", vo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
Aggregations