if (accessToken == null) {
return redirectToFailureHandler(NO_OAUTH_ACCESS_TOKEN);
}
Calendar c = null;
try {
String authHeader = manager.createAuthorizationHeader(accessToken);
socialService.replaceHeader("Authorization", authHeader);
c = socialService.get(Calendar.class);
} catch (RuntimeException ex) {
return redirectToFailureHandler(CALENDAR_ACCESS_PROBLEM);
}
CalendarEntry entry = c.getEntry(request.getHour());
if (entry.getEventDescription() == null || entry.getEventDescription().trim().isEmpty()) {
String address = restaurantService.post(new Form().set("name", request.getReserveName())
.set("phone", request.getContactPhone())
.set("hour", request.getHour()),
String.class);