| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 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 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
0 |
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 |
0 |
populateUsers(); |
| 33 |
|
|
| 34 |
0 |
populateIterations(); |
| 35 |
|
|
| 36 |
0 |
return mapping.findForward("success"); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
private void populateIterations() throws CreateIterationException { |
| 41 |
0 |
final IterationService iterationService = |
| 42 |
|
ServiceLocator.getServiceLocator().getIterationService(); |
| 43 |
0 |
iterationService.newIteration(new IterationView("iteration1")); |
| 44 |
0 |
iterationService.newIteration(new IterationView("iteration2")); |
| 45 |
0 |
iterationService.newIteration(new IterationView("iteration3")); |
| 46 |
0 |
} |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
private void populateUsers() throws InvalidUserException, DuplicateUserException { |
| 50 |
0 |
final UserService userService = |
| 51 |
|
ServiceLocator.getServiceLocator().getUserService(); |
| 52 |
0 |
userService.newUser(new UserView("gonnot", "Boris Gonnot")); |
| 53 |
0 |
userService.newUser(new UserView("spinae", "Eugenio Spina")); |
| 54 |
0 |
userService.newUser(new UserView("jcouvreur", "Jacques Couvreur")); |
| 55 |
0 |
userService.newUser(new UserView("duboisd", "David Dubois")); |
| 56 |
0 |
userService.newUser(new UserView("ztaili", "Mehdi Abouelfath")); |
| 57 |
0 |
userService.newUser(new UserView("thierrou", "Thierry Leveque")); |
| 58 |
0 |
} |
| 59 |
|
} |