Search in sources :

Example 1 with TestDocument

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

the class DocumentServiceImpl method genVos.

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

Example 2 with TestDocument

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

the class DocumentServiceImpl method save.

@Override
public TestDocument save(DocumentVo vo) {
    if (vo == null) {
        return null;
    }
    TestDocument po = new TestDocument();
    if (vo.getId() != null) {
        po = (TestDocument) get(TestDocument.class, vo.getId());
    }
    po.setEventId(vo.getEventId());
    po.setTitle(vo.getTitle());
    po.setUri(vo.getUri());
    saveOrUpdate(po);
    return po;
}
Also used : TestDocument(com.ngtesting.platform.entity.TestDocument)

Example 3 with TestDocument

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

the class DocumentAction method save.

@AuthPassport(validate = true)
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> save(HttpServletRequest request, @RequestBody DocumentVo vo) {
    Map<String, Object> ret = new HashMap<String, Object>();
    TestDocument doc = documentService.save(vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : TestDocument(com.ngtesting.platform.entity.TestDocument) 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 TestDocument

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

the class DocumentServiceImpl method listByEvent.

@Override
public List<TestDocument> listByEvent(Long eventId, DocType type) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestDocument.class);
    dc.add(Restrictions.eq("eventId", eventId));
    if (type != null) {
        dc.add(Restrictions.eq("docType", type));
    }
    dc.add(Restrictions.eq("deleted", Boolean.FALSE));
    dc.add(Restrictions.eq("disabled", Boolean.FALSE));
    dc.addOrder(Order.asc("id"));
    List<TestDocument> docPos = findAllByCriteria(dc);
    return docPos;
}
Also used : TestDocument(com.ngtesting.platform.entity.TestDocument) DetachedCriteria(org.hibernate.criterion.DetachedCriteria)

Example 5 with TestDocument

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

the class DocumentServiceImpl method remove.

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

Aggregations

TestDocument (com.ngtesting.platform.entity.TestDocument)5 JSONObject (com.alibaba.fastjson.JSONObject)1 AuthPassport (com.ngtesting.platform.util.AuthPassport)1 DocumentVo (com.ngtesting.platform.vo.DocumentVo)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1