Package org.nxplanner.file

Examples of org.nxplanner.file.Directory


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


                fileSystem.deleteFile(hibernateSession, Integer.parseInt(fform.getFileId()));
            } else if (fform.getAction().equals("mkdir")) {
                int parentDirectoryId = Integer.parseInt(fform.getDirectoryId());
                fileSystem.createDirectory(hibernateSession, parentDirectoryId, fform.getName());
            } else if (fform.getAction().equals("rmdir")) {
                Directory directory = fileSystem.getDirectory(hibernateSession, Integer.parseInt(fform.getDirectoryId()));
                Directory parent = directory.getParent();
                if (parent == null) {
                    parent = fileSystem.getRootDirectory();
                }
                fform.setDirectoryId(Integer.toString(parent.getId()));
                fileSystem.deleteDirectory(hibernateSession, directory.getId());
            }
            hibernateSession.flush();
            hibernateSession.connection().commit();
            if (fform.getDirectoryId() != null) {
                Directory directory = fileSystem.getDirectory(hibernateSession, Integer.parseInt(fform.getDirectoryId()));
                request.setAttribute("directory", directory);
            }
            request.setAttribute("root", fileSystem.getRootDirectory());
            return mapping.findForward("display");
        } catch (ObjectNotFoundException ex) {
View Full Code Here

    public void testPopulate() throws Exception {
        Note actualNote = new Note();
        actualNote.setSubmissionTime(testNote.getSubmissionTime());
        noteForm.setFormFile(testFormFile);
        MockControl mockDirectoryControl = createLocalClassControl(Directory.class);
        Directory mockDirectory = (Directory)mockDirectoryControl.getMock();
        mockFileSystemControl.expectAndReturn(mockFileSystem.getDirectory("/attachments/project/0"),
                mockDirectory);
        mockFileSystem.createFile(mockDirectory, "testFile.txt", "text/plain",
                6, new ByteArrayInputStream(new byte[1]));
        mockFileSystemControl.setMatcher(new ArgumentsMatcher() {
View Full Code Here

                if (projectId == null) {
                    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();
View Full Code Here

TOP

Related Classes of org.nxplanner.file.Directory

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.