Package org.apache.xmpbox.type

Examples of org.apache.xmpbox.type.StructuredType


        XMPMetadata rxmp = builder.parse(is);

        XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();
        Assert.assertNotNull(jt);
        Assert.assertEquals(1, jt.getJobs().size());
        StructuredType stjob = JobType.class.getAnnotation(StructuredType.class);

        JobType job = jt.getJobs().get(0);
        Assert.assertEquals("zeid2", job.getId());
        Assert.assertEquals("zename2", job.getName());
        Assert.assertEquals("zeurl2", job.getUrl());
View Full Code Here


    public static void populateSchemaMapping(XMPMetadata meta) throws XmpParsingException
    {
        List<XMPSchema> schems = meta.getAllSchemas();
        TypeMapping tm = meta.getTypeMapping();
        StructuredType stPdfaExt = PDFAExtensionSchema.class.getAnnotation(StructuredType.class);
        for (XMPSchema xmpSchema : schems)
        {
            if (xmpSchema.getNamespace().equals(stPdfaExt.namespace()))
            {
                // ensure the prefix is the preferred one (cannot use other
                // definition)
                if (!xmpSchema.getPrefix().equals(stPdfaExt.preferedPrefix()))
                {
                    throw new XmpParsingException(ErrorType.InvalidPrefix,
                            "Found invalid prefix for PDF/A extension, found '" + xmpSchema.getPrefix()
                                    + "', should be '" + stPdfaExt.preferedPrefix() + "'");
                }
                // create schema and types
                PDFAExtensionSchema pes = (PDFAExtensionSchema) xmpSchema;
                ArrayProperty sp = pes.getSchemasProperty();
                for (AbstractField af : sp.getAllProperties())
View Full Code Here

        return null;
    }

    public XMPSchema getSchema(Class<? extends XMPSchema> clz)
    {
        StructuredType st = clz.getAnnotation(StructuredType.class);
        return getSchema(st.namespace());
    }
View Full Code Here

        String coverage = "Coverage";
        dc2.setCoverage(coverage);
        dc2.addCreator(creators.get(0));
        dc2.addCreator(creators.get(1));

        StructuredType stDub = DublinCoreSchema.class.getAnnotation(StructuredType.class);

        // We can't use metadata.getDublinCoreSchema() due to specification of
        // XMPBox (see Javadoc of XMPMetadata)
        Assert.assertEquals(format,
                ((DublinCoreSchema) metadata.getSchema(stDub.preferedPrefix(), stDub.namespace())).getFormat());
        Assert.assertEquals(coverage,
                ((DublinCoreSchema) metadata.getSchema(ownPrefix, stDub.namespace())).getCoverage());

        List<XMPSchema> schems = metadata.getAllSchemas();
        DublinCoreSchema dc;
        for (XMPSchema xmpSchema : schems)
        {
View Full Code Here

            ve.add(new ValidationError(ERROR_METADATA_PDFA_ID_MISSING));
            return ve;
        }

        // According to the PDF/A specification, the prefix must be pdfaid for this schema.
        StructuredType stBasic = XMPBasicSchema.class.getAnnotation(StructuredType.class);
        StructuredType stPdfaIdent = PDFAIdentificationSchema.class.getAnnotation(StructuredType.class);
        if (!id.getPrefix().equals(stPdfaIdent.preferedPrefix()))
        {
            if (metadata.getSchema(stPdfaIdent.preferedPrefix(), stBasic.namespace()) == null)
            {
                ve.add(unexpectedPrefixFoundError(id.getPrefix(), stPdfaIdent.preferedPrefix(),
                        PDFAIdentificationSchema.class.getName()));
            }
            else
            {
                id = (PDFAIdentificationSchema) metadata.getSchema(stPdfaIdent.preferedPrefix(),
                        stPdfaIdent.namespace());
            }
        }
        checkConformanceLevel(ve, id.getConformance());
        checkPartNumber(ve, id.getPart());
        return ve;
View Full Code Here

            ve.add(new ValidationError(ERROR_METADATA_PDFA_ID_MISSING));
            return ve;
        }

        // According to the PDF/A specification, the prefix must be pdfaid for this schema.
        StructuredType stBasic = XMPBasicSchema.class.getAnnotation(StructuredType.class);
        StructuredType stPdfaIdent = PDFAIdentificationSchema.class.getAnnotation(StructuredType.class);
        if (!id.getPrefix().equals(stPdfaIdent.preferedPrefix()))
        {
            if (metadata.getSchema(stPdfaIdent.preferedPrefix(), stBasic.namespace()) == null)
            {
                ve.add(unexpectedPrefixFoundError(id.getPrefix(), stPdfaIdent.preferedPrefix(),
                        PDFAIdentificationSchema.class.getName()));
            }
            else
            {
                id = (PDFAIdentificationSchema) metadata.getSchema(stPdfaIdent.preferedPrefix(),
                        stPdfaIdent.namespace());
            }
        }
        checkConformanceLevel(ve, id.getConformance());
        checkPartNumber(ve, id.getPart());
        return ve;
View Full Code Here

        String coverage = "Coverage";
        dc2.setCoverage(coverage);
        dc2.addCreator(creators.get(0));
        dc2.addCreator(creators.get(1));

        StructuredType stDub = DublinCoreSchema.class.getAnnotation(StructuredType.class);

        // We can't use metadata.getDublinCoreSchema() due to specification of
        // XMPBox (see Javadoc of XMPMetadata)
        Assert.assertEquals(format,
                ((DublinCoreSchema) metadata.getSchema(stDub.preferedPrefix(), stDub.namespace())).getFormat());
        Assert.assertEquals(coverage,
                ((DublinCoreSchema) metadata.getSchema(ownPrefix, stDub.namespace())).getCoverage());

        List<XMPSchema> schems = metadata.getAllSchemas();
        DublinCoreSchema dc;
        for (XMPSchema xmpSchema : schems)
        {
View Full Code Here

        return null;
    }

    public XMPSchema getSchema(Class<? extends XMPSchema> clz)
    {
        StructuredType st = clz.getAnnotation(StructuredType.class);
        return getSchema(st.namespace());
    }
View Full Code Here

        XMPMetadata rxmp = builder.parse(is);

        XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();
        Assert.assertNotNull(jt);
        Assert.assertEquals(1, jt.getJobs().size());
        StructuredType stjob = JobType.class.getAnnotation(StructuredType.class);

        JobType job = jt.getJobs().get(0);
        Assert.assertEquals("zeid2", job.getId());
        Assert.assertEquals("zename2", job.getName());
        Assert.assertEquals("zeurl2", job.getUrl());
View Full Code Here

    public static void populateSchemaMapping(XMPMetadata meta) throws XmpParsingException
    {
        List<XMPSchema> schems = meta.getAllSchemas();
        TypeMapping tm = meta.getTypeMapping();
        StructuredType stPdfaExt = PDFAExtensionSchema.class.getAnnotation(StructuredType.class);
        for (XMPSchema xmpSchema : schems)
        {
            if (xmpSchema.getNamespace().equals(stPdfaExt.namespace()))
            {
                // ensure the prefix is the preferred one (cannot use other
                // definition)
                if (!xmpSchema.getPrefix().equals(stPdfaExt.preferedPrefix()))
                {
                    throw new XmpParsingException(ErrorType.InvalidPrefix,
                            "Found invalid prefix for PDF/A extension, found '" + xmpSchema.getPrefix()
                                    + "', should be '" + stPdfaExt.preferedPrefix() + "'");
                }
                // create schema and types
                PDFAExtensionSchema pes = (PDFAExtensionSchema) xmpSchema;
                ArrayProperty sp = pes.getSchemasProperty();
                for (AbstractField af : sp.getAllProperties())
View Full Code Here

TOP

Related Classes of org.apache.xmpbox.type.StructuredType

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.