Package web.users

Source Code of web.users.DelivereMessageController

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package web.users;

import domain.Message;
import domain.UserRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import web.generic.CH;
import web.generic.GenericAbstractController;

/**
* Контроллер, удаляющий сообщение
* Обязательные параметры:
*     request - ID Message
* @author vip
*/
public class DelivereMessageController extends GenericAbstractController {

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {
        String requestStr = hsr.getParameter("request");
        if (requestStr == null || requestStr.isEmpty()) {
            return new ModelAndView("redirect:/users/messagelist.htm");
        }
       
        Message request = null;
        try {
            request = CH.get(getDao(), Message.class, hsr.getParameter("request"));
        } catch (Exception ex) {
        }
        if (request != null) {
            request.setDelivered(true);
            getDao().save(request);
        }
        return new ModelAndView("redirect:/users/messagelist.htm");
    }

}
TOP

Related Classes of web.users.DelivereMessageController

TOP
Copyright © 2018 www.massapi.com. 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.