package cn.updev.Action.User;

/**
 * Created by hypo on 15-12-9.
 */
public class MessageAction {
}

@@ -28,74 +28,3083 @@
 r;%0A%0A
-/**%0A * Created by hypo on 15-12-9.%0A */%0Apublic class MessageAction %7B
+import cn.updev.Users.NotificationPush.NotificationInfo;%0Aimport cn.updev.Users.NotificationPush.NotificationSender;%0Aimport cn.updev.Users.Static.EnumeRule.NotificationType;%0Aimport cn.updev.Users.Static.FuctionClass.Login;%0Aimport cn.updev.Users.Static.UserOrGroupDAO.UserOrGroupQuery;%0Aimport cn.updev.Users.Static.UserOrGroupInterface.IUser;%0Aimport com.opensymphony.xwork2.ActionSupport;%0Aimport org.apache.struts2.ServletActionContext;%0A%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport java.util.List;%0A%0A/**%0A * Created by hypo on 15-12-9.%0A */%0Apublic class MessageAction extends ActionSupport %7B%0A%0A    private Integer id;%0A    private String toUser;%0A    private String title;%0A    private String content;%0A%0A    public String execute()%7B%0A%0A        Login login = new Login();%0A        if(login.isNotLogined())%7B%0A            return LOGIN;%0A        %7D%0A%0A        IUser user = login.getLoginedUser();%0A        UserOrGroupQuery DAO = new UserOrGroupQuery();%0A%0A        List%3CNotificationInfo%3E list = DAO.queryNotificationAll(user.getUserId());%0A%0A        HttpServletRequest request = ServletActionContext.getRequest();%0A        request.setAttribute(%22messageList%22, list);%0A        return SUCCESS;%0A    %7D%0A%0A    public String sender()%7B%0A%0A        Login login = new Login();%0A        if(login.isNotLogined())%7B%0A            return LOGIN;%0A        %7D%0A%0A        IUser user = login.getLoginedUser();%0A%0A        NotificationInfo notificationInfo = new NotificationInfo();%0A%0A        notificationInfo.setNotificationCreaterId(user.getUserId());%0A        notificationInfo.setTitle(this.title);%0A        notificationInfo.setNotifucationBody(this.content);%0A        notificationInfo.setType(NotificationType.user);%0A%0A        String%5B%5D toUsers = this.toUser.split(%22,%22);%0A%0A        for(String userlogin : toUsers)%7B%0A            UserOrGroupQuery DAO = new UserOrGroupQuery();%0A            IUser touser = DAO.queryUserByName(userlogin);%0A%0A            notificationInfo.setNotificationAccepterId(touser.getUserId());%0A            NotificationSender sender = new NotificationSender(notificationInfo);%0A            sender.NotificationSendToUser();%0A%0A        %7D%0A%0A        return SUCCESS;%0A    %7D%0A%0A    public String read()%7B%0A%0A        Login login = new Login();%0A        if(login.isNotLogined())%7B%0A            return LOGIN;%0A        %7D%0A%0A        UserOrGroupQuery DAO = new UserOrGroupQuery();%0A        NotificationInfo info = DAO.queryNotificationById(this.id);%0A%0A        HttpServletRequest request = ServletActionContext.getRequest();%0A        request.setAttribute(%22messageInfo%22, info);%0A%0A        return SUCCESS;%0A    %7D%0A%0A%0A    public String getContent() %7B%0A        return content;%0A    %7D%0A%0A    public void setContent(String content) %7B%0A        this.content = content;%0A    %7D%0A%0A    public String getTitle() %7B%0A        return title;%0A    %7D%0A%0A    public void setTitle(String title) %7B%0A        this.title = title;%0A    %7D%0A%0A    public String getToUser() %7B%0A        return toUser;%0A    %7D%0A%0A    public void setToUser(String toUser) %7B%0A        this.toUser = toUser;%0A    %7D%0A%0A    public Integer getId() %7B%0A        return id;%0A    %7D%0A%0A    public void setId(Integer id) %7B%0A        this.id = id;%0A    %7D
 %0A%7D%0A

update message action