From b8c8f077220bc65fa0f5063ba50d0ef434794730 Mon Sep 17 00:00:00 2001 From: Maxim Date: Sun, 2 Jun 2024 17:44:38 +0300 Subject: [PATCH] Add method getnamespaceAndTag to GFPDStructElem. Fix getcircularMappingExist method --- .../gf/model/impl/pd/GFPDStructElem.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/GFPDStructElem.java b/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/GFPDStructElem.java index 54a1f9267..83646f352 100644 --- a/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/GFPDStructElem.java +++ b/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/GFPDStructElem.java @@ -39,9 +39,11 @@ import org.verapdf.model.coslayer.CosUnicodeName; import org.verapdf.model.pdlayer.PDStructElem; import org.verapdf.pd.structure.StructureType; +import org.verapdf.pdfa.flavours.PDFAFlavour; import org.verapdf.pdfa.flavours.PDFFlavours; import org.verapdf.tools.StaticResources; import org.verapdf.tools.TaggedPDFConstants; +import org.verapdf.tools.TaggedPDFHelper; import java.util.*; import java.util.logging.Level; @@ -121,6 +123,15 @@ public String getparentStandardType() { return null; } + @Override + public String getnamespaceAndTag() { + StructureType type = ((org.verapdf.pd.structure.PDStructElem)simplePDObject).getStructureType(); + if (type != null) { + return (type.getType() != null ? type.getType() : "null") + ":" + (type.getNameSpaceURI() != null ? type.getNameSpaceURI() : "null"); + } + return null; + } + @Override public Boolean getcontainsParent() { return ((org.verapdf.pd.structure.PDStructElem) simplePDObject).getParent() != null; @@ -193,7 +204,17 @@ public String getE() { @Override public Boolean getcircularMappingExist() { StructureType type = ((org.verapdf.pd.structure.PDStructElem)simplePDObject).getStructureType(); - return type != null ? StaticResources.getRoleMapHelper().circularMappingExist(type.getType()) : null; + if (type != null) { + if (StaticResources.getRoleMapHelper().circularMappingExist(type.getType())) { + return true; + } + if (PDFFlavours.isPDFSpecification(StaticContainers.getFlavour(), PDFAFlavour.PDFSpecification.ISO_32000_2_0) && + TaggedPDFHelper.isCircularMappingExist(type)) { + return true; + } + return false; + } + return null; } @Override