Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method getLang to GFSEMarkedContent #616

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,23 @@ public String getParentsTags() {
return parentsTags + "&" + tag;
}

public String getParentLang() {
public String getInheritedLang() {
String structParentLang = getStructParentLang();
if (structParentLang != null) {
return structParentLang;
}
if (markedContent == null) {
return null;
}
COSString lang = markedContent.getLang();
if (lang != null) {
return lang.getString();
}
if (GFOp_BDC.OP_BDC_TYPE.equals(markedContent.getObjectType())) {
String structParentLang = ((GFOp_BDC)markedContent).getstructParentLang();
if (structParentLang != null) {
return structParentLang;
}
}
return markedContent.getParentLang();
return markedContent.getInheritedLang();
}

public String getStructParentLang() {
return null;
}

public COSObject getParentStructElem() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ private COSObject getStructElem() {
return null;
}

public String getstructParentLang() {
@Override
public String getStructParentLang() {
COSObject structureElement = getStructElem();
if (structureElement == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private List<XMPPackage> getXMPPackage() {
}
}
} catch (XMPException | IOException e) {
LOGGER.log(Level.FINE, "Problems with parsing metadata. " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Problems with parsing metadata. " + e.getMessage(), e);
if (isMainMetadata) {
xmp.add(new AXLMainXMPPackage(null, false, flavour));
} else if (flavour == null || flavour.getPart() != PDFAFlavour.Specification.ISO_19005_1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import org.verapdf.as.ASAtom;
import org.verapdf.cos.COSObject;
import org.verapdf.gf.model.impl.pd.gfse.GFSEFactory;
import org.verapdf.model.operator.Operator;
import org.verapdf.model.selayer.SEGroupedContent;
import org.verapdf.pd.structure.PDStructElem;
Expand Down Expand Up @@ -74,7 +73,7 @@ public Boolean getisSignature() {
return isSignature;
}

public String getLang() {
public String getLangValue() {
return defaultLang;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,16 @@ public List<CosLang> getLinkLang() {
return operator.getLinkLang();
}

@Override
public String getLang() {
COSString lang = operator.getLang();
return lang != null ? lang.getString() : null;
}

@Override
public String getinheritedLang() {
String inheritedLang = operator.getParentLang();
return inheritedLang != null ? inheritedLang : defaultLang;
String inheritedLang = operator.getInheritedLang();
return inheritedLang != null ? inheritedLang : super.getLangValue();
}

@Override
Expand All @@ -144,11 +150,6 @@ public String gettag() {
return tag != null ? tag.getString() : null;
}

@Override
public String getstructureTag() {
return parentStructElem != null ? parentStructElem.getNameKeyStringValue(ASAtom.S) : null;
}

@Override
public String getE() {
COSString E = operator.getE();
Expand All @@ -173,19 +174,9 @@ public String getparentsTags() {
}

@Override
public String getLang() {
COSString lang = operator.getLang();
if (lang != null) {
return lang.getString();
}
if (GFOp_BDC.OP_BDC_TYPE.equals(operator.getObjectType())) {
String structParentLang = ((GFOp_BDC)operator).getstructParentLang();
if (structParentLang != null) {
return structParentLang;
}
}
String parentLang = operator.getParentLang();
return parentLang != null ? parentLang : super.getLang();
public String getLangValue() {
String lang = getLang();
return lang != null ? lang : getinheritedLang();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Double getscaleFactor() {

@Override
public String getLang() {
return groupedContent.getLang();
return groupedContent.getLangValue();
}

@Override
Expand Down
Loading