use of com.ngtesting.platform.entity.TestCaseType in project ngtesting-platform by aaronchen2k.
the class CasePropertyServiceImpl method getTypeMap.
@Override
public Map<String, String> getTypeMap(Long orgId) {
DetachedCriteria dc = DetachedCriteria.forClass(TestCaseType.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<TestCaseType> ls = findAllByCriteria(dc);
Map<String, String> map = new LinkedHashMap();
for (TestCaseType item : ls) {
map.put(item.getCode(), item.getName());
}
return map;
}
use of com.ngtesting.platform.entity.TestCaseType in project ngtesting-platform by aaronchen2k.
the class CaseTypeServiceImpl method delete.
@Override
public boolean delete(Long id) {
TestCaseType po = (TestCaseType) get(TestCaseType.class, id);
po.setDeleted(true);
saveOrUpdate(po);
return true;
}
use of com.ngtesting.platform.entity.TestCaseType in project ngtesting-platform by aaronchen2k.
the class CaseTypeServiceImpl method setDefaultPers.
@Override
public boolean setDefaultPers(Long id, Long orgId) {
List<TestCaseType> ls = list(orgId);
for (TestCaseType type : ls) {
if (type.getId().longValue() == id.longValue()) {
type.setIsDefault(true);
saveOrUpdate(type);
} else if (type.getIsDefault() != null && type.getIsDefault()) {
type.setIsDefault(false);
saveOrUpdate(type);
}
}
return true;
}
use of com.ngtesting.platform.entity.TestCaseType in project ngtesting-platform by aaronchen2k.
the class CaseTypeServiceImpl method changeOrderPers.
@Override
public boolean changeOrderPers(Long id, String act, Long orgId) {
TestCaseType type = (TestCaseType) get(TestCaseType.class, id);
String hql = "from TestCaseType tp where tp.orgId=? and tp.deleted = false and tp.disabled = false ";
if ("up".equals(act)) {
hql += "and tp.displayOrder < ? order by displayOrder desc";
} else if ("down".equals(act)) {
hql += "and tp.displayOrder > ? order by displayOrder asc";
} else {
return false;
}
TestCaseType neighbor = (TestCaseType) getFirstByHql(hql, orgId, type.getDisplayOrder());
Integer order = type.getDisplayOrder();
type.setDisplayOrder(neighbor.getDisplayOrder());
neighbor.setDisplayOrder(order);
saveOrUpdate(type);
saveOrUpdate(neighbor);
return true;
}
use of com.ngtesting.platform.entity.TestCaseType 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;
}
Aggregations