OLD | NEW |
(Empty) | |
| 1 package mydemo; |
| 2 |
| 3 import java.io.IOException; |
| 4 import java.util.Date; |
| 5 import java.util.List; |
| 6 import java.util.logging.Logger; |
| 7 import javax.jdo.PersistenceManager; |
| 8 import javax.servlet.http.*; |
| 9 import com.google.appengine.api.users.User; |
| 10 import com.google.appengine.api.users.UserService; |
| 11 import com.google.appengine.api.users.UserServiceFactory; |
| 12 |
| 13 import mydemo.TestStatus; |
| 14 import mydemo.RegisterFeature; |
| 15 import mydemo.PMF; |
| 16 |
| 17 public class UpdateStatusServlet extends HttpServlet { |
| 18 private static final Logger log = Logger.getLogger(UpdateStatusServlet.class
.getName()); |
| 19 |
| 20 public void doPost(HttpServletRequest req, HttpServletResponse resp) |
| 21 throws IOException { |
| 22 UserService userService = UserServiceFactory.getUserService(); |
| 23 User user = userService.getCurrentUser(); |
| 24 Date date = new Date(); |
| 25 |
| 26 String[] feature_name = req.getParameterValues("feature_name"); |
| 27 String build_number = req.getParameter("buildn"); |
| 28 String[] test_status_xp = req.getParameterValues("test_status_xp"); |
| 29 String[] test_status_vista = req.getParameterValues("test_status
_vista"); |
| 30 String[] test_status_win7 = req.getParameterValues("test_status_win7
"); |
| 31 String user_name = req.getParameter("user_name"); |
| 32 String[] notes = req.getParameterValues("notes"); |
| 33 |
| 34 if (build_number!=null) { |
| 35 for (int j=0; j<feature_name.length; j++) { |
| 36 PersistenceManager pm = PMF.get().getPersistenceManager(); |
| 37 String query = "select from " + TestStatus.class.getName()
+ " where build_number=='" + build_number +"' && feature_name=='" + feature_name
[j]+ "'" ; |
| 38 List<TestStatus> windows = (List<TestStatus>) pm.newQuery(q
uery).execute(); |
| 39 for (TestStatus win_status : windows) { |
| 40 |
| 41 if ((!win_status.getStatusXP().equals(test_status_xp[j]
)) && (!test_status_xp[j].equals("Not Started"))) { |
| 42 win_status.setStatusXP(test_status_xp[j]); |
| 43 if (win_status.getXpTester().equals("")) |
| 44 win_status.setXpTester(user_name); |
| 45 } |
| 46 |
| 47 if ((!win_status.getStatusVista().equals(test_status_vi
sta[j])) && (!test_status_vista[j].equals("Not Started"))) { |
| 48 win_status.setStatusVista(test_status_vista[j]); |
| 49 if (win_status.getVistaTester().equals("")) |
| 50 win_status.setVistaTester(user_name); |
| 51 } |
| 52 |
| 53 if ((!win_status.getStatusWin7().equals(test_status_win
7[j])) && (!test_status_win7[j].equals("Not Started"))) { |
| 54 win_status.setStatusWin7(test_status_win7[j]); |
| 55 if (win_status.getWin7Tester().equals("")) |
| 56 win_status.setWin7Tester(user_name); |
| 57 } |
| 58 |
| 59 String current_notes = win_status.getNotes(); |
| 60 String new_notes = notes[j]; |
| 61 boolean i = new_notes.contains(current_notes); |
| 62 if (i) { |
| 63 win_status.setNotes(new_notes); |
| 64 } else{ |
| 65 current_notes = current_notes.concat(","); |
| 66 current_notes = current_notes.concat(notes[j]); |
| 67 win_status.setNotes(current_notes); |
| 68 } |
| 69 try { |
| 70 pm.makePersistent(win_status); |
| 71 } finally { |
| 72 pm.close(); |
| 73 } |
| 74 } |
| 75 } |
| 76 } |
| 77 resp.sendRedirect("/SubmitStatus-Windows.jsp"); |
| 78 } |
| 79 |
| 80 } |
OLD | NEW |