1 package org.sourceforge.vlibrary.user.actions;
2
3
4 import java.util.ArrayList;
5
6 import javax.servlet.http.HttpServletRequest;
7 import javax.servlet.http.HttpServletResponse;
8
9 import org.apache.log4j.Logger;
10 import org.apache.struts.action.ActionForm;
11 import org.apache.struts.action.ActionForward;
12 import org.apache.struts.action.ActionMapping;
13 import org.apache.struts.util.MessageResources;
14 import org.sourceforge.vlibrary.exceptions.LibraryException;
15 import org.sourceforge.vlibrary.user.forms.BookSearchForm;
16
17
18
19
20
21 public class PrepareListBookAction extends LibraryAction {
22
23
24 private static Logger logger =
25 Logger.getLogger(PrepareListBookAction.class.getName());
26
27
28
29
30
31
32
33
34
35
36
37
38 public ActionForward executeAction(ActionMapping mapping,
39 ActionForm form,
40 HttpServletRequest request,
41 HttpServletResponse response,
42 MessageResources messages)
43 throws Exception {
44
45 BookSearchForm frm = (BookSearchForm) form;
46 ArrayList<LibraryException> errors = new ArrayList<LibraryException>();
47
48
49 try {
50 frm.setSubjectList(libraryManager.getSubjects());
51 } catch (Throwable t) {
52 String errString = messages.getMessage("error.subjects.retrieve");
53 logger.error(errString,t);
54 errors.add(new LibraryException(errString,t));
55 }
56
57
58 try {
59 frm.setLocations(libraryManager.getLocations());
60 } catch (Throwable t) {
61 String errString = messages.getMessage("error.locations.retrieve");
62 logger.error(errString,t);
63 errors.add(new LibraryException(errString,t));
64 }
65
66 return standardForward(mapping,request,errors);
67 }
68 }