Package com.mossle.doc.domain

Examples of com.mossle.doc.domain.DocInfo


    @RequestMapping("doc-info-input")
    public String input(@RequestParam(value = "id", required = false) Long id,
            Model model) {
        if (id != null) {
            DocInfo docInfo = docInfoManager.get(id);
            model.addAttribute("model", docInfo);
        }

        return "doc/doc-info-input";
    }
View Full Code Here


    @RequestMapping("doc-info-save")
    public String save(@ModelAttribute DocInfo docInfo,
            @RequestParam("attachment") MultipartFile attachment,
            @RequestParam Map<String, Object> parameterMap,
            RedirectAttributes redirectAttributes) throws Exception {
        DocInfo dest = null;
        Long id = docInfo.getId();

        if (id != null) {
            dest = docInfoManager.get(id);
            beanMapper.copy(docInfo, dest);
        } else {
            dest = docInfo;
            dest.setCreateTime(new Date());

            String userId = SpringSecurityUtils.getCurrentUserId();
            dest.setUserId(Long.parseLong(userId));
        }

        StoreDTO storeDto = storeConnector.save("docinfo",
                new MultipartFileResource(attachment),
                attachment.getOriginalFilename());

        dest.setName(attachment.getOriginalFilename());
        dest.setPath(storeDto.getKey());

        docInfoManager.save(dest);

        messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
                "保存成功");
View Full Code Here

    }

    @RequestMapping("doc-info-download")
    public void download(@RequestParam("id") Long id,
            HttpServletResponse response) throws Exception {
        DocInfo docInfo = docInfoManager.get(id);
        InputStream is = null;

        try {
            ServletUtils.setFileDownloadHeader(response, docInfo.getName());
            is = storeConnector.get("docinfo", docInfo.getPath()).getResource()
                    .getInputStream();
            IoUtils.copyStream(is, response.getOutputStream());
        } finally {
            if (is != null) {
                is.close();
View Full Code Here

TOP

Related Classes of com.mossle.doc.domain.DocInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.