throw new IllegalArgumentException("Required parameter 'id' is null or empty.");
}
LOG.info(String.format("Moving photos in submission '%s' to Picasa.", photoSubmissionId));
PhotoSubmission photoSubmission = photoSubmissionDao.getSubmissionById(photoSubmissionId);
if (photoSubmission == null) {
throw new IllegalArgumentException(String.format(
"Unable to find PhotoSubmission with id '%s'.", photoSubmissionId));
}
String assignmentId = photoSubmission.getAssignmentId().toString();
Assignment assignment = assignmentDao.getAssignmentById(assignmentId);
if (assignment == null) {
throw new IllegalArgumentException(String.format("Unable to find Assignment with id '%s'.",
assignmentId));
}
String title = photoSubmission.getTitle();
String description = String.format("%s\n\nSubmitted by %s",
photoSubmission.getDescription(), photoSubmission.getAuthor());
if (!util.isNullOrEmpty(photoSubmission.getArticleUrl())) {
description += " in response to " + photoSubmission.getArticleUrl();
}
// It would be arguably more useful to store the album id separately, but we can parse it from
// the album URL value.
String albumUrl = assignment.getUnreviewedAlbumUrl();
String albumId = albumUrl.substring(albumUrl.lastIndexOf("/") + 1);
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
Double latitude = photoSubmission.getLatitude();
Double longitude = photoSubmission.getLongitude();
for (PhotoEntry photoEntry : photoSubmissionDao.getAllPhotos(photoSubmissionId)) {
String uploadUrl = picasaApi.getResumableUploadUrl(photoEntry, title, description, albumId,
latitude, longitude);