01: package org.claros.intouch.notes.services;
02:
03: import java.io.IOException;
04: import java.io.PrintWriter;
05: import java.util.List;
06:
07: import javax.servlet.ServletException;
08: import javax.servlet.http.HttpServletRequest;
09: import javax.servlet.http.HttpServletResponse;
10:
11: import org.claros.intouch.common.services.BaseService;
12: import org.claros.intouch.notes.controllers.NotesFolderController;
13: import org.claros.intouch.notes.models.NotesFolder;
14:
15: public class GetNotebooksService extends BaseService {
16:
17: /**
18: *
19: */
20: private static final long serialVersionUID = 5409377535613883558L;
21:
22: /**
23: * @param request
24: * the request send by the client to the server
25: * @param response
26: * the response send by the server to the client
27: * @throws ServletException
28: * if an error occurred
29: * @throws IOException
30: * if an error occurred
31: */
32: public void doGet(HttpServletRequest request,
33: HttpServletResponse response) throws ServletException,
34: IOException {
35:
36: response.setHeader("Expires", "-1");
37: response.setHeader("Pragma", "no-cache");
38: response.setHeader("Cache-control", "no-cache");
39: response.setHeader("Content-Type", "text/html; charset=utf-8");
40: PrintWriter out = response.getWriter();
41:
42: try {
43: out.print("<tr onclick='getNotes(0);' id='notebook0'>"
44: + "<td>" + getText(request, "unorganized.notes")
45: + "</td>" + "</tr>");
46:
47: List folders = NotesFolderController
48: .getFolders(getAuthProfile(request));
49: if (folders != null) {
50: NotesFolder tmp = null;
51: for (int i = 0; i < folders.size(); i++) {
52: tmp = (NotesFolder) folders.get(i);
53:
54: out.print("<tr onclick='getNotes(" + tmp.getId()
55: + ");' id='notebook" + tmp.getId() + "'>"
56: + "<td>" + tmp.getFolderName() + "</td>"
57: + "</tr>");
58: }
59: }
60: } catch (Exception e) {
61: e.printStackTrace();
62: }
63: }
64:
65: }
|