01: package org.claros.intouch.calendar.services;
02:
03: import java.io.IOException;
04: import java.io.PrintWriter;
05: import java.sql.Timestamp;
06: import java.util.Date;
07:
08: import javax.servlet.ServletException;
09: import javax.servlet.http.HttpServletRequest;
10: import javax.servlet.http.HttpServletResponse;
11:
12: import org.claros.intouch.calendar.controllers.CalendarDBController;
13: import org.claros.intouch.calendar.models.CalendarObject;
14: import org.claros.intouch.common.services.BaseService;
15:
16: public class SetReminderToOkService extends BaseService {
17: private static final long serialVersionUID = -6372890425614908341L;
18:
19: /**
20: * @param request the request send by the client to the server
21: * @param response the response send by the server to the client
22: * @throws ServletException if an error occurred
23: * @throws IOException if an error occurred
24: */
25: public void doPost(HttpServletRequest request,
26: HttpServletResponse response) throws ServletException,
27: IOException {
28: response.setHeader("Expires", "-1");
29: response.setHeader("Pragma", "no-cache");
30: response.setHeader("Cache-control", "no-cache");
31: response.setHeader("Content-Type", "text/html; charset=utf-8");
32: PrintWriter out = response.getWriter();
33:
34: try {
35: String sEventId = request.getParameter("id");
36:
37: CalendarObject obj = CalendarDBController.getEventById(
38: getAuthProfile(request), new Long(sEventId));
39: obj.setRemindedBefore("true");
40: obj.setLastDismissedAt(new Timestamp(new Date().getTime()));
41: CalendarDBController
42: .saveEvent(getAuthProfile(request), obj);
43: out.print("ok");
44: } catch (Exception e) {
45: out.print("fail");
46: }
47: }
48:
49: }
|