Skip to content

Commit

Permalink
Add suggestion to check top element before first grandchild element.
Browse files Browse the repository at this point in the history
  • Loading branch information
henning-gerhardt committed Oct 23, 2023
1 parent 24b518d commit 4d177b7
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.regex.Pattern;

import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kitodo.api.dataformat.LogicalDivision;
Expand Down Expand Up @@ -373,6 +374,9 @@ private String determineReplacementForMetadata(Matcher variableFinder) {
if (!allChildren.isEmpty()) {
allFirstchildValue = MetadataEditor.getMetadataValue(allChildren.get(0), variableFinder.group(5));
if (Objects.isNull(allFirstchildValue)) {
allFirstchildValue = determineReplacementForTopstruct(variableFinder, dollarSignIfToKeep);
}
if (Objects.isNull(allFirstchildValue) || StringUtils.isEmpty(allFirstchildValue)) {
List<LogicalDivision> firstChildChildren = allChildren.get(0).getChildren();
if (!firstChildChildren.isEmpty()) {
allFirstchildValue = MetadataEditor.getMetadataValue(firstChildChildren.get(0), variableFinder.group(5));
Expand Down

0 comments on commit 4d177b7

Please sign in to comment.