Skip to content

Commit

Permalink
Update identification schema methods
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Oct 8, 2024
1 parent 7668949 commit 78300ab
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -65,16 +65,16 @@ public AXLMainXMPPackage(VeraPDFMeta xmpMetadata, boolean isSerializationValid,
@Override
public List<? extends Object> 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<AXLPDFUAIdentification> getUAIdentification() {
private List<AXLPDFUAIdentification> getPDFUAIdentification() {
VeraPDFMeta xmpMetadata = this.getXmpMetadata();
if (xmpMetadata != null && xmpMetadata.containsPropertiesFromNamespace(XMPConst.NS_PDFUA_ID)) {
List<AXLPDFUAIdentification> res = new ArrayList<>(1);
Expand All @@ -84,7 +84,7 @@ private List<AXLPDFUAIdentification> getUAIdentification() {
return Collections.emptyList();
}

private List<AXLPDFAIdentification> getIdentification() {
private List<AXLPDFAIdentification> getPDFAIdentification() {
VeraPDFMeta xmpMetadata = this.getXmpMetadata();
if (xmpMetadata != null && xmpMetadata.containsPropertiesFromNamespace(XMPConst.NS_PDFA_ID)) {
List<AXLPDFAIdentification> res = new ArrayList<>(1);
Expand All @@ -94,6 +94,18 @@ private List<AXLPDFAIdentification> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void test() throws URISyntaxException, XMPException, IOException {
VeraPDFMeta meta = VeraPDFMeta.parse(in);
AXLMainXMPPackage pack = new AXLMainXMPPackage(meta, true);
List<? extends org.verapdf.model.baselayer.Object> list = pack
.getLinkedObjects(AXLMainXMPPackage.IDENTIFICATION);
.getLinkedObjects(AXLMainXMPPackage.PDFA_IDENTIFICATION);
assertEquals(this.identificationSchemaNumber, list.size());
if (!list.isEmpty()) {
AXLPDFAIdentification identification = (AXLPDFAIdentification) list
Expand Down

0 comments on commit 78300ab

Please sign in to comment.