Package com.mossle.msg.domain

Examples of com.mossle.msg.domain.MsgInfo


public class DefaultMsgConnector implements MsgConnector {
    private MsgInfoManager msgInfoManager;

    public void send(String subject, String content, String receiverId,
            String senderId) {
        MsgInfo msgInfo = new MsgInfo();
        msgInfo.setName(subject);
        msgInfo.setContent(content);
        msgInfo.setReceiverId(receiverId);
        msgInfo.setSenderId(senderId);
        msgInfo.setCreateTime(new Date());
        msgInfo.setStatus(0);
        msgInfoManager.save(msgInfo);
    }
View Full Code Here


    @RequestMapping("msg-info-input")
    public String input(@RequestParam(value = "id", required = false) Long id,
            Model model) {
        if (id != null) {
            MsgInfo msgInfo = msgInfoManager.get(id);

            model.addAttribute("model", msgInfo);
        }

        return "msg/msg-info-input";
View Full Code Here

    @RequestMapping("msg-info-save")
    public String save(@ModelAttribute MsgInfo msgInfo,
            @RequestParam("username") String username,
            RedirectAttributes redirectAttributes) {
        MsgInfo dest = null;
        Long id = msgInfo.getId();

        if (id != null) {
            dest = msgInfoManager.get(id);
            beanMapper.copy(msgInfo, dest);
        } else {
            dest = msgInfo;

            String userId = SpringSecurityUtils.getCurrentUserId();
            dest.setSenderId(userId);

            UserDTO userDto = userConnector.findByUsername(username, "1");

            if (userDto == null) {
                throw new IllegalStateException("user not exists : " + username);
            }

            dest.setReceiverId(userDto.getId());
            dest.setCreateTime(new Date());
            dest.setStatus(0);
        }

        msgInfoManager.save(dest);

        messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
View Full Code Here

    }

    @RequestMapping("msg-info-view")
    public String view(@RequestParam("id") Long id, Model model) {
        String userId = SpringSecurityUtils.getCurrentUserId();
        MsgInfo msgInfo = msgInfoManager.get(id);

        if ((msgInfo.getStatus() == 0)
                && userId.equals(msgInfo.getReceiverId())) {
            msgInfo.setStatus(1);
            msgInfoManager.save(msgInfo);
        }

        model.addAttribute("model", msgInfo);
View Full Code Here

TOP

Related Classes of com.mossle.msg.domain.MsgInfo

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.