Search in sources :

Example 1 with Record

use of org.folio.rest.jaxrs.model.Record in project mod-inventory by folio-org.

the class CreateHoldingEventHandler method fillInstanceIdIfNeeded.

private void fillInstanceIdIfNeeded(DataImportEventPayload dataImportEventPayload, JsonObject holdingAsJson) {
    if (isBlank(holdingAsJson.getString(INSTANCE_ID_FIELD))) {
        String instanceId = null;
        String instanceAsString = dataImportEventPayload.getContext().get(EntityType.INSTANCE.value());
        if (isNotEmpty(instanceAsString)) {
            JsonObject holdingsRecord = new JsonObject(instanceAsString);
            instanceId = holdingsRecord.getString("id");
        }
        if (isBlank(instanceId)) {
            String recordAsString = dataImportEventPayload.getContext().get(EntityType.MARC_BIBLIOGRAPHIC.value());
            Record record = Json.decodeValue(recordAsString, Record.class);
            instanceId = ParsedRecordUtil.getAdditionalSubfieldValue(record.getParsedRecord(), ParsedRecordUtil.AdditionalSubfields.I);
        }
        if (isBlank(instanceId)) {
            throw new EventProcessingException(PAYLOAD_DATA_HAS_NO_INSTANCE_ID_ERROR_MSG);
        }
        fillInstanceId(dataImportEventPayload, holdingAsJson, instanceId);
    }
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Record(org.folio.rest.jaxrs.model.Record) HoldingsRecord(org.folio.HoldingsRecord) EventProcessingException(org.folio.processing.exceptions.EventProcessingException)

Example 2 with Record

use of org.folio.rest.jaxrs.model.Record in project mod-inventory by folio-org.

the class CreateHoldingEventHandler method handle.

@Override
public CompletableFuture<DataImportEventPayload> handle(DataImportEventPayload dataImportEventPayload) {
    CompletableFuture<DataImportEventPayload> future = new CompletableFuture<>();
    try {
        dataImportEventPayload.setEventType(DI_INVENTORY_HOLDING_CREATED.value());
        HashMap<String, String> payloadContext = dataImportEventPayload.getContext();
        if (payloadContext == null || payloadContext.isEmpty() || StringUtils.isEmpty(payloadContext.get(MARC_BIBLIOGRAPHIC.value()))) {
            throw new EventProcessingException(CONTEXT_EMPTY_ERROR_MESSAGE);
        }
        if (dataImportEventPayload.getCurrentNode().getChildSnapshotWrappers().isEmpty()) {
            LOGGER.error(ACTION_HAS_NO_MAPPING_MSG);
            return CompletableFuture.failedFuture(new EventProcessingException(ACTION_HAS_NO_MAPPING_MSG));
        }
        Context context = constructContext(dataImportEventPayload.getTenant(), dataImportEventPayload.getToken(), dataImportEventPayload.getOkapiUrl());
        String jobExecutionId = dataImportEventPayload.getJobExecutionId();
        String recordId = payloadContext.get(RECORD_ID_HEADER);
        String chunkId = payloadContext.get(CHUNK_ID_HEADER);
        Future<RecordToEntity> recordToHoldingsFuture = idStorageService.store(recordId, UUID.randomUUID().toString(), dataImportEventPayload.getTenant());
        recordToHoldingsFuture.onSuccess(res -> {
            String holdingsId = res.getEntityId();
            mappingMetadataCache.get(jobExecutionId, context).map(parametersOptional -> parametersOptional.orElseThrow(() -> new EventProcessingException(format(MAPPING_METADATA_NOT_FOUND_MSG, jobExecutionId, recordId, chunkId)))).map(mappingMetadataDto -> {
                prepareEvent(dataImportEventPayload);
                MappingParameters mappingParameters = Json.decodeValue(mappingMetadataDto.getMappingParams(), MappingParameters.class);
                MappingManager.map(dataImportEventPayload, new MappingContext().withMappingParameters(mappingParameters));
                JsonObject holdingAsJson = new JsonObject(payloadContext.get(HOLDINGS.value()));
                if (holdingAsJson.getJsonObject(HOLDINGS_PATH_FIELD) != null) {
                    holdingAsJson = holdingAsJson.getJsonObject(HOLDINGS_PATH_FIELD);
                }
                holdingAsJson.put("id", holdingsId);
                holdingAsJson.put("sourceId", FOLIO_SOURCE_ID);
                fillInstanceIdIfNeeded(dataImportEventPayload, holdingAsJson);
                checkIfPermanentLocationIdExists(holdingAsJson);
                return Json.decodeValue(payloadContext.get(HOLDINGS.value()), HoldingsRecord.class);
            }).compose(holdingToCreate -> addHoldings(holdingToCreate, context)).onSuccess(createdHoldings -> {
                LOGGER.info("Created Holding record by jobExecutionId: '{}' and recordId: '{}' and chunkId: '{}'", jobExecutionId, recordId, chunkId);
                payloadContext.put(HOLDINGS.value(), Json.encodePrettily(createdHoldings));
                future.complete(dataImportEventPayload);
            }).onFailure(e -> {
                if (!(e instanceof DuplicateEventException)) {
                    LOGGER.error("Error creating inventory Holding record by jobExecutionId: '{}' and recordId: '{}' and chunkId: '{}' ", jobExecutionId, recordId, chunkId, e);
                }
                future.completeExceptionally(e);
            });
        }).onFailure(failure -> {
            LOGGER.error("Error creating inventory recordId and holdingsId relationship by jobExecutionId: '{}' and recordId: '{}' and chunkId: '{}' ", jobExecutionId, recordId, chunkId, failure);
            future.completeExceptionally(failure);
        });
    } catch (Exception e) {
        LOGGER.error(CREATE_HOLDING_ERROR_MESSAGE, e);
        future.completeExceptionally(e);
    }
    return future;
}
Also used : Context(org.folio.inventory.common.Context) EventHandlingUtil.constructContext(org.folio.inventory.dataimport.handlers.matching.util.EventHandlingUtil.constructContext) MappingContext(org.folio.processing.mapping.mapper.MappingContext) ParsedRecordUtil(org.folio.inventory.dataimport.util.ParsedRecordUtil) Json(io.vertx.core.json.Json) Context(org.folio.inventory.common.Context) EventHandler(org.folio.processing.events.services.handler.EventHandler) DI_INVENTORY_HOLDING_CREATED(org.folio.DataImportEventTypes.DI_INVENTORY_HOLDING_CREATED) MappingManager(org.folio.processing.mapping.MappingManager) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) ACTION_PROFILE(org.folio.rest.jaxrs.model.ProfileSnapshotWrapper.ContentType.ACTION_PROFILE) StringUtils(org.apache.commons.lang3.StringUtils) EventHandlingUtil.constructContext(org.folio.inventory.dataimport.handlers.matching.util.EventHandlingUtil.constructContext) HOLDINGS(org.folio.ActionProfile.FolioRecord.HOLDINGS) HoldingsRecordCollection(org.folio.inventory.domain.HoldingsRecordCollection) UNIQUE_ID_ERROR_MESSAGE(org.folio.inventory.dataimport.util.DataImportConstants.UNIQUE_ID_ERROR_MESSAGE) EntityType(org.folio.rest.jaxrs.model.EntityType) JsonObject(io.vertx.core.json.JsonObject) IdStorageService(org.folio.inventory.services.IdStorageService) ActionProfile(org.folio.ActionProfile) RecordToEntity(org.folio.inventory.domain.relationship.RecordToEntity) StringUtils.isEmpty(org.apache.commons.lang3.StringUtils.isEmpty) MappingParameters(org.folio.processing.mapping.defaultmapper.processor.parameters.MappingParameters) MARC_BIBLIOGRAPHIC(org.folio.ActionProfile.FolioRecord.MARC_BIBLIOGRAPHIC) MappingContext(org.folio.processing.mapping.mapper.MappingContext) DuplicateEventException(org.folio.kafka.exception.DuplicateEventException) Record(org.folio.rest.jaxrs.model.Record) Promise(io.vertx.core.Promise) DataImportEventPayload(org.folio.DataImportEventPayload) UUID(java.util.UUID) Future(io.vertx.core.Future) HoldingsRecord(org.folio.HoldingsRecord) String.format(java.lang.String.format) StringUtils.isNotBlank(org.apache.commons.lang.StringUtils.isNotBlank) Storage(org.folio.inventory.storage.Storage) Logger(org.apache.logging.log4j.Logger) EventProcessingException(org.folio.processing.exceptions.EventProcessingException) StringUtils.isBlank(org.apache.commons.lang3.StringUtils.isBlank) Strings.isNotEmpty(org.apache.logging.log4j.util.Strings.isNotEmpty) LogManager(org.apache.logging.log4j.LogManager) MappingMetadataCache(org.folio.inventory.dataimport.cache.MappingMetadataCache) DuplicateEventException(org.folio.kafka.exception.DuplicateEventException) JsonObject(io.vertx.core.json.JsonObject) RecordToEntity(org.folio.inventory.domain.relationship.RecordToEntity) DuplicateEventException(org.folio.kafka.exception.DuplicateEventException) EventProcessingException(org.folio.processing.exceptions.EventProcessingException) DataImportEventPayload(org.folio.DataImportEventPayload) MappingContext(org.folio.processing.mapping.mapper.MappingContext) CompletableFuture(java.util.concurrent.CompletableFuture) MappingParameters(org.folio.processing.mapping.defaultmapper.processor.parameters.MappingParameters) EventProcessingException(org.folio.processing.exceptions.EventProcessingException)

Example 3 with Record

use of org.folio.rest.jaxrs.model.Record in project mod-inventory by folio-org.

the class CreateInstanceEventHandler method handle.

@Override
public CompletableFuture<DataImportEventPayload> handle(DataImportEventPayload dataImportEventPayload) {
    CompletableFuture<DataImportEventPayload> future = new CompletableFuture<>();
    try {
        dataImportEventPayload.setEventType(DI_INVENTORY_INSTANCE_CREATED.value());
        HashMap<String, String> payloadContext = dataImportEventPayload.getContext();
        if (payloadContext == null || payloadContext.isEmpty() || isEmpty(dataImportEventPayload.getContext().get(MARC_BIBLIOGRAPHIC.value()))) {
            LOGGER.error(PAYLOAD_HAS_NO_DATA_MSG);
            return CompletableFuture.failedFuture(new EventProcessingException(PAYLOAD_HAS_NO_DATA_MSG));
        }
        String jobExecutionId = dataImportEventPayload.getJobExecutionId();
        String recordId = dataImportEventPayload.getContext().get(RECORD_ID_HEADER);
        if (dataImportEventPayload.getCurrentNode().getChildSnapshotWrappers().isEmpty()) {
            LOGGER.error(ACTION_HAS_NO_MAPPING_MSG);
            return CompletableFuture.failedFuture(new EventProcessingException(format(ACTION_HAS_NO_MAPPING_MSG, jobExecutionId, recordId)));
        }
        Context context = EventHandlingUtil.constructContext(dataImportEventPayload.getTenant(), dataImportEventPayload.getToken(), dataImportEventPayload.getOkapiUrl());
        Record targetRecord = Json.decodeValue(payloadContext.get(EntityType.MARC_BIBLIOGRAPHIC.value()), Record.class);
        String chunkId = dataImportEventPayload.getContext().get(CHUNK_ID_HEADER);
        Future<RecordToEntity> recordToInstanceFuture = idStorageService.store(targetRecord.getId(), UUID.randomUUID().toString(), dataImportEventPayload.getTenant());
        recordToInstanceFuture.onSuccess(res -> {
            String instanceId = res.getEntityId();
            mappingMetadataCache.get(jobExecutionId, context).compose(parametersOptional -> parametersOptional.map(mappingMetadata -> prepareAndExecuteMapping(dataImportEventPayload, new JsonObject(mappingMetadata.getMappingRules()), Json.decodeValue(mappingMetadata.getMappingParams(), MappingParameters.class))).orElseGet(() -> Future.failedFuture(format(MAPPING_PARAMETERS_NOT_FOUND_MSG, jobExecutionId, recordId, chunkId)))).compose(v -> {
                InstanceCollection instanceCollection = storage.getInstanceCollection(context);
                JsonObject instanceAsJson = prepareInstance(dataImportEventPayload, instanceId, jobExecutionId);
                List<String> errors = EventHandlingUtil.validateJsonByRequiredFields(instanceAsJson, requiredFields);
                if (!errors.isEmpty()) {
                    String msg = format("Mapped Instance is invalid: %s, by jobExecutionId: '%s' and recordId: '%s' and chunkId: '%s' ", errors, jobExecutionId, recordId, chunkId);
                    LOGGER.warn(msg);
                    return Future.failedFuture(msg);
                }
                Instance mappedInstance = Instance.fromJson(instanceAsJson);
                return addInstance(mappedInstance, instanceCollection).compose(createdInstance -> precedingSucceedingTitlesHelper.createPrecedingSucceedingTitles(mappedInstance, context).map(createdInstance));
            }).onSuccess(ar -> {
                dataImportEventPayload.getContext().put(INSTANCE.value(), Json.encode(ar));
                future.complete(dataImportEventPayload);
            }).onFailure(e -> {
                if (!(e instanceof DuplicateEventException)) {
                    LOGGER.error("Error creating inventory Instance by jobExecutionId: '{}' and recordId: '{}' and chunkId: '{}' ", jobExecutionId, recordId, chunkId, e);
                }
                future.completeExceptionally(e);
            });
        }).onFailure(failure -> {
            LOGGER.error("Error creating inventory recordId and instanceId relationship by jobExecutionId: '{}' and recordId: '{}' and chunkId: '{}' ", jobExecutionId, recordId, chunkId, failure);
            future.completeExceptionally(failure);
        });
    } catch (Exception e) {
        LOGGER.error("Error creating inventory Instance", e);
        future.completeExceptionally(e);
    }
    return future;
}
Also used : Context(org.folio.inventory.common.Context) MappingContext(org.folio.processing.mapping.mapper.MappingContext) CREATE(org.folio.ActionProfile.Action.CREATE) Json(io.vertx.core.json.Json) Context(org.folio.inventory.common.Context) DI_INVENTORY_INSTANCE_CREATED_READY_FOR_POST_PROCESSING(org.folio.DataImportEventTypes.DI_INVENTORY_INSTANCE_CREATED_READY_FOR_POST_PROCESSING) MappingManager(org.folio.processing.mapping.MappingManager) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) InstanceCollection(org.folio.inventory.domain.instances.InstanceCollection) ACTION_PROFILE(org.folio.rest.jaxrs.model.ProfileSnapshotWrapper.ContentType.ACTION_PROFILE) UNIQUE_ID_ERROR_MESSAGE(org.folio.inventory.dataimport.util.DataImportConstants.UNIQUE_ID_ERROR_MESSAGE) EntityType(org.folio.rest.jaxrs.model.EntityType) JsonObject(io.vertx.core.json.JsonObject) IdStorageService(org.folio.inventory.services.IdStorageService) ActionProfile(org.folio.ActionProfile) RecordToEntity(org.folio.inventory.domain.relationship.RecordToEntity) StringUtils.isEmpty(org.apache.commons.lang3.StringUtils.isEmpty) MappingParameters(org.folio.processing.mapping.defaultmapper.processor.parameters.MappingParameters) MARC_BIBLIOGRAPHIC(org.folio.ActionProfile.FolioRecord.MARC_BIBLIOGRAPHIC) MappingContext(org.folio.processing.mapping.mapper.MappingContext) DuplicateEventException(org.folio.kafka.exception.DuplicateEventException) Record(org.folio.rest.jaxrs.model.Record) HRID_KEY(org.folio.inventory.domain.instances.Instance.HRID_KEY) Promise(io.vertx.core.Promise) DataImportEventPayload(org.folio.DataImportEventPayload) UUID(java.util.UUID) Future(io.vertx.core.Future) String.format(java.lang.String.format) StringUtils.isNotBlank(org.apache.commons.lang.StringUtils.isNotBlank) Storage(org.folio.inventory.storage.Storage) List(java.util.List) Logger(org.apache.logging.log4j.Logger) EventProcessingException(org.folio.processing.exceptions.EventProcessingException) DI_INVENTORY_INSTANCE_CREATED(org.folio.DataImportEventTypes.DI_INVENTORY_INSTANCE_CREATED) EventHandlingUtil(org.folio.inventory.dataimport.handlers.matching.util.EventHandlingUtil) INSTANCE(org.folio.ActionProfile.FolioRecord.INSTANCE) Instance(org.folio.inventory.domain.instances.Instance) SOURCE_KEY(org.folio.inventory.domain.instances.Instance.SOURCE_KEY) LogManager(org.apache.logging.log4j.LogManager) MappingMetadataCache(org.folio.inventory.dataimport.cache.MappingMetadataCache) DuplicateEventException(org.folio.kafka.exception.DuplicateEventException) Instance(org.folio.inventory.domain.instances.Instance) InstanceCollection(org.folio.inventory.domain.instances.InstanceCollection) JsonObject(io.vertx.core.json.JsonObject) RecordToEntity(org.folio.inventory.domain.relationship.RecordToEntity) DuplicateEventException(org.folio.kafka.exception.DuplicateEventException) EventProcessingException(org.folio.processing.exceptions.EventProcessingException) DataImportEventPayload(org.folio.DataImportEventPayload) CompletableFuture(java.util.concurrent.CompletableFuture) Record(org.folio.rest.jaxrs.model.Record) List(java.util.List) EventProcessingException(org.folio.processing.exceptions.EventProcessingException)

Example 4 with Record

use of org.folio.rest.jaxrs.model.Record in project mod-inventory by folio-org.

the class CreateItemEventHandler method fillHoldingsRecordIdIfNecessary.

private void fillHoldingsRecordIdIfNecessary(DataImportEventPayload dataImportEventPayload, JsonObject itemAsJson) {
    if (isBlank(itemAsJson.getString(HOLDINGS_RECORD_ID_FIELD))) {
        String holdingsId = null;
        String holdingAsString = dataImportEventPayload.getContext().get(EntityType.HOLDINGS.value());
        if (StringUtils.isNotEmpty(holdingAsString)) {
            JsonObject holdingsRecord = new JsonObject(holdingAsString);
            holdingsId = holdingsRecord.getString(HOLDING_ID_FIELD);
        }
        if (isBlank(holdingsId)) {
            String recordAsString = dataImportEventPayload.getContext().get(EntityType.MARC_BIBLIOGRAPHIC.value());
            Record record = Json.decodeValue(recordAsString, Record.class);
            holdingsId = ParsedRecordUtil.getAdditionalSubfieldValue(record.getParsedRecord(), ParsedRecordUtil.AdditionalSubfields.H);
        }
        if (isBlank(holdingsId)) {
            LOG.error(PAYLOAD_DATA_HAS_NO_HOLDING_ID_MSG);
            throw new EventProcessingException(PAYLOAD_DATA_HAS_NO_HOLDING_ID_MSG);
        }
        itemAsJson.put(HOLDINGS_RECORD_ID_FIELD, holdingsId);
    }
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Record(org.folio.rest.jaxrs.model.Record) EventProcessingException(org.folio.processing.exceptions.EventProcessingException)

Example 5 with Record

use of org.folio.rest.jaxrs.model.Record in project mod-inventory by folio-org.

the class CreateMarcHoldingsEventHandler method handle.

@Override
public CompletableFuture<DataImportEventPayload> handle(DataImportEventPayload dataImportEventPayload) {
    CompletableFuture<DataImportEventPayload> future = new CompletableFuture<>();
    try {
        dataImportEventPayload.setEventType(DI_INVENTORY_HOLDING_CREATED.value());
        HashMap<String, String> payloadContext = dataImportEventPayload.getContext();
        if (payloadContext == null || payloadContext.isEmpty() || StringUtils.isEmpty(payloadContext.get(MARC_HOLDINGS.value()))) {
            return CompletableFuture.failedFuture(new EventProcessingException(CONTEXT_EMPTY_ERROR_MESSAGE));
        }
        if (dataImportEventPayload.getCurrentNode().getChildSnapshotWrappers().isEmpty()) {
            LOGGER.error(ACTION_HAS_NO_MAPPING_MSG);
            return CompletableFuture.failedFuture(new EventProcessingException(ACTION_HAS_NO_MAPPING_MSG));
        }
        Context context = constructContext(dataImportEventPayload.getTenant(), dataImportEventPayload.getToken(), dataImportEventPayload.getOkapiUrl());
        Record targetRecord = new JsonObject(payloadContext.get(EntityType.MARC_HOLDINGS.value())).mapTo(Record.class);
        prepareEvent(dataImportEventPayload);
        String jobExecutionId = dataImportEventPayload.getJobExecutionId();
        String recordId = payloadContext.get(RECORD_ID_HEADER);
        String chunkId = payloadContext.get(CHUNK_ID_HEADER);
        Future<RecordToEntity> recordToHoldingsFuture = idStorageService.store(targetRecord.getId(), UUID.randomUUID().toString(), dataImportEventPayload.getTenant());
        recordToHoldingsFuture.onSuccess(res -> {
            String holdingsId = res.getEntityId();
            mappingMetadataCache.get(jobExecutionId, context).map(parametersOptional -> parametersOptional.orElseThrow(() -> new EventProcessingException(format(MAPPING_METADATA_NOT_FOUND_MSG, jobExecutionId, recordId, chunkId)))).onSuccess(mappingMetadata -> defaultMapRecordToHoldings(dataImportEventPayload, mappingMetadata)).map(v -> processMappingResult(dataImportEventPayload, holdingsId)).compose(holdingJson -> findInstanceIdByHrid(dataImportEventPayload, holdingJson, context).compose(instanceId -> {
                fillInstanceId(dataImportEventPayload, holdingJson, instanceId);
                var holdingsRecords = storage.getHoldingsRecordCollection(context);
                HoldingsRecord holding = Json.decodeValue(payloadContext.get(HOLDINGS.value()), HoldingsRecord.class);
                return addHoldings(holding, holdingsRecords);
            })).onSuccess(createdHoldings -> {
                LOGGER.info("Created Holding record by jobExecutionId: '{}' and recordId: '{}' and chunkId: '{}' ", jobExecutionId, recordId, chunkId);
                dataImportEventPayload.getContext().put(HOLDINGS.value(), Json.encodePrettily(createdHoldings));
                future.complete(dataImportEventPayload);
            }).onFailure(e -> {
                if (!(e instanceof DuplicateEventException)) {
                    LOGGER.error("Error creating Holding by jobExecutionId: '{}' and recordId: '{}' and chunkId: '{}' ", jobExecutionId, recordId, chunkId, e);
                }
                future.completeExceptionally(e);
            });
        }).onFailure(failure -> {
            LOGGER.error(format(CREATING_INVENTORY_RELATIONSHIP_ERROR_MESSAGE, jobExecutionId, recordId, chunkId), failure);
            future.completeExceptionally(failure);
        });
    } catch (Exception e) {
        LOGGER.error("Failed to create Holdings", e);
        future.completeExceptionally(e);
    }
    return future;
}
Also used : Context(org.folio.inventory.common.Context) EventHandlingUtil.constructContext(org.folio.inventory.dataimport.handlers.matching.util.EventHandlingUtil.constructContext) MappingMetadataDto(org.folio.MappingMetadataDto) Context(org.folio.inventory.common.Context) Json(io.vertx.core.json.Json) EventHandler(org.folio.processing.events.services.handler.EventHandler) DI_INVENTORY_HOLDING_CREATED(org.folio.DataImportEventTypes.DI_INVENTORY_HOLDING_CREATED) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) ACTION_PROFILE(org.folio.rest.jaxrs.model.ProfileSnapshotWrapper.ContentType.ACTION_PROFILE) StringUtils(org.apache.commons.lang3.StringUtils) JsonMappingException(org.folio.inventory.validation.exceptions.JsonMappingException) RecordMapperBuilder(org.folio.processing.mapping.defaultmapper.RecordMapperBuilder) EventHandlingUtil.constructContext(org.folio.inventory.dataimport.handlers.matching.util.EventHandlingUtil.constructContext) HOLDINGS(org.folio.ActionProfile.FolioRecord.HOLDINGS) DI_INVENTORY_HOLDINGS_CREATED_READY_FOR_POST_PROCESSING(org.folio.DataImportEventTypes.DI_INVENTORY_HOLDINGS_CREATED_READY_FOR_POST_PROCESSING) ParsedRecordUtil.getControlFieldValue(org.folio.inventory.dataimport.util.ParsedRecordUtil.getControlFieldValue) StringUtils.isBlank(org.apache.commons.lang.StringUtils.isBlank) HoldingsRecordCollection(org.folio.inventory.domain.HoldingsRecordCollection) UNIQUE_ID_ERROR_MESSAGE(org.folio.inventory.dataimport.util.DataImportConstants.UNIQUE_ID_ERROR_MESSAGE) EntityType(org.folio.rest.jaxrs.model.EntityType) IdStorageService(org.folio.inventory.services.IdStorageService) JsonObject(io.vertx.core.json.JsonObject) StringUtils.isEmpty(org.apache.commons.lang3.StringUtils.isEmpty) ActionProfile(org.folio.ActionProfile) RecordToEntity(org.folio.inventory.domain.relationship.RecordToEntity) RecordMapper(org.folio.processing.mapping.defaultmapper.RecordMapper) MappingParameters(org.folio.processing.mapping.defaultmapper.processor.parameters.MappingParameters) Holdings(org.folio.Holdings) DuplicateEventException(org.folio.kafka.exception.DuplicateEventException) Record(org.folio.rest.jaxrs.model.Record) Promise(io.vertx.core.Promise) DataImportEventPayload(org.folio.DataImportEventPayload) MARC_HOLDINGS(org.folio.ActionProfile.FolioRecord.MARC_HOLDINGS) UUID(java.util.UUID) HoldingsRecord(org.folio.HoldingsRecord) Future(io.vertx.core.Future) String.format(java.lang.String.format) StringUtils.isNotBlank(org.apache.commons.lang.StringUtils.isNotBlank) Storage(org.folio.inventory.storage.Storage) Logger(org.apache.logging.log4j.Logger) EventProcessingException(org.folio.processing.exceptions.EventProcessingException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) LogManager(org.apache.logging.log4j.LogManager) PagingParameters(org.folio.inventory.common.api.request.PagingParameters) MappingMetadataCache(org.folio.inventory.dataimport.cache.MappingMetadataCache) DuplicateEventException(org.folio.kafka.exception.DuplicateEventException) JsonObject(io.vertx.core.json.JsonObject) RecordToEntity(org.folio.inventory.domain.relationship.RecordToEntity) JsonMappingException(org.folio.inventory.validation.exceptions.JsonMappingException) DuplicateEventException(org.folio.kafka.exception.DuplicateEventException) EventProcessingException(org.folio.processing.exceptions.EventProcessingException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) DataImportEventPayload(org.folio.DataImportEventPayload) HoldingsRecord(org.folio.HoldingsRecord) CompletableFuture(java.util.concurrent.CompletableFuture) Record(org.folio.rest.jaxrs.model.Record) HoldingsRecord(org.folio.HoldingsRecord) EventProcessingException(org.folio.processing.exceptions.EventProcessingException)

Aggregations

Record (org.folio.rest.jaxrs.model.Record)320 ParsedRecord (org.folio.rest.jaxrs.model.ParsedRecord)266 Test (org.junit.Test)253 RawRecord (org.folio.rest.jaxrs.model.RawRecord)164 Async (io.vertx.ext.unit.Async)154 JsonObject (io.vertx.core.json.JsonObject)149 HashMap (java.util.HashMap)125 DataImportEventPayload (org.folio.DataImportEventPayload)116 ErrorRecord (org.folio.rest.jaxrs.model.ErrorRecord)116 SourceRecord (org.folio.rest.jaxrs.model.SourceRecord)76 ExternalIdsHolder (org.folio.rest.jaxrs.model.ExternalIdsHolder)74 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)69 UUID (java.util.UUID)66 ArrayList (java.util.ArrayList)64 List (java.util.List)62 Before (org.junit.Before)60 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)58 SnapshotDaoUtil (org.folio.dao.util.SnapshotDaoUtil)55 TestContext (io.vertx.ext.unit.TestContext)52 RunWith (org.junit.runner.RunWith)51