forked from folio-org/mod-entities-links
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: define $9 subfield definitions for MARC bibliographic records (f…
…olio-org#331) Closes: MODELINKS-255
- Loading branch information
Showing
13 changed files
with
205 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/org/folio/entlinks/service/tenant/MarcSpecificationUpdateService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.folio.entlinks.service.tenant; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.folio.entlinks.domain.entity.InstanceAuthorityLinkingRule; | ||
import org.folio.entlinks.integration.kafka.EventProducer; | ||
import org.folio.entlinks.service.links.InstanceAuthorityLinkingRulesService; | ||
import org.folio.rspec.domain.dto.DefinitionType; | ||
import org.folio.rspec.domain.dto.Family; | ||
import org.folio.rspec.domain.dto.FamilyProfile; | ||
import org.folio.rspec.domain.dto.Scope; | ||
import org.folio.rspec.domain.dto.SubfieldDto; | ||
import org.folio.rspec.domain.dto.SubfieldUpdateRequestEvent; | ||
import org.folio.rspec.domain.dto.UpdateRequestEvent; | ||
import org.springframework.retry.annotation.Backoff; | ||
import org.springframework.retry.annotation.Retryable; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class MarcSpecificationUpdateService { | ||
|
||
private static final String SUBFIELD_9_CODE = "9"; | ||
private static final String SUBFIELD_9_LABEL = "Linked authority UUID"; | ||
|
||
private final InstanceAuthorityLinkingRulesService linkingRulesService; | ||
private final EventProducer<UpdateRequestEvent> eventProducer; | ||
|
||
@Retryable(maxAttempts = 10, backoff = @Backoff(delay = 5000)) | ||
public void sendSpecificationRequests() { | ||
var requestEvents = linkingRulesService.getLinkingRules().stream() | ||
.map(InstanceAuthorityLinkingRule::getBibField) | ||
.distinct() | ||
.map(this::toSubfieldCreationRequest) | ||
.toList(); | ||
|
||
eventProducer.sendMessages(requestEvents); | ||
} | ||
|
||
private UpdateRequestEvent toSubfieldCreationRequest(String tag) { | ||
var requestEvent = new SubfieldUpdateRequestEvent(); | ||
requestEvent.setFamily(Family.MARC); | ||
requestEvent.setProfile(FamilyProfile.BIBLIOGRAPHIC); | ||
requestEvent.setDefinitionType(DefinitionType.SUBFIELD); | ||
requestEvent.setTargetFieldTag(tag); | ||
requestEvent.setSubfield(new SubfieldDto() | ||
.code(SUBFIELD_9_CODE) | ||
.label(SUBFIELD_9_LABEL) | ||
.deprecated(false) | ||
.required(false) | ||
.repeatable(false) | ||
.scope(Scope.SYSTEM) | ||
); | ||
return requestEvent; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.