* @throws IOException
* @throws NoSuchAlgorithmException
*/
public static Result updateOrganizationInfo(String organizationName) throws IOException, NoSuchAlgorithmException {
Form<Organization> organizationForm = form(Organization.class).bindFromRequest();
Organization modifiedOrganization = organizationForm.get();
Result result = validateForUpdate(organizationForm, modifiedOrganization);
if (result != null) {
return result;
}
Http.MultipartFormData.FilePart filePart = request().body().asMultipartFormData()
.getFile("logoPath");
if (!isEmptyFilePart(filePart)) {
Attachment.deleteAll(modifiedOrganization.asResource());
new Attachment().store(filePart.getFile(), filePart.getFilename(), modifiedOrganization.asResource());
}
modifiedOrganization.update();
return redirect(routes.OrganizationApp.settingForm(modifiedOrganization.name));
}