1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.itracker.web.actions.admin.configuration;
20
21 import org.apache.log4j.Logger;
22 import org.apache.struts.action.*;
23 import org.itracker.model.util.UserUtilities;
24 import org.itracker.web.actions.base.ItrackerBaseAction;
25 import org.itracker.web.forms.ImportForm;
26
27 import javax.servlet.ServletException;
28 import javax.servlet.http.HttpServletRequest;
29 import javax.servlet.http.HttpServletResponse;
30 import java.io.IOException;
31
32
33 public class ImportDataFormAction extends ItrackerBaseAction {
34 private static final Logger log = Logger.getLogger(ImportDataFormAction.class);
35
36 public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
37 ActionMessages errors = new ActionMessages();
38
39 try {
40 ImportForm/../../../org/itracker/web/forms/ImportForm.html#ImportForm">ImportForm importForm = (ImportForm) form;
41 if (importForm == null) {
42 importForm = new ImportForm();
43 }
44 importForm.setOptionreuseusers(Boolean.TRUE);
45 importForm.setOptionreuseprojects(Boolean.TRUE);
46 importForm.setOptionreuseconfig(Boolean.TRUE);
47 importForm.setOptionreusefields(Boolean.TRUE);
48 importForm.setOptioncreatepasswords(Boolean.TRUE);
49
50 request.setAttribute("importForm", importForm);
51 saveToken(request);
52 return mapping.getInputForward();
53 } catch (Exception e) {
54 log.error("Exception while creating import data form.", e);
55 errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.system"));
56 }
57
58 if (!errors.isEmpty()) {
59 saveErrors(request, errors);
60 }
61
62 return mapping.findForward("error");
63 }
64
65 }
66