Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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();
 }