Skip to content

Commit

Permalink
MODLD-629: Handle empty subTitle while generating label
Browse files Browse the repository at this point in the history
  • Loading branch information
pkjacob committed Jan 6, 2025
1 parent ffed1d4 commit f67f6fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ protected List<String> getPrimaryMainTitles(List<TitleFieldRequestTitleInner> ti
.map(PrimaryTitleField.class::cast)
.map(PrimaryTitleField::getPrimaryTitle)
.map(pt -> join(" ", getFirstValue(pt::getMainTitle), getFirstValue(pt::getSubTitle)))
.map(String::trim)
.toList();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.folio.linked.data.mapper.dto.monograph.common.title;

import static org.apache.commons.lang3.StringUtils.isBlank;
import static java.lang.String.join;

import java.util.Set;
import org.folio.linked.data.domain.dto.InstanceRequest;
import org.folio.linked.data.domain.dto.InstanceResponse;
Expand All @@ -22,6 +25,6 @@ public Set<Class<?>> supportedParents() {
}

protected String getLabel(String mainTitle, String subTitle) {
return String.join(" ", mainTitle, subTitle);
return isBlank(subTitle) ? mainTitle : join(" ", mainTitle, subTitle);
}
}

0 comments on commit f67f6fe

Please sign in to comment.