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