Logger.getLogger(EditNoteAction.class).debug("Populating...");
super.populateObject(request, object, form);
NoteEditorForm noteForm = (NoteEditorForm)form;
Note note = (Note)object;
FormFile formFile = noteForm.getFormFile();
if (formFile != null) {
String filename = formFile.getFileName();
if (StringUtils.isNotEmpty(filename)) {
String contentType = formFile.getContentType();
InputStream input = formFile.getInputStream();
int fileSize = formFile.getFileSize();
int projectId = request.getParameter("projectId") != null ?
Integer.parseInt(request.getParameter("projectId")) : 0;
Directory directory = fileSystem.getDirectory("/attachments/project/"+projectId);
File file = fileSystem.createFile(directory, filename, contentType, fileSize, input);
note.setFile(file);
Logger.getLogger(EditNoteAction.class).debug("Saving note: filename="
+ filename + ", fileSize=" + fileSize + ", contentType=" + contentType);
}