From b057b0c24a2b6b4ef9306945ba9fb230e4a849f0 Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 14 Sep 2023 16:43:04 +0300 Subject: [PATCH] Update metadata fixer method names --- .../fixer/impl/pb/model/MetadataImpl.java | 19 +++++++++---------- .../fixer/impl/pb/model/MetadataImplTest.java | 4 ++-- .../java/org/verapdf/model/ModelParser.java | 6 +++--- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/pdfbox-metadata-fixer/src/main/java/org/verapdf/metadata/fixer/impl/pb/model/MetadataImpl.java b/pdfbox-metadata-fixer/src/main/java/org/verapdf/metadata/fixer/impl/pb/model/MetadataImpl.java index 98931e12..a78c8ef9 100644 --- a/pdfbox-metadata-fixer/src/main/java/org/verapdf/metadata/fixer/impl/pb/model/MetadataImpl.java +++ b/pdfbox-metadata-fixer/src/main/java/org/verapdf/metadata/fixer/impl/pb/model/MetadataImpl.java @@ -113,7 +113,7 @@ public void removePDFIdentificationSchema( try { if (isValidIdentification()) { int part = flavour.getPart().getPartNumber(); - Integer schemaPart = this.metadata.getIdentificationPart(); + Integer schemaPart = this.metadata.getPDFAIdentificationPart(); if (schemaPart != null && schemaPart.intValue() != part) { @@ -121,7 +121,7 @@ public void removePDFIdentificationSchema( } } - boolean isDeleted = this.metadata.deleteIdentificationSchema(); + boolean isDeleted = this.metadata.deletePDFAIdentificationSchema(); if (isDeleted) { this.setNeedToBeUpdated(true); resultBuilder.addFix("Identification schema removed"); @@ -141,8 +141,8 @@ public void addPDFIdentificationSchema( try { if (isValidIdentification()) { - Integer schemaPart = this.metadata.getIdentificationPart(); - String schemaConformance = this.metadata.getIdentificationConformance(); + Integer schemaPart = this.metadata.getPDFAIdentificationPart(); + String schemaConformance = this.metadata.getPDFAIdentificationConformance(); if (schemaPart != null && schemaConformance != null && @@ -152,8 +152,8 @@ public void addPDFIdentificationSchema( } } - this.metadata.setIdentificationPart(Integer.valueOf(part)); - this.metadata.setIdentificationConformance(conformance); + this.metadata.setPDFAIdentificationPart(Integer.valueOf(part)); + this.metadata.setPDFAIdentificationConformance(conformance); this.setNeedToBeUpdated(true); resultBuilder.addFix("Identification schema added"); @@ -184,16 +184,15 @@ private static int confToInt(String conf) { private boolean isValidIdentification() { try { - Integer identificationPart = this.metadata.getIdentificationPart(); + Integer identificationPart = this.metadata.getPDFAIdentificationPart(); if (identificationPart == null) { return false; } - String identificationConformance = this.metadata.getIdentificationConformance(); + String identificationConformance = this.metadata.getPDFAIdentificationConformance(); if (identificationPart.intValue() == 1) { return "A".equals(identificationConformance) || "B".equals(identificationConformance); } else if (identificationPart.intValue() == 2 || identificationPart.intValue() == 3) { - return "A".equals(this.metadata.getIdentificationConformance()) || - "U".equals(identificationConformance) || + return "A".equals(identificationConformance) || "U".equals(identificationConformance) || "B".equals(identificationConformance); } else { return false; diff --git a/pdfbox-metadata-fixer/src/test/java/org/verapdf/metadata/fixer/impl/pb/model/MetadataImplTest.java b/pdfbox-metadata-fixer/src/test/java/org/verapdf/metadata/fixer/impl/pb/model/MetadataImplTest.java index 215c4f74..98f941e4 100644 --- a/pdfbox-metadata-fixer/src/test/java/org/verapdf/metadata/fixer/impl/pb/model/MetadataImplTest.java +++ b/pdfbox-metadata-fixer/src/test/java/org/verapdf/metadata/fixer/impl/pb/model/MetadataImplTest.java @@ -76,8 +76,8 @@ public void addPDFIdentificationSchemaTest() throws IOException, XMPException { MetadataFixerResultImpl.Builder builder = new MetadataFixerResultImpl.Builder(); impl.addPDFIdentificationSchema(builder, PDFAFlavour.PDFA_1_B); - assertEquals(filePart, xmp.getIdentificationPart()); - assertEquals(fileConformance, xmp.getIdentificationConformance()); + assertEquals(filePart, xmp.getPDFAIdentificationPart()); + assertEquals(fileConformance, xmp.getPDFAIdentificationConformance()); } } } diff --git a/pdfbox-validation-model/src/main/java/org/verapdf/model/ModelParser.java b/pdfbox-validation-model/src/main/java/org/verapdf/model/ModelParser.java index 6b48bc45..f6bdecd8 100644 --- a/pdfbox-validation-model/src/main/java/org/verapdf/model/ModelParser.java +++ b/pdfbox-validation-model/src/main/java/org/verapdf/model/ModelParser.java @@ -131,11 +131,11 @@ private static PDFAFlavour obtainFlavour(PDDocument document, PDFAFlavour defaul } try (InputStream is = metadata.exportXMPMetadata()) { VeraPDFMeta veraPDFMeta = VeraPDFMeta.parse(is); - Integer identificationPart = veraPDFMeta.getIdentificationPart(); - String identificationConformance = veraPDFMeta.getIdentificationConformance(); + Integer identificationPart = veraPDFMeta.getPDFAIdentificationPart(); + String identificationConformance = veraPDFMeta.getPDFAIdentificationConformance(); String prefix = ""; if (identificationPart == null && identificationConformance == null) { - identificationPart = veraPDFMeta.getUAIdentificationPart(); + identificationPart = veraPDFMeta.getPDFUAIdentificationPart(); if (identificationPart != null) { prefix = PDFUA_PREFIX; }