Search in sources :

Example 1 with CaseTypeVo

use of com.ngtesting.platform.vo.CaseTypeVo in project ngtesting-platform by aaronchen2k.

the class CaseTypeServiceImpl method listVos.

@Override
public List<CaseTypeVo> listVos(Long orgId) {
    List ls = list(orgId);
    List<CaseTypeVo> vos = genVos(ls);
    return vos;
}
Also used : CaseTypeVo(com.ngtesting.platform.vo.CaseTypeVo) List(java.util.List) LinkedList(java.util.LinkedList)

Example 2 with CaseTypeVo

use of com.ngtesting.platform.vo.CaseTypeVo in project ngtesting-platform by aaronchen2k.

the class CaseTypeServiceImpl method genVo.

// @Override
// public void createDefaultBasicDataPers(Long orgId) {
// DetachedCriteria dc = DetachedCriteria.forClass(TestCaseType.class);
// dc.add(Restrictions.eq("isBuildIn", true));
// dc.add(Restrictions.eq("disabled", Boolean.FALSE));
// dc.add(Restrictions.eq("deleted", Boolean.FALSE));
// 
// dc.addOrder(Order.asc("displayOrder"));
// List<TestCaseType> ls = findAllByCriteria(dc);
// 
// for (TestCaseType p : ls) {
// TestCaseType temp = new TestCaseType();
// BeanUtilEx.copyProperties(temp, p);
// temp.setId(null);
// temp.setOrgId(orgId);
// saveOrUpdate(temp);
// }
// }
@Override
public CaseTypeVo genVo(TestCaseType po) {
    if (po == null) {
        return null;
    }
    CaseTypeVo vo = new CaseTypeVo();
    BeanUtilEx.copyProperties(vo, po);
    return vo;
}
Also used : CaseTypeVo(com.ngtesting.platform.vo.CaseTypeVo)

Example 3 with CaseTypeVo

use of com.ngtesting.platform.vo.CaseTypeVo in project ngtesting-platform by aaronchen2k.

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

use of com.ngtesting.platform.vo.CaseTypeVo in project ngtesting-platform by aaronchen2k.

the class CaseTypeAction 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();
    CaseTypeVo vo = json.getObject("model", CaseTypeVo.class);
    TestCaseType po = caseTypeService.save(vo, orgId);
    CaseTypeVo projectVo = caseTypeService.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 : UserVo(com.ngtesting.platform.vo.UserVo) CaseTypeVo(com.ngtesting.platform.vo.CaseTypeVo) HashMap(java.util.HashMap) TestCaseType(com.ngtesting.platform.entity.TestCaseType) 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 CaseTypeVo

use of com.ngtesting.platform.vo.CaseTypeVo in project ngtesting-platform by aaronchen2k.

the class CaseTypeAction method setDefault.

@AuthPassport(validate = true)
@RequestMapping(value = "setDefault", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> setDefault(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();
    Long id = json.getLong("id");
    boolean success = caseTypeService.setDefaultPers(id, orgId);
    List<CaseTypeVo> vos = caseTypeService.listVos(orgId);
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) CaseTypeVo(com.ngtesting.platform.vo.CaseTypeVo) 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)

Aggregations

CaseTypeVo (com.ngtesting.platform.vo.CaseTypeVo)8 JSONObject (com.alibaba.fastjson.JSONObject)5 AuthPassport (com.ngtesting.platform.util.AuthPassport)5 UserVo (com.ngtesting.platform.vo.UserVo)5 HashMap (java.util.HashMap)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)5 TestCaseType (com.ngtesting.platform.entity.TestCaseType)3 LinkedList (java.util.LinkedList)2 Map (java.util.Map)2 List (java.util.List)1