1 /*
2 * Demosys.
3 *
4 * Terms of license - http://opensource.org/licenses/apachepl.php
5 */
6 package org.demosys.web.populate;
7 import javax.servlet.http.HttpServletRequest;
8 import javax.servlet.http.HttpServletResponse;
9 import org.apache.struts.action.Action;
10 import org.apache.struts.action.ActionForm;
11 import org.apache.struts.action.ActionForward;
12 import org.apache.struts.action.ActionMapping;
13 import org.demosys.web.ServiceLocator;
14 import org.demosys.web.iteration.CreateIterationException;
15 import org.demosys.web.iteration.IterationService;
16 import org.demosys.web.iteration.IterationView;
17 import org.demosys.web.user.DuplicateUserException;
18 import org.demosys.web.user.InvalidUserException;
19 import org.demosys.web.user.UserService;
20 import org.demosys.web.user.UserView;
21 /***
22 * Classe responsable de .
23 *
24 * date: May 18, 2003- 11:31:19 PM (Boris)
25 */
26 public class PopulateAction extends Action {
27 public static final String USERS = "USERS";
28
29 public ActionForward execute(ActionMapping mapping, ActionForm objForm,
30 HttpServletRequest request, HttpServletResponse res)
31 throws Exception {
32 populateUsers();
33
34 populateIterations();
35
36 return mapping.findForward("success");
37 }
38
39
40 private void populateIterations() throws CreateIterationException {
41 final IterationService iterationService =
42 ServiceLocator.getServiceLocator().getIterationService();
43 iterationService.newIteration(new IterationView("iteration1"));
44 iterationService.newIteration(new IterationView("iteration2"));
45 iterationService.newIteration(new IterationView("iteration3"));
46 }
47
48
49 private void populateUsers() throws InvalidUserException, DuplicateUserException {
50 final UserService userService =
51 ServiceLocator.getServiceLocator().getUserService();
52 userService.newUser(new UserView("gonnot", "Boris Gonnot"));
53 userService.newUser(new UserView("spinae", "Eugenio Spina"));
54 userService.newUser(new UserView("jcouvreur", "Jacques Couvreur"));
55 userService.newUser(new UserView("duboisd", "David Dubois"));
56 userService.newUser(new UserView("ztaili", "Mehdi Abouelfath"));
57 userService.newUser(new UserView("thierrou", "Thierry Leveque"));
58 }
59 }
This page was automatically generated by Maven