Package web.operator.message

Source Code of web.operator.message.DelivereMessageController

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

package web.operator.message;

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:/operator/message/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:/operator/message/messagelist.htm");
    }

}
TOP

Related Classes of web.operator.message.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.