Package org.richfaces.model

Examples of org.richfaces.model.UploadedFile


     *
     * @param event
     *            the file upload event
     */
    public void uploadSample(final FileUploadEvent event) {
        UploadedFile item = event.getUploadedFile();
        String fileName = item.getName();
        log.debug("Sample file {} uploaded", fileName);

        // try {
        try {
            defineSamples.addSample(fileName, item.getContentType(),
                FileUtils.inputStreamToBytes(item.getInputStream()));
        } catch (PlanningException e) {
            log.error("An error occurred while adding the sample to the plan", e);
            facesMessages.addError("An error occurred while adding the file to your plan");
        } catch (IOException e) {
            log.warn("An error occurred while opening the input stream", e);
View Full Code Here


     *
     * @param event
     *            the file upload event
     */
    public void uploadCollectionProfile(final FileUploadEvent event) {
        UploadedFile item = event.getUploadedFile();
        String fileName = item.getName();
        log.debug("Collection Profile file {} uploaded", fileName);

        if (!fileName.endsWith(".xml")) {
            log.warn("The uploaded file {} is not an xml file", fileName);
            facesMessages.addError("The uploaded file is not an xml");
            return;
        }

        try {
            this.defineSamples.readProfile(item.getInputStream(), repositoryUsername, repositoryPassword);
        } catch (ParserException e) {
            log.warn("An error occurred during parsing", e);
            this.facesMessages.addError("An error occurred while reading the uploaded profile: " + e.getMessage());
        } catch (PlanningException e) {
            log.warn("An error occurred during parsing", e);
View Full Code Here

     *
     * @param event
     *            the event containing the upload data
     */
    public void uploadT2flowExecutablePlan(final FileUploadEvent event) {
        UploadedFile item = event.getUploadedFile();
        String fileName = item.getName();
        log.debug("Executable plan file [{}] uploaded", fileName);

        if (!fileName.endsWith(".t2flow")) {
            log.warn("The uploaded file {} is not an t2flow file", fileName);
            facesMessages.addError("The uploaded file is not an t2flow. Please upload a valid Taverna t2flow file.");
            return;
        }

        try {
            createExecutablePlan.readT2flowExecutablePlan(item.getInputStream());
        } catch (TavernaParserException e) {
            log.warn("An error occurred during parsing: {}", e.getMessage());
            facesMessages.addError("There was a problem reading the plan: " + e.getMessage()
                + ". Please make sure you have selected a valid executable plan.");
        } catch (PlanningException e) {
View Full Code Here

     * @param event
     *            Richfaces FileUploadEvent class.
     * @see #updateDataForNextUpload(Object, Object)
     */
    public void uploadResultFile(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 {
            runExperiments.uploadResultFile(digitalObject, alternativeForNextUpload, sampleObjectForNextUpload);
        } catch (StorageException e) {
            log.error("Exception at trying to upload result file.", e);
View Full Code Here

     *
     * @param event
     *            Richfaces FileUploadEvent data.
     */
    public void uploadFile(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 {
            identifyRequirements.attachFile(digitalObject);
        } catch (StorageException e) {
            log.error("Exception at trying to attach file.", e);
View Full Code Here

     *
     * @param event
     *            Richfaces FileUploadEvent data.
     */
    public void selectImportFile(FileUploadEvent event) {
        UploadedFile file = event.getUploadedFile();

        // Do some input checks
        if (!file.getName().endsWith("mm")) {
            facesMessages.addError("importPanel", "Please select a FreeMind file.");
            importFile = null;
            return;
        }

        // Put file-data into a digital object
        importFile = new DigitalObject();
        importFile.setFullname(file.getName());
        importFile.getData().setData(file.getData());
        importFile.setContentType(file.getContentType());
    }
View Full Code Here

     *
     * @param event
     *            the file upload event
     */
    public void uploadCriteriaHierarchy(FileUploadEvent event) {
        UploadedFile file = event.getUploadedFile();
        String filename = file.getName();

        // Do some input checks
        if (!filename.endsWith("mm")) {
            log.warn("The uploaded file [{}] is not a Freemind file.", filename);
            facesMessages.addError("The uploaded file is not a Freemind file.");
            return;
        }

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

        boolean importSuccessful = manageCriteriaSets.importCriteriaHierarchyFromFreemind(importFile);

        if (importSuccessful) {
            facesMessages.addInfo("Criteria set imported successfully");
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.