Package org.nxplanner.file

Examples of org.nxplanner.file.File


                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);
View Full Code Here


            if (fform.getAction().equals("upload")) {
                FormFile formFile = fform.getFormFile();
                fileSystem.createFile(hibernateSession, Integer.parseInt(fform.getDirectoryId()), formFile.getFileName(),
                        formFile.getContentType(), formFile.getFileSize(), formFile.getInputStream());
            } else if (fform.getAction().equals("download")) {
                File file = fileSystem.getFile(hibernateSession, Integer.parseInt(fform.getFileId()));
                writeFileToResponse(response, file);
            } else if (fform.getAction().equals("delete")) {
                fileSystem.deleteFile(hibernateSession, Integer.parseInt(fform.getFileId()));
            } else if (fform.getAction().equals("mkdir")) {
                int parentDirectoryId = Integer.parseInt(fform.getDirectoryId());
View Full Code Here

            public String toString(Object[] arguments) {
                return StringUtils.join(arguments, ",");
            }
        });
        File mockFile = new File();
        mockFile.setName("FOO");
        testNote.setFile(mockFile);
        mockFileSystemControl.setReturnValue(mockFile);
        replay();

        action.populateObject(support.request, actualNote, noteForm);
View Full Code Here

                    projectId = new Integer(0);
                }
                int filesize = rs.getInt("file_size");
                final FileSystem fileSystem = new FileSystemImpl();
                Directory directory = fileSystem.getDirectory("/attachments/project/"+projectId);
                File file = fileSystem.createFile(directory, rs.getString("filename"), rs.getString("content_type"),
                        filesize, rs.getBlob("file").getBinaryStream());
                note.setFile(file);
            }
            session.flush();
            session.connection().commit();
View Full Code Here

            logger.error("Exception: " + e.getMessage(), e);
        }

        Note currentNote = locateNote(getSession(request), noteId);
        if (currentNote != null) {
            final File file = currentNote.getFile();
            logger.debug("Note : " + file.getName());
            logger.debug("Note attachment size : " + file.getFileSize());
            logger.debug("Note contentType : " + file.getContentType());

            response.setContentType(file.getContentType());
            response.setHeader("Content-disposition", "note;filename=\"" + file.getName() + "\"");
            response.addHeader("Content-description",  file.getName());

            ServletOutputStream stream = response.getOutputStream();
            writeAttachment(currentNote, stream);
            stream.close();
        }
View Full Code Here

TOP

Related Classes of org.nxplanner.file.File

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.