Skip to content

Commit

Permalink
feature/MODELINKS-248 Update dto relatedHeading
Browse files Browse the repository at this point in the history
  • Loading branch information
ShmElena committed Sep 11, 2024
1 parent 3f407df commit 289a24a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.folio.entlinks.domain.dto.AuthorityDto;
import org.folio.entlinks.domain.dto.AuthorityRelatedHeading;
import org.folio.entlinks.domain.dto.RelatedHeading;
import org.folio.entlinks.domain.entity.AuthorityBase;
import org.folio.entlinks.domain.entity.HeadingRef;
import org.folio.entlinks.domain.entity.RelationshipType;
Expand Down Expand Up @@ -161,7 +161,7 @@ private static void addRelationshipsToSaftHeadings(final AuthorityDto source, fi
processRelationshipHeadings(source.getSaftLaterHeading(), headingRefs, RelationshipType.LATER_HEADING);
}

private static void processRelationshipHeadings(List<AuthorityRelatedHeading> relationshipHeadings,
private static void processRelationshipHeadings(List<RelatedHeading> relationshipHeadings,
final List<HeadingRef> headingRefs, final RelationshipType relationshipType) {
if (isNotEmpty(relationshipHeadings)) {
headingRefs.forEach(headingRef -> {
Expand Down Expand Up @@ -256,13 +256,13 @@ private static void extractSaftHeadingsRelationships(HeadingRef headingRef, Auth
String headingFieldName = getSaftHeadingFieldName(headingRef.getHeadingType());
switch (relationshipType) {
case BROADER_TERM -> target.getSaftBroaderTerm()
.add(new AuthorityRelatedHeading(headingRef.getHeading(), headingFieldName));
.add(new RelatedHeading(headingRef.getHeading(), headingFieldName));
case NARROWER_TERM -> target.getSaftNarrowerTerm()
.add(new AuthorityRelatedHeading(headingRef.getHeading(), headingFieldName));
.add(new RelatedHeading(headingRef.getHeading(), headingFieldName));
case EARLIER_HEADING -> target.getSaftEarlierHeading()
.add(new AuthorityRelatedHeading(headingRef.getHeading(), headingFieldName));
.add(new RelatedHeading(headingRef.getHeading(), headingFieldName));
case LATER_HEADING -> target.getSaftLaterHeading()
.add(new AuthorityRelatedHeading(headingRef.getHeading(), headingFieldName));
.add(new RelatedHeading(headingRef.getHeading(), headingFieldName));
default -> log.warn("Invalid saft relationship type - {} cannot be mapped", relationshipType);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/swagger.api/mod-entities-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ components:
$ref: schemas/authority/control/linkStatus.json

authorityRelatedHeading:
$ref: schemas/authority-storage/authorityRelatedHeading.yaml
$ref: schemas/authority-storage/relatedHeading.yaml

authorityDto:
$ref: schemas/authority-storage/authorityDto.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,22 @@ properties:
type: array
description: See also from tracing term that represents broader, more general concepts related to the authority record
items:
$ref: './authorityRelatedHeading.yaml'
$ref: './relatedHeading.yaml'
saftNarrowerTerm:
type: array
description: See also from tracing term that that represents narrower, more specific concepts derived from the authority record
items:
$ref: './authorityRelatedHeading.yaml'
$ref: './relatedHeading.yaml'
saftEarlierHeading:
type: array
description: See also from tracing heading that was previously used to represent the concept or entity described by the authority record. This field is used to track the evolution of terms or headings over time, facilitating the linking of historical and current data.
items:
$ref: './authorityRelatedHeading.yaml'
$ref: './relatedHeading.yaml'
saftLaterHeading:
type: array
description: See also from tracing heading that replaced the current heading used in the authority record. This field helps in maintaining the continuity of catalog records by linking past headings to their more current versions.
items:
$ref: './authorityRelatedHeading.yaml'
$ref: './relatedHeading.yaml'
identifiers:
type: array
description: An extensible set of name-value pairs of identifiers associated with the resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.Set;
import java.util.stream.Stream;
import org.folio.entlinks.domain.dto.AuthorityDto;
import org.folio.entlinks.domain.dto.AuthorityRelatedHeading;
import org.folio.entlinks.domain.dto.RelatedHeading;
import org.folio.entlinks.domain.entity.Authority;
import org.folio.entlinks.domain.entity.HeadingRef;
import org.folio.entlinks.domain.entity.RelationshipType;
Expand Down Expand Up @@ -244,16 +244,16 @@ private static List<HeadingRef> getHeadingRefs() {
private static AuthorityDto getAuthorityDtoWithSaftTerms() {
AuthorityDto authorityDto = new AuthorityDto();
authorityDto.setSaftBroaderTerm(List.of(
new AuthorityRelatedHeading("broaderTerm1", "saftPersonalName"),
new AuthorityRelatedHeading("broaderTerm2", "saftCorporateName")));
new RelatedHeading("broaderTerm1", "saftPersonalName"),
new RelatedHeading("broaderTerm2", "saftCorporateName")));
authorityDto.setSaftNarrowerTerm(List.of(
new AuthorityRelatedHeading("narrowerTerm", "saftMeetingName"),
new AuthorityRelatedHeading("narrower-later", "saftMeetingName")));
new RelatedHeading("narrowerTerm", "saftMeetingName"),
new RelatedHeading("narrower-later", "saftMeetingName")));
authorityDto.setSaftEarlierHeading(List.of(
new AuthorityRelatedHeading("earlierHeading", "saftTopicalTerm")));
new RelatedHeading("earlierHeading", "saftTopicalTerm")));
authorityDto.setSaftLaterHeading(List.of(
new AuthorityRelatedHeading("laterHeading", "saftCorporateName"),
new AuthorityRelatedHeading("narrower-later", "saftMeetingName")));
new RelatedHeading("laterHeading", "saftCorporateName"),
new RelatedHeading("narrower-later", "saftMeetingName")));
authorityDto.setSaftPersonalName(List.of(PERSONAL_NAME_HEADING, "broaderTerm1"));
authorityDto.setSaftCorporateName(List.of(CORPORATE_NAME_HEADING, "broaderTerm2", "laterHeading"));
authorityDto.setSaftMeetingName(List.of(MEETING_NAME_HEADING, "narrowerTerm", "narrower-later"));
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/folio/support/TestDataUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.folio.entlinks.domain.dto.AuthorityDto;
import org.folio.entlinks.domain.dto.AuthorityDtoIdentifier;
import org.folio.entlinks.domain.dto.AuthorityDtoNote;
import org.folio.entlinks.domain.dto.AuthorityRelatedHeading;
import org.folio.entlinks.domain.dto.AuthorityStatsDto;
import org.folio.entlinks.domain.dto.BibStatsDto;
import org.folio.entlinks.domain.dto.BibStatsDtoCollection;
Expand All @@ -41,6 +40,7 @@
import org.folio.entlinks.domain.dto.LinkUpdateReport;
import org.folio.entlinks.domain.dto.ParsedRecordContent;
import org.folio.entlinks.domain.dto.RecordType;
import org.folio.entlinks.domain.dto.RelatedHeading;
import org.folio.entlinks.domain.dto.StrippedParsedRecord;
import org.folio.entlinks.domain.dto.StrippedParsedRecordCollection;
import org.folio.entlinks.domain.dto.StrippedParsedRecordParsedRecord;
Expand Down Expand Up @@ -413,8 +413,8 @@ public static AuthorityDto authorityDto(int authorityIdNum, int sourceFileIdNum)
dto.addSftMeetingNameItem("sftMeetingNameItem2");
dto.addSaftMeetingNameItem("sftMeetingNameItem1");
dto.addSaftMeetingNameItem("sftMeetingNameItem2");
dto.addSaftNarrowerTermItem(new AuthorityRelatedHeading("sftMeetingNameItem1", "saftMeetingName"));
dto.addSaftBroaderTermItem(new AuthorityRelatedHeading("saftPersonalName1", "saftPersonalName"));
dto.addSaftNarrowerTermItem(new RelatedHeading("sftMeetingNameItem1", "saftMeetingName"));
dto.addSaftBroaderTermItem(new RelatedHeading("saftPersonalName1", "saftPersonalName"));

return dto;
}
Expand Down

0 comments on commit 289a24a

Please sign in to comment.