Package eu.scape_project.planning.model

Examples of eu.scape_project.planning.model.SampleObject


    /**
     * Adds a new sample to the list of sample samples in the project. This is a
     * sample sample without data.
     */
    public String newSample() {
        SampleObject newSample = new SampleObject("<add name>");

        plan.getSampleRecordsDefinition().addRecord(newSample);
        // this SampleRecordsDefinition has been changed
        plan.getSampleRecordsDefinition().touch();

View Full Code Here


                    // evaluator with the highest priority
                    measurementsToEval.clear();
                    measurementsToEval.addAll(allMeasurementsToEval);

                    // prepare sample object with data
                    SampleObject sample = samples.get(i);
                    String samplePid = sample.getPid();
                    if (samplePid != null) {
                        sample.getData().setData(bytestreamManager.load(samplePid));
                    }

                    DigitalObject r = alternative.getExperiment().getResults().get(sample);
                    if ((r != null) && (r.getPid() != null)) {
                        r = digitalObjectManager.getCopyOfDataFilledDigitalObject(r);
                    }

                    try {
                        for (IObjectEvaluator evaluator : objEvaluators) {
                            // DigitalObject r2 = (r == null ? null :
                            // em.merge(r));
                            try {
                                Map<String, Value> results = evaluator.evaluate(alternative, sample, r,
                                    measurementsToEval, statusListener);
                                // apply all results
                                for (String m : results.keySet()) {
                                    Value value = results.get(m);
                                    if (value != null) {
                                        Leaf l = measurementOfLeaf.get(m);
                                        value.setScale(l.getScale());
                                        // add evaluation result for the current
                                        // result-object!
                                        l.getValues(alternative.getName()).setValue(i, value);
                                    }
                                }
                                // exclude evaluated leaves from further
                                // evaluation
                                measurementsToEval.removeAll(results.keySet());
                            } catch (Exception e) {
                                log.error("evaluator failed: " + e.getMessage(), e);
                                continue;
                            }
                        }
                    } finally {
                        // free the bytestream data
                        sample.getData().releaseData();
                    }
                }
            }
        } catch (Exception e) {
            throw new PlanningException("Automated evaluation failed", e);
View Full Code Here

     * Determines if there is at least one sample with format info.
     *
     * @return true if a sample with format info is available
     */
    public boolean isMimetypeAvailable() {
        SampleObject sample = getSampleWithFormat();
        return isFormatInfoAvailable() && sample.getFormatInfo().getMimeType() != null
            && !"".equals(sample.getFormatInfo().getMimeType());
    }
View Full Code Here

            setProgramOutputForAlternative(a, msg, false);
        }

        if (action instanceof IMigrationAction) {
            IMigrationAction migrationAction = (IMigrationAction) action;
            SampleObject record = experimentStatus.getNextSample();
            while (record != null) {
                if (record.isDataExistent()) {
                    MigrationResult migrationResult = null;

                    try {
                        DigitalObject workflow = a.getExperiment().getWorkflow();
                        if (workflow != null) {
View Full Code Here

     * @param sampleObj
     *            Experiment sample object.
     */
    public void updateSelectedDetailedExperimentInfo(Object alt, Object sampleObj) {
        Alternative alternative = (Alternative) alt;
        SampleObject sampleObject = (SampleObject) sampleObj;

        selectedDetailedExperimentInfo = alternative.getExperiment().getDetailedInfo().get(sampleObject);
    }
View Full Code Here

     * @param sampleObj
     *            SampleObject corresponding to the next file-upload.
     */
    public void updateDataForNextUpload(Object alt, Object sampleObj) {
        Alternative alternative = (Alternative) alt;
        SampleObject sampleObject = (SampleObject) sampleObj;

        alternativeForNextUpload = alternative;
        sampleObjectForNextUpload = sampleObject;
    }
View Full Code Here

     * @param sampleObj
     *            SampleObject of the wanted result file.
     */
    public void downloadResultFile(Object alt, Object sampleObj) {
        Alternative alternative = (Alternative) alt;
        SampleObject sampleObject = (SampleObject) sampleObj;

        DigitalObject resultFile = null;

        try {
            resultFile = runExperiments.fetchResultFile(alternative, sampleObject);
        } catch (StorageException e) {
            log.error("Exception at trying to fetch result file for alternative " + alternative.getName()
                + "and sample " + sampleObject.getFullname(), e);
            facesMessages.addError("Unable to fetch result file. Please try again.");
        }

        if (resultFile != null) {
            downloader.download(resultFile);
        } else {
            log.debug("No result file exists for alternative " + alternative.getName() + " and sample "
                + sampleObject.getFullname() + ".");
        }
    }
View Full Code Here

     * @param sampleObj
     *            Sample the file was uploaded for.
     */
    public void removeResultFile(Object alt, Object sampleObj) {
        Alternative alternative = (Alternative) alt;
        SampleObject sampleObject = (SampleObject) sampleObj;

        runExperiments.removeResultFile(alternative, sampleObject);
    }
View Full Code Here

        samplesToRemove.clear();
    }

    public SampleObject addSample(String filename, String contentType, byte[] data) throws PlanningException {
        SampleObject sample = new SampleObject(filename);
        sample.setFullname(filename);
        sample.setContentType(contentType);

        ByteStream bsData = new ByteStream();
        bsData.setData(data);
        sample.setData(bsData);

        digitalObjectManager.moveDataToStorage(sample);
        addedBytestreams.add(sample.getPid());
        plan.getSampleRecordsDefinition().addRecord(sample);

        // identify format of newly uploaded samples
        if (shouldCharacterise(sample)) {
            characteriseFits(sample);
        }

        log.debug("Content-Type: " + sample.getContentType());
        log.debug("Size of samples Array: " + plan.getSampleRecordsDefinition().getRecords().size());
        log.debug("FileName: " + sample.getFullname());
        log.debug("Length of File: " + sample.getData().getSize());
        log.debug("added SampleObject: " + sample.getFullname());
        log.debug("JHove initialized: " + (sample.getJhoveXMLString() != null));

        return sample;
    }
View Full Code Here

        /*
         * map sample records to uploads and their xcdlDescriptions, if present
         */
        for (String key : tempUploads.keySet()) {
            SampleObject rec = records.get(key);
            if (rec != null) {
                DigitalObject result = tempUploads.get(key);
                getResults().put(rec, result);
            }
        }

        /*
         * map sample records to detailedInfos
         */
        for (String key : tempDetailedInfos.keySet()) {
            SampleObject rec = records.get(key);
            if (rec != null) {
                getDetailedInfo().put(rec, tempDetailedInfos.get(key));
            }
        }

View Full Code Here

TOP

Related Classes of eu.scape_project.planning.model.SampleObject

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.