Search in sources :

Example 1 with TestCaseExeStatus

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

the class CaseExeStatusServiceImpl method genVos.

@Override
public List<CaseExeStatusVo> genVos(List<TestCaseExeStatus> pos) {
    List<CaseExeStatusVo> vos = new LinkedList<CaseExeStatusVo>();
    for (TestCaseExeStatus po : pos) {
        CaseExeStatusVo vo = genVo(po);
        vos.add(vo);
    }
    return vos;
}
Also used : CaseExeStatusVo(com.ngtesting.platform.vo.CaseExeStatusVo) TestCaseExeStatus(com.ngtesting.platform.entity.TestCaseExeStatus) LinkedList(java.util.LinkedList)

Example 2 with TestCaseExeStatus

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

the class CasePropertyServiceImpl method getExeStatusMap.

@Override
public Map<String, String> getExeStatusMap(Long orgId) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestCaseExeStatus.class);
    dc.add(Restrictions.eq("orgId", orgId));
    dc.add(Restrictions.eq("disabled", Boolean.FALSE));
    dc.add(Restrictions.eq("deleted", Boolean.FALSE));
    dc.addOrder(Order.asc("displayOrder"));
    List<TestCaseExeStatus> ls = findAllByCriteria(dc);
    Map<String, String> map = new LinkedHashMap();
    for (TestCaseExeStatus item : ls) {
        map.put(item.getCode(), item.getName());
    }
    return map;
}
Also used : TestCaseExeStatus(com.ngtesting.platform.entity.TestCaseExeStatus) DetachedCriteria(org.hibernate.criterion.DetachedCriteria) LinkedHashMap(java.util.LinkedHashMap)

Example 3 with TestCaseExeStatus

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

the class CaseExeStatusAction method get.

@AuthPassport(validate = true)
@RequestMapping(value = "get", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> get(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    Long id = json.getLong("id");
    if (id == null) {
        ret.put("data", new CaseExeStatusVo());
        ret.put("code", Constant.RespCode.SUCCESS.getCode());
        return ret;
    }
    TestCaseExeStatus po = (TestCaseExeStatus) caseExeStatusService.get(TestCaseExeStatus.class, id);
    CaseExeStatusVo vo = caseExeStatusService.genVo(po);
    ret.put("data", vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : CaseExeStatusVo(com.ngtesting.platform.vo.CaseExeStatusVo) TestCaseExeStatus(com.ngtesting.platform.entity.TestCaseExeStatus) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) 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)

Example 4 with TestCaseExeStatus

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

the class CaseExeStatusAction 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);
    Long orgId = userVo.getDefaultOrgId();
    CaseExeStatusVo vo = json.getObject("model", CaseExeStatusVo.class);
    TestCaseExeStatus po = caseExeStatusService.save(vo, orgId);
    CaseExeStatusVo projectVo = caseExeStatusService.genVo(po);
    ret.put("data", projectVo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : CaseExeStatusVo(com.ngtesting.platform.vo.CaseExeStatusVo) TestCaseExeStatus(com.ngtesting.platform.entity.TestCaseExeStatus) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) 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)

Example 5 with TestCaseExeStatus

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

the class CaseExeStatusServiceImpl method delete.

@Override
public boolean delete(Long id) {
    TestCaseExeStatus po = (TestCaseExeStatus) get(TestCaseExeStatus.class, id);
    po.setDeleted(true);
    saveOrUpdate(po);
    return true;
}
Also used : TestCaseExeStatus(com.ngtesting.platform.entity.TestCaseExeStatus)

Aggregations

TestCaseExeStatus (com.ngtesting.platform.entity.TestCaseExeStatus)7 CaseExeStatusVo (com.ngtesting.platform.vo.CaseExeStatusVo)3 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 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 LinkedHashMap (java.util.LinkedHashMap)1 LinkedList (java.util.LinkedList)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1