Package com.sun.rave.web.ui.model

Examples of com.sun.rave.web.ui.model.UploadedFile


    public String buttonRefresh_action() {
        return null;
    }
   
    public String buttonUpload_action() {
        UploadedFile uploadedFile = fileUpload.getUploadedFile();
        DocumentFileManager documentFileManager =
                new DocumentFileManager(uploadedFile.getOriginalName(),
                getClientPath());
        String justFileName = documentFileManager.getFileName();
        String uploadedFileType = uploadedFile.getContentType();
       
        //default name of document
        String doc  ;
        if (title.getText() == null ||
                ((String) title.getText()).trim().length() == 0) {
            doc = documentFileManager.getTitle();
        } else {
            doc = ((String) title.getText()).trim();
        }
       
        try {
            File file = new File(documentFileManager
                    .getFilenameOnServer(getServerPath()));
            if (!documentFileManager.isMatchingClientPath()) {
                uploadedFile.write(file);
                info("Uploaded file originally named '" +
                        uploadedFile.getOriginalName() + "' writed to " +
                        documentFileManager.getFilenameOnServer(getServerPath()));
            }
            // Persist the doc ref
            this.document.setContact(getContact());
            this.document.setDocumentLink(justFileName);
            this.document.setTitle(doc);
            this.document.setDocumentType(uploadedFileType);
            this.document = new DocumentController().update(this.document);
            getContact().getDocumentLinks().add(this.document);
            new ContactController().update(
                    getContact());
            title.setText("");
           
        } catch (Exception ex) {
            error("Cannot upload file: " + uploadedFile.getOriginalName() + " to " +
                    documentFileManager.getFilenameOnServer(getServerPath()) +
                    "(" + ex.getClass().getName() + " msg: " + ex.getMessage() + ").");
        }
       
        list.refreshListContact();
View Full Code Here


    public String buttonRefresh_action() {
        return null;
    }
   
    public String buttonUpload_action() {
        UploadedFile uploadedFile = fileUpload.getUploadedFile();
        DocumentFileManager documentFileManager =
                new DocumentFileManager(uploadedFile.getOriginalName(),
                getClientPath());
        String justFileName = documentFileManager.getFileName();
        String uploadedFileType = uploadedFile.getContentType();
       
        //default name of document
        String doc  ;
        if (title.getText() == null ||
                ((String) title.getText()).trim().length() == 0) {
            doc = documentFileManager.getTitle();
        } else {
            doc = ((String) title.getText()).trim();
        }
       
        try {
            File file = new File(documentFileManager
                    .getFilenameOnServer(getServerPath()));
            if (!documentFileManager.isMatchingClientPath()) {
                uploadedFile.write(file);
                info("Uploaded file originally named '" +
                        uploadedFile.getOriginalName() + "' writed to " +
                        documentFileManager.getFilenameOnServer(getServerPath()));
            }
            // Persist the doc ref
            this.document.setContact(getContact());
            this.document.setDocumentLink(justFileName);
            this.document.setTitle(doc);
            this.document.setDocumentType(uploadedFileType);
            this.document = new DocumentController().update(this.document);
            getContact().getDocumentLinks().add(this.document);
            new ContactController().update(
                    getContact());
            title.setText("");
           
        } catch (Exception ex) {
            error("Cannot upload file: " + uploadedFile.getOriginalName() + " to " +
                    documentFileManager.getFilenameOnServer(getServerPath()) +
                    "(" + ex.getClass().getName() + " msg: " + ex.getMessage() + ").");
        }
       
        list.refreshListContact();
View Full Code Here

TOP

Related Classes of com.sun.rave.web.ui.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.