@Override // @ApiMethod(name = "share.request.send", httpMethod = "post") public BookingInfo sendShareRequest(BookingInfo bookingInfo) { ObjectifyService.begin(); Profil profil = bookingServiceManager.getProfil(); BookingInfo parentBooking = bookingServiceManager.getBookingAsInfo(bookingInfo.getParentId()); Mailer.sendShareRequest(parentBooking, bookingInfo, profil); return bookingInfo; }
@Override @ApiMethod(name = "bookings.share.accepted", httpMethod = "post") public List<BookingInfo> handleShareAccepted(@Named("id") Long sharerId) throws IllegalArgumentException { ObjectifyService.begin(); BookingInfo sharer = bookingServiceManager.getBookingAsInfo(sharerId); BookingInfo parentBookingInfo = bookingServiceManager.getBookingAsInfo(sharer.getParentId()); BookingInfo sharerBookingInfo = bookingServiceManager.setShareAccepted(sharer); List<BookingInfo> list = null; if (sharerBookingInfo.getStatus() == SHARE_ACCEPTED) { list = Lists.newArrayList(parentBookingInfo, sharerBookingInfo); Mailer.sendShareAccepted( sharerBookingInfo.getEmail(), parentBookingInfo, sharer, bookingServiceManager.getProfil()); } else { logger.severe("share failed " + sharerId); } return list; }