Package org.richfaces.model

Examples of org.richfaces.model.UploadedFile


     */
    public void listener(FileUploadEvent event) {
        if (user == null) {
            return;
        }
        UploadedFile file = event.getUploadedFile();
        // Construct image from item
        uploadFile(new FileHandler(file), model.getSelectedAlbum());
    }
View Full Code Here


        stream.write(getFiles().get((Integer) object).getData());
        stream.close();
    }

    public void listener(FileUploadEvent event) throws Exception {
        UploadedFile item = event.getUploadedFile();
        UploadedImage file = new UploadedImage();
        file.setLength(item.getData().length);
        file.setName(item.getName());
        file.setData(item.getData());
        files.add(file);
    }
View Full Code Here

     * Convenience method invoked after user add avatar and outject avatar to conversation
     *
     * param event - upload event
     */
    public void uploadAvatar(FileUploadEvent event) {
        UploadedFile file = event.getUploadedFile();
        try {
            File f = new File((file.getName() + "avatar"));

            if (!f.exists()) {
                f.createNewFile();
            }

            FileOutputStream fos = new FileOutputStream(f);
            fos.write(file.getData());
            fos.flush();
            fos.close();

            avatarData = f;
        } catch (Exception e) {
View Full Code Here

    public void clearFile() {
        System.out.println("Files to clear: " + this.clearedFile);
        Iterator<UploadedFile> i = files.iterator();
        while (i.hasNext()) {
            UploadedFile file = i.next();
            if (file.getName().equals(this.clearedFile)) {
                i.remove();
                break;
            }
        }
    }
View Full Code Here

    public List<UploadedFile> getItems() {
        return files;
    }

    public void listener(FileUploadEvent event) {
        UploadedFile file = event.getUploadedFile();

        if (file != null) {
            files.add(file);
        }
    }
View Full Code Here

            files.add(file);
        }
    }

    public void listener2(FileUploadEvent event) {
        UploadedFile file = event.getUploadedFile();

        if (file != null) {
            files.add(file);
        }
    }
View Full Code Here

    stream.write(getFiles().get((Integer) object).getData());
  stream.close();  
  }   
 
  public void listener(FileUploadEvent event) throws Exception {        
    UploadedFile item = event.getUploadedFile();        
    UploadedImage file = new UploadedImage();        
    file.setLength(item.getData().length);        
    file.setName(item.getName());        
    file.setData(item.getData());        
    files.add(file);    
   
    // Afegim al InmobleForm
    FacesContext context = FacesContext.getCurrentInstance();
    InmobleForm inmobleForm = (InmobleForm) context.getApplication().evaluateExpressionGet(context, "#{inmobleForm}", InmobleForm.class);
View Full Code Here

    public void setImportMode(String importMode) {
        this.importMode = importMode;
    }

    public void importSite(FileUploadEvent event) throws Exception {
        UploadedFile item = event.getUploadedFile();

        ManagementController controller = (ManagementController) PortalContainer.getComponent(ManagementController.class);
        Map<String, List<String>> attributes = new HashMap<String, List<String>>(1);
        attributes.put("importMode", Collections.singletonList(importMode));
        ManagedRequest request = ManagedRequest.Factory.create(OperationNames.IMPORT_RESOURCE,
                PathAddress.pathAddress("mop"), attributes, item.getInputStream(), ContentType.ZIP);
        try {
            ManagedResponse response = controller.execute(request);
            if (!response.getOutcome().isSuccess()) {
                addMessage(item.getName());
                log.error(response.getOutcome().getFailureDescription());
            }
        } catch (Exception e) {
            addMessage(item.getName());
            log.error("Error while processing" + item.getName(), e);
        }
    }
View Full Code Here

     * @param event
     *            FileUploadEvent triggered form UI (containing all relevant
     *            data for report adding).
     */
    public void uploadReport(FileUploadEvent event) {
        UploadedFile file = event.getUploadedFile();

        // Put file-data into a digital object
        DigitalObject digitalObject = new DigitalObject();
        digitalObject.setFullname(file.getName());
        digitalObject.getData().setData(file.getData());
        digitalObject.setContentType(file.getContentType());

        try {
            digitalObjectManager.moveDataToStorage(digitalObject);
            plan.getPlanProperties().setReportUpload(digitalObject);
        } catch (StorageException e) {
View Full Code Here

     * @param event
     *            event of the uploaded file
     * @throws Exception
     */
    public void listener(final FileUploadEvent event) throws Exception {
        UploadedFile item = event.getUploadedFile();

        File tmp = File.createTempFile(item.getName(), "xml");
        tmp.deleteOnExit();
        FileUtils.writeToFile(item.getInputStream(), new FileOutputStream(tmp));
        try {
            resetTransformations();
            projectImporter.importPlans(tmp);
            tmp.delete();

            List<String> appliedTransformations = projectImporter.getAppliedTransformations();
            transformations = appliedTransformations;
            if (!appliedTransformations.isEmpty()) {
                facesMessages.addInfo(null,
                    "Your XML file was outdated, therefore it had to be migrated to the current Plato Schema.");
            }

            list = planManager.list(planQuery);
        } catch (PlatoException e) {
            log.error("Failed to upload plan: " + item.getName(), e);

            facesMessages.addError("Failed to upload plan: " + item.getName());
        }
    }
View Full Code Here

TOP

Related Classes of org.richfaces.model.UploadedFile

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.