Skip to content

Commit

Permalink
MODINV-986: minor hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
PBobylev committed Jun 10, 2024
1 parent 28dfa35 commit e3a7cca
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static org.folio.inventory.dataimport.util.MappingConstants.MARC_BIB_RECORD_TYPE;
import static org.folio.rest.jaxrs.model.EntityType.MARC_BIBLIOGRAPHIC;
import static org.folio.rest.jaxrs.model.Record.RecordType.MARC_BIB;
import static org.folio.rest.jaxrs.model.Snapshot.Status.PROCESSING_IN_PROGRESS;
import static org.folio.rest.jaxrs.model.Snapshot.Status.PROCESSING_FINISHED;

import io.vertx.core.Future;
import io.vertx.core.Promise;
Expand Down Expand Up @@ -117,17 +117,17 @@ private Future<org.folio.Instance> prepareAndExecuteMapping(MappingMetadataDto m
Record targetRecord,
InstanceIngressEvent event,
String instanceId) {
return postSnapshotInSrsAndHandleResponse(event.getId())
return postSnapshotInSrsAndHandleResponse(targetRecord.getId())
.compose(snapshot -> {
try {
LOGGER.info("Manipulating fields of a Record from InstanceIngressEvent with id '{}'", event.getId());
var mappingParameters = Json.decodeValue(mappingMetadata.getMappingParams(), MappingParameters.class);
AdditionalFieldsUtil.updateLatestTransactionDate(targetRecord, mappingParameters);
AdditionalFieldsUtil.move001To035(targetRecord);
AdditionalFieldsUtil.normalize035(targetRecord);
if (event.getEventPayload().getAdditionalProperties().containsKey(
LINKED_DATA_ID)) {AdditionalFieldsUtil.addFieldToMarcRecord(targetRecord, TAG_035, TAG_035_SUB,
LD + event.getEventPayload().getAdditionalProperties().get(LINKED_DATA_ID));
if (event.getEventPayload().getAdditionalProperties().containsKey(LINKED_DATA_ID)) {
AdditionalFieldsUtil.addFieldToMarcRecord(targetRecord, TAG_035, TAG_035_SUB,
LD + event.getEventPayload().getAdditionalProperties().get(LINKED_DATA_ID));
}

LOGGER.info("Mapping a Record from InstanceIngressEvent with id '{}' into an Instance", event.getId());
Expand Down Expand Up @@ -207,7 +207,7 @@ private Future<Instance> saveInstance(Instance instance, InstanceIngressEvent ev
private Future<Instance> executeFieldsManipulation(Instance instance, Record srcRecord,
Map<String, Object> eventProperties) {
if (eventProperties.containsKey(LINKED_DATA_ID)) {
AdditionalFieldsUtil.addFieldToMarcRecord(srcRecord, TAG_999, SUBFIELD_L, (String) eventProperties.get(LINKED_DATA_ID));
AdditionalFieldsUtil.addFieldToMarcRecord(srcRecord, TAG_999, SUBFIELD_L, String.valueOf(eventProperties.get(LINKED_DATA_ID)));
}
return super.executeFieldsManipulation(instance, srcRecord);
}
Expand Down Expand Up @@ -238,7 +238,7 @@ private Future<Snapshot> postSnapshotInSrsAndHandleResponse(String id) {
var snapshot = new Snapshot()
.withJobExecutionId(id)
.withProcessingStartedDate(new Date())
.withStatus(PROCESSING_IN_PROGRESS);
.withStatus(PROCESSING_FINISHED);
return super.postSnapshotInSrsAndHandleResponse(context.getOkapiLocation(),
context.getToken(), snapshot, context.getTenantId());
}
Expand Down

0 comments on commit e3a7cca

Please sign in to comment.