예제 #1
0
  @RequestMapping(
      value = "/form",
      method = RequestMethod.POST,
      consumes = "application/x-www-form-urlencoded")
  @ResponseBody
  public Event addEventForm(
      @RequestParam String keyword,
      @RequestParam String theDay,
      @RequestParam String startDate,
      @RequestParam String duration,
      @RequestParam String initialEvent) {
    if (diaryHelper.md5(keyword).equals(password)) {
      Event event = new Event();
      event.setDescription(initialEvent);
      event.setDuration(diaryHelper.getDuration(duration));
      GregorianCalendar startDateCal = diaryHelper.getStartDateCal(startDate);
      event.setStartTime(startDateCal.getTime());

      event.setId(
          diaryService.addEvent(DateUtil.resetHMS(diaryHelper.getDayCal(theDay).getTime()), event));

      return event;
    }
    return new Event();
  }
예제 #2
0
 @RequestMapping(value = "/{year}/{month}/{day}", method = RequestMethod.GET)
 @ResponseBody
 public List<Event> getEventsForADay(
     @PathVariable int year, @PathVariable int month, @PathVariable int day) {
   Calendar c = GregorianCalendar.getInstance();
   c.set(year, month, day);
   return diaryService.getEventsForADay(DateUtil.resetHMS(c.getTime()));
 }
예제 #3
0
 @RequestMapping(value = "/{year}/{month}/{day}", method = RequestMethod.POST)
 public void addEvent(
     @RequestBody Event event,
     @PathVariable int year,
     @PathVariable int month,
     @PathVariable int day) {
   Calendar c = GregorianCalendar.getInstance();
   c.set(year, month, day);
   diaryService.addEvent(DateUtil.resetHMS(c.getTime()), event);
 }