use of com.google.appengine.api.blobstore.BlobstoreFailureException in project teammates by TEAMMATES.
the class AdminEmailTrashDeleteAction method execute.
@Override
protected ActionResult execute() {
gateKeeper.verifyAdminPrivileges(account);
boolean shouldEmptyTrashBin = getRequestParamAsBoolean(Const.ParamsNames.ADMIN_EMAIL_EMPTY_TRASH_BIN);
if (shouldEmptyTrashBin) {
try {
logic.deleteAllEmailsInTrashBin();
statusToAdmin = "All emails in trash bin has been deleted";
statusToUser.add(new StatusMessage("All emails in trash bin has been deleted", StatusMessageColor.SUCCESS));
} catch (BlobstoreFailureException e) {
statusToAdmin = "Blobstore connection failure";
statusToUser.add(new StatusMessage("Blobstore connection failure", StatusMessageColor.DANGER));
}
}
return createRedirectResult(Const.ActionURIs.ADMIN_EMAIL_TRASH_PAGE);
}
use of com.google.appengine.api.blobstore.BlobstoreFailureException in project teammates by TEAMMATES.
the class StudentProfilePictureUploadAction method execute.
/*
* This class is not tested in ActionTests as it is difficult to
* reproduce the upload action done by Google Blobstore API
* without the server running.
* This class is covered in UiTests.
*/
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
gateKeeper.verifyLoggedInUserPrivileges();
String pictureKey = "";
BlobKey blobKey = new BlobKey("");
RedirectResult r = createRedirectResult(Const.ActionURIs.STUDENT_PROFILE_PAGE);
try {
BlobInfo blobInfo = extractProfilePictureKey();
if (!isError) {
blobKey = blobInfo.getBlobKey();
pictureKey = renameFileToGoogleId(blobInfo);
logic.updateStudentProfilePicture(account.googleId, pictureKey);
statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_PROFILE_PICTURE_SAVED, StatusMessageColor.SUCCESS));
r.addResponseParam(Const.ParamsNames.STUDENT_PROFILE_PHOTOEDIT, "true");
}
} catch (BlobstoreFailureException | IOException bfe) {
deletePicture(blobKey);
updateStatusesForBlobstoreFailure();
isError = true;
} catch (Exception e) {
/*
* This is for other exceptions like EntityNotFound, IllegalState, etc
* that occur rarely and are handled higher up.
*/
deletePicture(new BlobKey(pictureKey));
statusToUser.clear();
throw e;
}
return r;
}
use of com.google.appengine.api.blobstore.BlobstoreFailureException in project teammates by TEAMMATES.
the class AdminEmailCreateGroupReceiverListUploadUrlAction method execute.
@Override
protected ActionResult execute() {
gateKeeper.verifyAdminPrivileges(account);
AdminEmailCreateGroupReceiverListUploadUrlAjaxPageData data = new AdminEmailCreateGroupReceiverListUploadUrlAjaxPageData(account, sessionToken);
try {
String callbackUrl = Url.addParamToUrl(Const.ActionURIs.ADMIN_EMAIL_GROUP_RECEIVER_LIST_UPLOAD, Const.ParamsNames.SESSION_TOKEN, sessionToken);
data.nextUploadUrl = GoogleCloudStorageHelper.getNewUploadUrl(callbackUrl);
data.ajaxStatus = "Group receiver list upload url created, proceed to uploading";
} catch (BlobstoreFailureException | IllegalArgumentException e) {
data.nextUploadUrl = null;
isError = true;
data.ajaxStatus = "An error occurred when creating upload URL, please try again";
}
return createAjaxResult(data);
}
use of com.google.appengine.api.blobstore.BlobstoreFailureException in project teammates by TEAMMATES.
the class CreateImageUploadUrlAction method getCreateImageUploadUrlPageData.
protected final CreateImageUploadUrlAjaxPageData getCreateImageUploadUrlPageData() {
CreateImageUploadUrlAjaxPageData data = new CreateImageUploadUrlAjaxPageData(account, sessionToken);
try {
data.nextUploadUrl = getUploadUrl();
data.ajaxStatus = "Image upload url created, proceed to uploading";
} catch (BlobstoreFailureException | IllegalArgumentException e) {
data.nextUploadUrl = null;
isError = true;
data.ajaxStatus = "An error occurred when creating upload URL, please try again";
}
return data;
}
Aggregations