/*
* 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 RemoveMessageController 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) {
getDao().delete(request);
}
return new ModelAndView("redirect:/operator/message/messagelist.htm");
}
}