From 71ddd1660e66323a21fd7717a341236bbdc7cdc1 Mon Sep 17 00:00:00 2001 From: Maxim Date: Tue, 8 Oct 2024 22:29:15 +0300 Subject: [PATCH] Update identification schema methods --- .../model/impl/axl/AXLMainXMPPackage.java | 28 +++++++++++++------ .../model/impl/axl/XMPIdentificationTest.java | 2 +- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/verapdf/model/impl/axl/AXLMainXMPPackage.java b/core/src/main/java/org/verapdf/model/impl/axl/AXLMainXMPPackage.java index e39c46955..40c308f06 100644 --- a/core/src/main/java/org/verapdf/model/impl/axl/AXLMainXMPPackage.java +++ b/core/src/main/java/org/verapdf/model/impl/axl/AXLMainXMPPackage.java @@ -40,9 +40,9 @@ public class AXLMainXMPPackage extends AXLXMPPackage implements MainXMPPackage { public static final String MAIN_XMP_PACKAGE_TYPE = "MainXMPPackage"; - public static final String IDENTIFICATION = "Identification"; + public static final String PDFA_IDENTIFICATION = "PDFAIdentification"; - public static final String UAIDENTIFICATION = "UAIdentification"; + public static final String PDFUA_IDENTIFICATION = "PDFUAIdentification"; /** * Constructs new object @@ -65,16 +65,16 @@ public AXLMainXMPPackage(VeraPDFMeta xmpMetadata, boolean isSerializationValid, @Override public List getLinkedObjects(String link) { switch (link) { - case IDENTIFICATION: - return this.getIdentification(); - case UAIDENTIFICATION: - return this.getUAIdentification(); + case PDFA_IDENTIFICATION: + return this.getPDFAIdentification(); + case PDFUA_IDENTIFICATION: + return this.getPDFUAIdentification(); default: return super.getLinkedObjects(link); } } - private List getUAIdentification() { + private List getPDFUAIdentification() { VeraPDFMeta xmpMetadata = this.getXmpMetadata(); if (xmpMetadata != null && xmpMetadata.containsPropertiesFromNamespace(XMPConst.NS_PDFUA_ID)) { List res = new ArrayList<>(1); @@ -84,7 +84,7 @@ private List getUAIdentification() { return Collections.emptyList(); } - private List getIdentification() { + private List getPDFAIdentification() { VeraPDFMeta xmpMetadata = this.getXmpMetadata(); if (xmpMetadata != null && xmpMetadata.containsPropertiesFromNamespace(XMPConst.NS_PDFA_ID)) { List res = new ArrayList<>(1); @@ -94,6 +94,18 @@ private List getIdentification() { return Collections.emptyList(); } + @Override + public Boolean getcontainsPDFUAIdentification() { + VeraPDFMeta xmpMetadata = this.getXmpMetadata(); + return xmpMetadata != null && xmpMetadata.containsPropertiesFromNamespace(XMPConst.NS_PDFUA_ID); + } + + @Override + public Boolean getcontainsPDFAIdentification() { + VeraPDFMeta xmpMetadata = this.getXmpMetadata(); + return xmpMetadata != null && xmpMetadata.containsPropertiesFromNamespace(XMPConst.NS_PDFA_ID); + } + @Override public String getdc_title() { VeraPDFMeta xmpMetadata = this.getXmpMetadata(); diff --git a/core/src/test/java/org/verapdf/model/impl/axl/XMPIdentificationTest.java b/core/src/test/java/org/verapdf/model/impl/axl/XMPIdentificationTest.java index 1e5fc6910..0b13afc48 100644 --- a/core/src/test/java/org/verapdf/model/impl/axl/XMPIdentificationTest.java +++ b/core/src/test/java/org/verapdf/model/impl/axl/XMPIdentificationTest.java @@ -96,7 +96,7 @@ public void test() throws URISyntaxException, XMPException, IOException { VeraPDFMeta meta = VeraPDFMeta.parse(in); AXLMainXMPPackage pack = new AXLMainXMPPackage(meta, true); List list = pack - .getLinkedObjects(AXLMainXMPPackage.IDENTIFICATION); + .getLinkedObjects(AXLMainXMPPackage.PDFA_IDENTIFICATION); assertEquals(this.identificationSchemaNumber, list.size()); if (!list.isEmpty()) { AXLPDFAIdentification identification = (AXLPDFAIdentification) list