Search in sources :

Example 1 with TestPlan

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;
}
Also used : TestPlanVo(com.ngtesting.platform.vo.TestPlanVo) TestPlan(com.ngtesting.platform.entity.TestPlan) LinkedList(java.util.LinkedList)

Example 2 with TestPlan

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;
}
Also used : TestPlanVo(com.ngtesting.platform.vo.TestPlanVo) TestPlan(com.ngtesting.platform.entity.TestPlan) Constant(com.ngtesting.platform.config.Constant)

Example 3 with TestPlan

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;
}
Also used : TestPlan(com.ngtesting.platform.entity.TestPlan)

Example 4 with TestPlan

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;
}
Also used : TestPlan(com.ngtesting.platform.entity.TestPlan) DetachedCriteria(org.hibernate.criterion.DetachedCriteria)

Example 5 with TestPlan

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;
}
Also used : TestPlanVo(com.ngtesting.platform.vo.TestPlanVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) TestPlan(com.ngtesting.platform.entity.TestPlan) JSONObject(com.alibaba.fastjson.JSONObject) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

TestPlan (com.ngtesting.platform.entity.TestPlan)10 TestPlanVo (com.ngtesting.platform.vo.TestPlanVo)4 JSONObject (com.alibaba.fastjson.JSONObject)2 AuthPassport (com.ngtesting.platform.util.AuthPassport)2 UserVo (com.ngtesting.platform.vo.UserVo)2 HashMap (java.util.HashMap)2 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 Constant (com.ngtesting.platform.config.Constant)1 TestAlert (com.ngtesting.platform.entity.TestAlert)1 TestUser (com.ngtesting.platform.entity.TestUser)1 LinkedList (java.util.LinkedList)1