コード例 #1
0
 @RequestMapping("/saidYes")
 @ResponseBody
 public String saidYes(@RequestParam("codes") String codes) throws Exception {
   StringBuilder log = new StringBuilder();
   for (StringTokenizer st = new StringTokenizer(codes, ", "); st.hasMoreTokens(); ) {
     String groupId = st.nextToken();
     InvitationGroup group = db.get(InvitationGroup.class, groupId);
     for (Invitee inv : group.getInvitees()) {
       if (group.isInvitedTours()) {
         inv.setAttendingWednesday(true);
         inv.setAttendingThursday(true);
         inv.setAttendingFriday(true);
       }
       if (group.isInvitedRehearsal()) inv.setAttendingRehearsal(true);
       inv.setAttendingCeremony(true);
       inv.setAttendingFiesta(true);
     }
     db.update(group);
     log.append("Updated " + group.getGroupName() + " \n<br/>");
   }
   return log.toString();
 }
コード例 #2
0
 @RequestMapping("/fixRehearsal")
 public void fixRehearsal() throws Exception {
   ViewQuery query =
       new ViewQuery().designDocId("_design/groups").viewName("groups").includeDocs(true);
   List<InvitationGroup> groups = db.queryView(query, InvitationGroup.class);
   for (InvitationGroup group : groups) {
     boolean changed = false;
     for (Invitee inv : group.getInvitees()) {
       if (inv.getAttendingFriday() != null && inv.getAttendingFriday()) {
         if (inv.getAttendingRehearsal() == null || !inv.getAttendingRehearsal()) {
           inv.setAttendingRehearsal(true);
           changed = true;
         }
       }
     }
     if (group.isInvitedTours() && !group.isInvitedRehearsal()) {
       group.setInvitedRehearsal(true);
       changed = true;
     } else {
       System.out.println("Not invited to rehearsal: " + group.getGroupName());
     }
     if (changed) db.update(group);
   }
 }