for(Booking booking : bookings)
{
if (booking.getMyvillageAuthKey().equals(userKey))
{
// We have a match
Village village = CannedQueries.villageByKey(booking.getVillageKey());
if (village == null)
return new MyVillageResponse("Booking for user located, but no village mapping found. A booking must be assigned to a village before you can use My Village.");
booking.setMyVillageUsername(externalUsername);
CannedQueries.save(booking);
return new MyVillageResponse(booking.getName(), village.getName(),
KeyFactory.keyToString(village.getKeyCheckNotNull()));
}
}
return new MyVillageResponse("No matching bookings found. Please check email and key and try again");
}