예제 #1
0
 @GET
 @Path("{userId}/reminders")
 public Response getAllReminders(@PathParam("userId") final String userId) {
   final List<Reminder> reminders = reminderDao.getAllReminders(userId);
   ReminderPage reminderPage = new ReminderPage(0, reminders.size(), reminders);
   return Response.ok().entity(reminderPage).build();
 }
예제 #2
0
 @GET
 @Path("{userId}/reminders/{reminderId}")
 public Response getReminder(
     @PathParam("userId") final String userId, @PathParam("reminderId") final String reminderId) {
   Reminder reminder = reminderDao.getReminder(reminderId);
   return Response.ok().entity(reminder).build();
 }
예제 #3
0
 @DELETE
 @Path("{userId}/reminders/{reminderId}")
 public Response deleteReminder(
     @PathParam("userId") final String userId, @PathParam("reminderId") final String reminderId) {
   reminderDao.deleteReminder(reminderId);
   return Response.ok().build();
 }
예제 #4
0
 @PUT
 @Path("{userId}/reminders/{reminderId}")
 public Response updateReminder(
     Reminder reminder,
     @PathParam("userId") final String userId,
     @PathParam("reminderId") final String reminderId) {
   Reminder updatedReminder = reminderDao.updateReminder(reminderId, reminder);
   return Response.ok().entity(updatedReminder).build();
 }
예제 #5
0
 @POST
 @Path("{userId}/reminders")
 public Response createReminder(
     Reminder reminder,
     @PathParam("userId") final String userId,
     @QueryParam(REMINDER_ABOUT_QPARM) final String reminderAbout,
     @QueryParam(CREATED_BY_QPARAM) final String createdBy) {
   setReminderCreateProperties(reminder);
   Reminder createdReminder = reminderDao.createReminder(reminder);
   User reminderForUser = userDao.getUser(userId);
   Long currentTime = System.currentTimeMillis();
   ReminderRelationShip reminderRelationShip =
       new ReminderRelationShip(
           createdBy, currentTime, reminderForUser, currentTime, reminderAbout, reminder);
   userDao.setReminder(reminderRelationShip);
   return Response.created(null).entity(createdReminder).build();
 }