Search in sources :

Example 1 with TestCasePriority

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

the class CasePriorityServiceImpl method delete.

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

Example 2 with TestCasePriority

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

the class CasePriorityServiceImpl method genVos.

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

Example 3 with TestCasePriority

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

the class CasePropertyServiceImpl method getPriorityMap.

@Override
public Map<String, String> getPriorityMap(Long orgId) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestCasePriority.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<TestCasePriority> ls = findAllByCriteria(dc);
    Map<String, String> map = new LinkedHashMap();
    for (TestCasePriority item : ls) {
        map.put(item.getCode(), item.getName());
    }
    return map;
}
Also used : TestCasePriority(com.ngtesting.platform.entity.TestCasePriority) DetachedCriteria(org.hibernate.criterion.DetachedCriteria) LinkedHashMap(java.util.LinkedHashMap)

Example 4 with TestCasePriority

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

the class CasePriorityAction 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();
    CasePriorityVo vo = json.getObject("model", CasePriorityVo.class);
    TestCasePriority po = casePriorityService.save(vo, orgId);
    CasePriorityVo projectVo = casePriorityService.genVo(po);
    Map<String, Map<String, String>> casePropertyMap = casePropertyService.getMap(orgId);
    ret.put("casePropertyMap", casePropertyMap);
    ret.put("data", projectVo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : TestCasePriority(com.ngtesting.platform.entity.TestCasePriority) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) CasePriorityVo(com.ngtesting.platform.vo.CasePriorityVo) JSONObject(com.alibaba.fastjson.JSONObject) HashMap(java.util.HashMap) Map(java.util.Map) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 5 with TestCasePriority

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

the class CasePriorityAction 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 CasePriorityVo());
        ret.put("code", Constant.RespCode.SUCCESS.getCode());
        return ret;
    }
    TestCasePriority po = (TestCasePriority) casePriorityService.get(TestCasePriority.class, id);
    CasePriorityVo vo = casePriorityService.genVo(po);
    ret.put("data", vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : TestCasePriority(com.ngtesting.platform.entity.TestCasePriority) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) CasePriorityVo(com.ngtesting.platform.vo.CasePriorityVo) 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

TestCasePriority (com.ngtesting.platform.entity.TestCasePriority)8 CasePriorityVo (com.ngtesting.platform.vo.CasePriorityVo)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 Map (java.util.Map)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1