Examples of StoredFile


Examples of net.sf.archimede.model.storedFile.StoredFile

                throw new IllegalStateException("The object cannot request cut and copy operations all at once.");
            }
            if (this.cutRequested) {
                for (Iterator it = this.selectedStoredFiles.iterator(); it.hasNext(); ){
                    ViewStoredFile viewStoredFile = (ViewStoredFile) it.next();
                    StoredFile cutStoredFile = viewStoredFile.getStoredFile();
                    storedFileDao.cutTo(cutStoredFile, destinationFolder);
                    this.cutRequested = false;
                }               
            } else if (this.copyRequested) {
                for (Iterator it = this.selectedStoredFiles.iterator(); it.hasNext(); ){
                    ViewStoredFile viewStoredFile = (ViewStoredFile) it.next();
                    StoredFile cutStoredFile = viewStoredFile.getStoredFile();
                    storedFileDao.copyTo(cutStoredFile, destinationFolder);
                    this.copyRequested = false;
               
            } else {
                //All false: nothing to do
View Full Code Here

Examples of net.sf.archimede.model.storedFile.StoredFile

            this.setLeaf(true);
          }

          Iterator filesIt = files.iterator();
          while (filesIt.hasNext()) {
            StoredFile currentFile = (StoredFile) filesIt.next();
            CustomTreeNode tnbFile = new CustomTreeNode("file",
                currentFile.getName(), true);
            tnbFile.setIdentifier(currentFile.getId());
            tnbFile.setParent(this);
            tnbFile.setContent(new ViewStoredFile(currentFile));
            this.children.add(tnbFile);
          }
View Full Code Here

Examples of net.sf.archimede.model.storedFile.StoredFile

    TreeNode treeNode = this.treeModel.getNode();
    String identifier = treeNode.getIdentifier();

    StoredFileDao fileDao = StoredFileDao.createInstance();
    StoredFile file = fileDao.retrieve(identifier);

    FacesContext facesContext = FacesContext.getCurrentInstance();
    HttpServletResponse response = (HttpServletResponse) facesContext
        .getExternalContext().getResponse();

    response.setContentType(file.getMimeType());
    response.setHeader("Content-disposition", "attachment; filename=\""
        + file.getName() + "\"");

    ServletOutputStream out = response.getOutputStream();
    InputStream stream = file.getData();

    int bytesRead = 0;
    byte[] buffer = new byte[8192];
    // Write to servlet output stream
    while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
View Full Code Here

Examples of net.sf.archimede.model.storedFile.StoredFile

        this.file = file;
    }

    public String submitUpload() {
        if (this.file != null) {
            StoredFile newFile = new StoredFileImpl();
            //FIXME Mieux tester...
            String filename = new File(this.file.getName()).getName();
            newFile.setName(filename);
            newFile.setParent(this.selectedFolder.getFolder());
            try {
                newFile.setData(this.file.getInputStream());
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            String contentType = this.file.getContentType();
            newFile.setMimeType(contentType);
            newFile.setLastModified(new GregorianCalendar());
            StoredFileDao.createInstance().save(newFile);
            this.selectedFolder.getFolder().getStoredFiles().add(newFile);

            this.file = null;
            return "upload_done";
View Full Code Here

Examples of net.sf.archimede.model.storedFile.StoredFile

    }
   
    public void downloadFileAction(ActionEvent event) throws IOException {
       
        StoredFileDao fileDao = StoredFileDao.createInstance();
        StoredFile storedFile = (StoredFile) this.selectedFolder.getStoredFilesModel().getRowData();
        StoredFile file2download = fileDao.retrieve(storedFile.getId());
       
        FacesContext facesContext = FacesContext.getCurrentInstance();
        HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();     
        
        //text/plain, vnd.ms-excel, application/x-download, ...
        response.setContentType(file2download.getMimeType());
        response.setHeader("Content-disposition","attachment; filename=\"" + file2download.getName() + "\"");     
       
        ServletOutputStream out = response.getOutputStream()
        InputStream stream = file2download.getData();
       
        int bytesRead = 0;
        byte[] buffer = new byte[8192];
        //Write to servlet output stream
        while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
View Full Code Here

Examples of net.sf.archimede.model.storedFile.StoredFile

      String folderId = urlsPaths[urlsPaths.length - 2];
      String fileName = urlsPaths[urlsPaths.length - 1];
     
      Folder folder = FolderDao.createInstance().retrieve(folderId);
      List files = folder.getStoredFiles();
      StoredFile fileTodownload = null;
      for (Iterator it = files.iterator(); it.hasNext(); ) {
        StoredFile currentFile = (StoredFile) it.next();
        if (currentFile.getName().equals(fileName)) {
          fileTodownload = currentFile;
          break;
        }
      }
View Full Code Here

Examples of net.sf.archimede.model.storedFile.StoredFile

                              };
                              st.execute();
                          }
                           
                          //TODO Plus direct. Faire une m�thode publique, retrieve by node ?
                          StoredFile file = StoredFileDao.createInstance().retrieve(currentNode.getUUID());
                          files.add(file);
                          //System.out.println("File ADDDED !!!!");
                        }
                    }
                    Collections.sort(files, new Comparator() {
View Full Code Here

Examples of org.apache.openmeetings.util.StoredFile

      @Override
      protected void onSubmit(AjaxRequestTarget target) {
        FileUpload fu = fileUploadField.getFileUpload();
        if (fu != null) {
          StoredFile sf = new StoredFile(fu.getClientFileName());
          if (sf.isImage()) {
            boolean asIs = sf.isAsIs();
            try {
              //FIXME need to work with InputStream !!!
              getBean(GenerateImage.class)
                .convertImageUserProfile(fu.writeToTempFile(), userId, asIs);
            } catch (Exception e) {
View Full Code Here

Examples of org.apache.openmeetings.util.StoredFile

        String newFileSystemName = MD5.do_checksum("FILE_" + d.getTime());

        String newFileExtDot = fileSystemName.substring(dotidx, fileSystemName.length()).toLowerCase();
        String newFileExt = newFileExtDot.substring(1);
        log.debug("newFileExt: " + newFileExt);
        StoredFile storedFile = new StoredFile(newFileSystemName, newFileExt);

        // Check variable to see if this file is a presentation
        // check if this is a a file that can be converted by
        // openoffice-service
        boolean canBeConverted = storedFile.isConvertable();
        boolean isPdf = storedFile.isPdf();
        boolean isImage = storedFile.isImage();
        boolean isChart = storedFile.isChart();
        boolean isAsIs = storedFile.isAsIs();
        boolean isVideo = storedFile.isVideo();

        log.debug("isAsIs: " + isAsIs);

        // add outputfolders for profiles
        // if it is a presenation it will be copied to another place
View Full Code Here

Examples of org.apache.openmeetings.util.StoredFile

    // trim long names cause cannot output that
    final int MAX_FILE_NAME_LENGTH = 30;
    if (newFileName.length() >= MAX_FILE_NAME_LENGTH) {
      newFileName = newFileName.substring(0, MAX_FILE_NAME_LENGTH);
    }
    StoredFile storedFile = new StoredFile(newFileName, newFileExt);

    // check if this is a a file that can be converted by
    // openoffice-service
    boolean canBeConverted = storedFile.isConvertable();
    boolean isPdf = storedFile.isPdf();
    boolean isImage = storedFile.isImage();
    boolean isAsIs = storedFile.isAsIs();

    File workingDir = null;
    // add outputfolders for profiles
    if (userProfile) {
      // User Profile Update
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.