Package eu.scape_project.planning.model

Examples of eu.scape_project.planning.model.FormatInfo


            byte[] migratedFile = new byte[]{};
            try {
                migratedFile = FileUtils.getBytesFromFile(new File(outputFile));
                DigitalObject u = new DigitalObject();
                u.getData().setData(migratedFile);
                FormatInfo tFormat = new FormatInfo();
                tFormat.setDefaultExtension(config.getOutEnding());
                result.setTargetFormat(tFormat);
                result.setMigratedObject(u);
            } catch (Exception e) {
                log.error("Could not get outputfile "+outputFile, e);
                result.setReport(result.getReport() + "\r\n error: could not retrieve outputfile.");
View Full Code Here


        for (Entry<String, ?> entry : outputFiles.entrySet()) {
            SSHInMemoryTempFile resultFile = (SSHInMemoryTempFile) entry.getValue();
            u.getData().setData(resultFile.getData());
            u.setFullname(action.getShortname() + " - " + digitalObject.getFullname());
        }
        FormatInfo tFormat = new FormatInfo();
        result.setTargetFormat(tFormat);
        result.setMigratedObject(u);

        return result;
    }
View Full Code Here

        // prepare commonly used parameters
        Map<String, String> params = new HashMap<String, String>();

        // PUID: use the PUID from action.targetformat
        String puid = "Target format PUID undefined for this action";
        FormatInfo targetInfo = alternative.getAction().getTargetFormatInfo();
        if (targetInfo != null && !"".equals(targetInfo.getPuid())) {
            puid = targetInfo.getPuid();
        }
        params.put("PUID", puid);

        for (String measureId : measureUris) {
View Full Code Here

                    }

                    if (MeasureConstants.FORMAT_CONFORMITY_CONFORMS.equals(measureUri)) {
                        if (alternative.getAction() != null) {
                            String puid = "UNDEFINED";
                            FormatInfo info = alternative.getAction().getTargetFormatInfo();
                            if (info != null) {
                                puid = info.getPuid();
                            }
                            String fitsText = extractor.extractText(fitsDocResult,
                                "//fits:externalIdentifier[@type='puid']/text()");
                            v = identicalValues(puid, fitsText, new BooleanScale());
                        }
View Full Code Here

        if (size.size() == 1) {
            Element s = (Element) size.get(0);
            sampleObject.setSizeInBytes(Long.parseLong(s.attributeValue("value")));
        }

        FormatInfo info = this.getFormatInfo(sample, sampleObject.getContentType());
        sampleObject.setFormatInfo(info);

        return sampleObject;
    }
View Full Code Here

        return sampleObject;
    }

    private FormatInfo getFormatInfo(Element sample, String mime) {
        FormatInfo info = new FormatInfo();
        info.setMimeType(mime);

        String uid = sample.attributeValue("uid");
        List<Element> records = sample.elements("record");
        List<Element> formats = new ArrayList<Element>();
        List<Element> versions = new ArrayList<Element>();
        List<Element> puids = new ArrayList<Element>();

        for (Element rec : records) {
            if (rec.attributeValue("name").equals("format")) {
                formats.add(rec);
            }

            if (rec.attributeValue("name").equals("format_version")) {
                versions.add(rec);
            }

            if (rec.attributeValue("name").equals("puid")) {
                puids.add(rec);
            }
        }

        if (formats.size() > 1) {
            info.setName("Conflict");
        } else if (formats.size() == 1) {
            Element format = (Element) formats.get(0);
            info.setName(format.attributeValue("value"));
        }

        if (versions.size() > 1) {
            info.setVersion("Conflict");
        } else if (versions.size() == 1) {
            Element version = (Element) versions.get(0);
            info.setVersion(version.attributeValue("value"));
        }

        if (puids.size() > 1) {
            info.setPuid("Conflict");
        } else if (puids.size() == 1) {
            Element puid = (Element) puids.get(0);
            info.setPuid(puid.attributeValue("value"));
        }

        return info;
    }
View Full Code Here

TOP

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

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.