Search in sources :

Example 1 with InitialRecord

use of org.folio.rest.jaxrs.model.InitialRecord in project mod-source-record-manager by folio-org.

the class ChangeManagerAPITest method fillInRecordOrderIfAtLeastOneRecordHasNoOrder.

private void fillInRecordOrderIfAtLeastOneRecordHasNoOrder(String rawRecord) throws InterruptedException {
    RawRecordsDto rawRecordsDto = new RawRecordsDto().withId(UUID.randomUUID().toString()).withRecordsMetadata(new RecordsMetadata().withLast(true).withCounter(7).withContentType(RecordsMetadata.ContentType.MARC_RAW)).withInitialRecords(asList(new InitialRecord().withRecord(CORRECT_RAW_RECORD_1), new InitialRecord().withRecord(CORRECT_RAW_RECORD_2).withOrder(5), new InitialRecord().withRecord(rawRecord).withOrder(6)));
    InitJobExecutionsRsDto response = constructAndPostInitJobExecutionRqDto(1);
    List<JobExecution> createdJobExecutions = response.getJobExecutions();
    assertThat(createdJobExecutions.size(), is(1));
    JobExecution jobExec = createdJobExecutions.get(0);
    RestAssured.given().spec(spec).body(new JobProfileInfo().withName("MARC records").withId(DEFAULT_JOB_PROFILE_ID).withDataType(DataType.MARC)).when().put(JOB_EXECUTION_PATH + jobExec.getId() + JOB_PROFILE_PATH).then().statusCode(HttpStatus.SC_OK);
    RestAssured.given().spec(spec).body(rawRecordsDto).when().post(JOB_EXECUTION_PATH + jobExec.getId() + RECORDS_PATH).then().statusCode(HttpStatus.SC_NO_CONTENT);
    String topicToObserve = formatToKafkaTopicName(DI_RAW_RECORDS_CHUNK_PARSED.value());
    List<String> observedValues = kafkaCluster.observeValues(ObserveKeyValues.on(topicToObserve, 1).observeFor(30, TimeUnit.SECONDS).build());
    Event obtainedEvent = Json.decodeValue(observedValues.get(0), Event.class);
    assertEquals(DI_RAW_RECORDS_CHUNK_PARSED.value(), obtainedEvent.getEventType());
    RecordCollection processedRecords = Json.decodeValue(obtainedEvent.getEventPayload(), RecordCollection.class);
    assertEquals(3, processedRecords.getRecords().size());
    assertEquals(4, processedRecords.getRecords().get(0).getOrder().intValue());
    assertEquals(5, processedRecords.getRecords().get(1).getOrder().intValue());
    assertEquals(6, processedRecords.getRecords().get(2).getOrder().intValue());
}
Also used : JobExecution(org.folio.rest.jaxrs.model.JobExecution) InitialRecord(org.folio.rest.jaxrs.model.InitialRecord) JobProfileInfo(org.folio.rest.jaxrs.model.JobProfileInfo) RawRecordsDto(org.folio.rest.jaxrs.model.RawRecordsDto) RecordCollection(org.folio.rest.jaxrs.model.RecordCollection) RecordsMetadata(org.folio.rest.jaxrs.model.RecordsMetadata) Event(org.folio.rest.jaxrs.model.Event) InitJobExecutionsRsDto(org.folio.rest.jaxrs.model.InitJobExecutionsRsDto) Matchers.containsString(org.hamcrest.Matchers.containsString)

Example 2 with InitialRecord

use of org.folio.rest.jaxrs.model.InitialRecord in project mod-source-record-manager by folio-org.

the class ParsedRecordsDiErrorProviderTest method shouldParseInitialRecords.

@Test
public void shouldParseInitialRecords(TestContext context) {
    Async async = context.async();
    JobExecution jobExecution = new JobExecution().withId(JOB_EXECUTION_ID);
    when(jobExecutionService.getJobExecutionById(JOB_EXECUTION_ID, TENANT_ID)).thenReturn(Future.succeededFuture(Optional.of(jobExecution)));
    RawRecordsDto rawRecordsDto = new RawRecordsDto().withInitialRecords(Lists.newArrayList(new InitialRecord())).withRecordsMetadata(new RecordsMetadata().withContentType(RecordsMetadata.ContentType.MARC_JSON));
    when(changeEngineService.getParsedRecordsFromInitialRecords(eq(rawRecordsDto.getInitialRecords()), eq(rawRecordsDto.getRecordsMetadata().getContentType()), eq(jobExecution), anyString())).thenReturn(Lists.newArrayList(new Record().withParsedRecord(new ParsedRecord())));
    Future<List<Record>> parserRecordsFuture = diErrorProvider.getParsedRecordsFromInitialRecords(getOkapiParams(), JOB_EXECUTION_ID, rawRecordsDto);
    parserRecordsFuture.onComplete(ar -> {
        List<Record> parsedRecords = ar.result();
        assertEquals(1, parsedRecords.size());
        async.complete();
    });
}
Also used : JobExecution(org.folio.rest.jaxrs.model.JobExecution) InitialRecord(org.folio.rest.jaxrs.model.InitialRecord) Async(io.vertx.ext.unit.Async) RawRecordsDto(org.folio.rest.jaxrs.model.RawRecordsDto) RecordsMetadata(org.folio.rest.jaxrs.model.RecordsMetadata) InitialRecord(org.folio.rest.jaxrs.model.InitialRecord) Record(org.folio.rest.jaxrs.model.Record) ParsedRecord(org.folio.rest.jaxrs.model.ParsedRecord) List(java.util.List) ParsedRecord(org.folio.rest.jaxrs.model.ParsedRecord) Test(org.junit.Test)

Example 3 with InitialRecord

use of org.folio.rest.jaxrs.model.InitialRecord in project mod-source-record-manager by folio-org.

the class RecordProcessedEventHandlingServiceImplTest method shouldMarkJobExecutionAsErrorOnHandleDIErrorEventWhenAllRecordsProcessed.

@Test
public void shouldMarkJobExecutionAsErrorOnHandleDIErrorEventWhenAllRecordsProcessed(TestContext context) {
    // given
    Async async = context.async();
    RawRecordsDto rawRecordsDto = new RawRecordsDto().withInitialRecords(Collections.singletonList(new InitialRecord().withRecord(CORRECT_RAW_RECORD))).withRecordsMetadata(new RecordsMetadata().withLast(true).withCounter(2).withTotal(2).withContentType(RecordsMetadata.ContentType.MARC_RAW));
    HashMap<String, String> payloadContext = new HashMap<>();
    DataImportEventPayload datImpErrorEventPayload = new DataImportEventPayload().withEventType(DataImportEventTypes.DI_ERROR.value()).withContext(payloadContext);
    DataImportEventPayload datImpCompletedEventPayload = new DataImportEventPayload().withEventType(DataImportEventTypes.DI_COMPLETED.value()).withContext(payloadContext);
    Future<Boolean> future = jobExecutionService.initializeJobExecutions(initJobExecutionsRqDto, params).compose(initJobExecutionsRsDto -> jobExecutionService.setJobProfileToJobExecution(initJobExecutionsRsDto.getParentJobExecutionId(), jobProfileInfo, params)).map(jobExecution -> {
        datImpErrorEventPayload.withJobExecutionId(jobExecution.getId());
        return datImpCompletedEventPayload.withJobExecutionId(jobExecution.getId());
    }).compose(ar -> chunkProcessingService.processChunk(rawRecordsDto, datImpErrorEventPayload.getJobExecutionId(), params));
    // when
    Future<Optional<JobExecution>> jobFuture = future.compose(ar -> recordProcessedEventHandlingService.handle(Json.encode(datImpErrorEventPayload), params)).compose(ar -> recordProcessedEventHandlingService.handle(Json.encode(datImpCompletedEventPayload), params)).compose(ar -> jobExecutionService.getJobExecutionById(datImpCompletedEventPayload.getJobExecutionId(), TENANT_ID));
    // then
    jobFuture.onComplete(ar -> {
        context.assertTrue(ar.succeeded());
        context.assertTrue(ar.result().isPresent());
        JobExecution jobExecution = ar.result().get();
        context.assertEquals(ERROR, jobExecution.getStatus());
        context.assertEquals(JobExecution.UiStatus.ERROR, jobExecution.getUiStatus());
        context.assertEquals(rawRecordsDto.getRecordsMetadata().getTotal(), jobExecution.getProgress().getTotal());
        context.assertNotNull(jobExecution.getStartedDate());
        context.assertNotNull(jobExecution.getCompletedDate());
        verify(2, putRequestedFor(new UrlPathPattern(new RegexPattern(SNAPSHOT_SERVICE_URL + "/.*"), true)));
        async.complete();
    });
}
Also used : TestContext(io.vertx.ext.unit.TestContext) MappingParametersProvider(org.folio.services.mappers.processor.MappingParametersProvider) JobMonitoringDaoImpl(org.folio.dao.JobMonitoringDaoImpl) JournalServiceImpl(org.folio.services.journal.JournalServiceImpl) MockitoAnnotations(org.mockito.MockitoAnnotations) MarcRecordAnalyzer(org.folio.dataimport.util.marc.MarcRecordAnalyzer) JobProfileInfo(org.folio.rest.jaxrs.model.JobProfileInfo) JobExecution(org.folio.rest.jaxrs.model.JobExecution) Spy(org.mockito.Spy) JsonObject(io.vertx.core.json.JsonObject) MappingRuleDaoImpl(org.folio.dao.MappingRuleDaoImpl) WireMock.post(com.github.tomakehurst.wiremock.client.WireMock.post) ERROR(org.folio.rest.jaxrs.model.JobExecution.Status.ERROR) InitialRecord(org.folio.rest.jaxrs.model.InitialRecord) MappingRulesSnapshotDaoImpl(org.folio.dao.MappingRulesSnapshotDaoImpl) DataImportEventPayload(org.folio.DataImportEventPayload) UUID(java.util.UUID) Future(io.vertx.core.Future) OkapiConnectionParams(org.folio.dataimport.util.OkapiConnectionParams) MarcImportEventsHandler(org.folio.verticle.consumers.util.MarcImportEventsHandler) Optional(java.util.Optional) AbstractRestTest(org.folio.rest.impl.AbstractRestTest) JobExecutionSourceChunkDaoImpl(org.folio.dao.JobExecutionSourceChunkDaoImpl) RunTestOnContext(io.vertx.ext.unit.junit.RunTestOnContext) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Async(io.vertx.ext.unit.Async) Json(io.vertx.core.json.Json) OKAPI_TENANT_HEADER(org.folio.rest.util.OkapiConnectionParams.OKAPI_TENANT_HEADER) RegexPattern(com.github.tomakehurst.wiremock.matching.RegexPattern) RunWith(org.junit.runner.RunWith) PARSING_IN_PROGRESS(org.folio.rest.jaxrs.model.JobExecution.Status.PARSING_IN_PROGRESS) HashMap(java.util.HashMap) RecordsMetadata(org.folio.rest.jaxrs.model.RecordsMetadata) OKAPI_URL_HEADER(org.folio.dataimport.util.RestUtil.OKAPI_URL_HEADER) HrIdFieldServiceImpl(org.folio.services.afterprocessing.HrIdFieldServiceImpl) JobExecutionProgressServiceImpl(org.folio.services.progress.JobExecutionProgressServiceImpl) WireMock.ok(com.github.tomakehurst.wiremock.client.WireMock.ok) WireMock(com.github.tomakehurst.wiremock.client.WireMock) PostgresClientFactory(org.folio.dao.util.PostgresClientFactory) DataType(org.folio.rest.jaxrs.model.JobProfileInfo.DataType) TestUtil(org.folio.TestUtil) InitJobExecutionsRqDto(org.folio.rest.jaxrs.model.InitJobExecutionsRqDto) MappingParameters(org.folio.processing.mapping.defaultmapper.processor.parameters.MappingParameters) Before(org.junit.Before) WireMock.get(com.github.tomakehurst.wiremock.client.WireMock.get) InjectMocks(org.mockito.InjectMocks) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern) JobExecutionProgressDaoImpl(org.folio.dao.JobExecutionProgressDaoImpl) RUNNING_COMPLETE(org.folio.rest.jaxrs.model.JobExecution.UiStatus.RUNNING_COMPLETE) Vertx(io.vertx.core.Vertx) ReflectionTestUtils(org.springframework.test.util.ReflectionTestUtils) IOException(java.io.IOException) Test(org.junit.Test) COMMITTED(org.folio.rest.jaxrs.model.JobExecution.Status.COMMITTED) Mockito.when(org.mockito.Mockito.when) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) MappingParamsSnapshotDaoImpl(org.folio.dao.MappingParamsSnapshotDaoImpl) WireMock.verify(com.github.tomakehurst.wiremock.client.WireMock.verify) WireMock.putRequestedFor(com.github.tomakehurst.wiremock.client.WireMock.putRequestedFor) RawRecordsDto(org.folio.rest.jaxrs.model.RawRecordsDto) JsonArray(io.vertx.core.json.JsonArray) JobExecutionProgress(org.folio.rest.jaxrs.model.JobExecutionProgress) Rule(org.junit.Rule) WireMock.created(com.github.tomakehurst.wiremock.client.WireMock.created) File(org.folio.rest.jaxrs.model.File) JobExecutionDaoImpl(org.folio.dao.JobExecutionDaoImpl) DataImportEventTypes(org.folio.rest.jaxrs.model.DataImportEventTypes) OKAPI_TOKEN_HEADER(org.folio.rest.util.OkapiConnectionParams.OKAPI_TOKEN_HEADER) Collections(java.util.Collections) JournalRecordDaoImpl(org.folio.dao.JournalRecordDaoImpl) KafkaConfig(org.folio.kafka.KafkaConfig) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) InitialRecord(org.folio.rest.jaxrs.model.InitialRecord) Optional(java.util.Optional) HashMap(java.util.HashMap) RegexPattern(com.github.tomakehurst.wiremock.matching.RegexPattern) RawRecordsDto(org.folio.rest.jaxrs.model.RawRecordsDto) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) DataImportEventPayload(org.folio.DataImportEventPayload) JobExecution(org.folio.rest.jaxrs.model.JobExecution) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern) Async(io.vertx.ext.unit.Async) RecordsMetadata(org.folio.rest.jaxrs.model.RecordsMetadata) AbstractRestTest(org.folio.rest.impl.AbstractRestTest) Test(org.junit.Test)

Example 4 with InitialRecord

use of org.folio.rest.jaxrs.model.InitialRecord in project mod-source-record-manager by folio-org.

the class EventDrivenChunkProcessingServiceImplTest method shouldProcessErrorRawRecord.

@Test
public void shouldProcessErrorRawRecord(TestContext context) {
    Async async = context.async();
    RawRecordsDto rawRecordsDto = new RawRecordsDto().withRecordsMetadata(new RecordsMetadata().withLast(false).withCounter(1).withContentType(RecordsMetadata.ContentType.MARC_RAW)).withInitialRecords(Collections.singletonList(new InitialRecord().withRecord(RAW_RECORD_RESULTING_IN_PARSING_ERROR)));
    Future<Boolean> future = jobExecutionService.initializeJobExecutions(initJobExecutionsRqDto, params).compose(initJobExecutionsRsDto -> jobExecutionService.setJobProfileToJobExecution(initJobExecutionsRsDto.getParentJobExecutionId(), jobProfileInfo, params)).compose(jobExecution -> chunkProcessingService.processChunk(rawRecordsDto, jobExecution.getId(), params));
    future.onComplete(ar -> {
        context.assertTrue(ar.succeeded());
        ArgumentCaptor<StatusDto> captor = ArgumentCaptor.forClass(StatusDto.class);
        Mockito.verify(jobExecutionService, times(1)).updateJobExecutionStatus(anyString(), captor.capture(), isA(OkapiConnectionParams.class));
        context.assertTrue(PARSING_IN_PROGRESS.equals(captor.getAllValues().get(0).getStatus()));
        verify(1, postRequestedFor(urlEqualTo(SNAPSHOT_SERVICE_URL)));
        async.complete();
    });
}
Also used : TestContext(io.vertx.ext.unit.TestContext) MappingParametersProvider(org.folio.services.mappers.processor.MappingParametersProvider) Arrays(java.util.Arrays) JobMonitoringDaoImpl(org.folio.dao.JobMonitoringDaoImpl) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) MockitoAnnotations(org.mockito.MockitoAnnotations) MarcRecordAnalyzer(org.folio.dataimport.util.marc.MarcRecordAnalyzer) JobExecution(org.folio.rest.jaxrs.model.JobExecution) JobProfileInfo(org.folio.rest.jaxrs.model.JobProfileInfo) After(org.junit.After) Spy(org.mockito.Spy) JsonObject(io.vertx.core.json.JsonObject) MappingRuleDaoImpl(org.folio.dao.MappingRuleDaoImpl) WireMock.post(com.github.tomakehurst.wiremock.client.WireMock.post) InitialRecord(org.folio.rest.jaxrs.model.InitialRecord) StatusDto(org.folio.rest.jaxrs.model.StatusDto) MappingRulesSnapshotDaoImpl(org.folio.dao.MappingRulesSnapshotDaoImpl) WireMock.put(com.github.tomakehurst.wiremock.client.WireMock.put) UUID(java.util.UUID) Future(io.vertx.core.Future) OkapiConnectionParams(org.folio.dataimport.util.OkapiConnectionParams) Optional(java.util.Optional) AbstractRestTest(org.folio.rest.impl.AbstractRestTest) JobExecutionSourceChunkDaoImpl(org.folio.dao.JobExecutionSourceChunkDaoImpl) RunTestOnContext(io.vertx.ext.unit.junit.RunTestOnContext) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Async(io.vertx.ext.unit.Async) OKAPI_TENANT_HEADER(org.folio.rest.util.OkapiConnectionParams.OKAPI_TENANT_HEADER) RegexPattern(com.github.tomakehurst.wiremock.matching.RegexPattern) Record(org.folio.Record) RunWith(org.junit.runner.RunWith) RecordsMetadata(org.folio.rest.jaxrs.model.RecordsMetadata) HashMap(java.util.HashMap) WireMock.postRequestedFor(com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor) HrIdFieldServiceImpl(org.folio.services.afterprocessing.HrIdFieldServiceImpl) JobExecutionProgressServiceImpl(org.folio.services.progress.JobExecutionProgressServiceImpl) OKAPI_URL_HEADER(org.folio.dataimport.util.RestUtil.OKAPI_URL_HEADER) WireMock.ok(com.github.tomakehurst.wiremock.client.WireMock.ok) WireMock(com.github.tomakehurst.wiremock.client.WireMock) PostgresClientFactory(org.folio.dao.util.PostgresClientFactory) DataType(org.folio.rest.jaxrs.model.JobProfileInfo.DataType) ArgumentCaptor(org.mockito.ArgumentCaptor) TestUtil(org.folio.TestUtil) InitJobExecutionsRqDto(org.folio.rest.jaxrs.model.InitJobExecutionsRqDto) MappingParameters(org.folio.processing.mapping.defaultmapper.processor.parameters.MappingParameters) Before(org.junit.Before) ArgumentMatchers.isA(org.mockito.ArgumentMatchers.isA) InjectMocks(org.mockito.InjectMocks) WireMock.get(com.github.tomakehurst.wiremock.client.WireMock.get) WireMock.urlPathEqualTo(com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern) JobExecutionProgressDaoImpl(org.folio.dao.JobExecutionProgressDaoImpl) Vertx(io.vertx.core.Vertx) ReflectionTestUtils(org.springframework.test.util.ReflectionTestUtils) Test(org.junit.Test) IOException(java.io.IOException) Mockito.times(org.mockito.Mockito.times) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) MappingParamsSnapshotDaoImpl(org.folio.dao.MappingParamsSnapshotDaoImpl) Mockito.when(org.mockito.Mockito.when) WireMock.verify(com.github.tomakehurst.wiremock.client.WireMock.verify) RawRecordsDto(org.folio.rest.jaxrs.model.RawRecordsDto) Mockito(org.mockito.Mockito) Rule(org.junit.Rule) File(org.folio.rest.jaxrs.model.File) WireMock.created(com.github.tomakehurst.wiremock.client.WireMock.created) JobExecutionDaoImpl(org.folio.dao.JobExecutionDaoImpl) PARSING_IN_PROGRESS(org.folio.rest.jaxrs.model.StatusDto.Status.PARSING_IN_PROGRESS) OKAPI_TOKEN_HEADER(org.folio.rest.util.OkapiConnectionParams.OKAPI_TOKEN_HEADER) WireMock.urlEqualTo(com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo) Collections(java.util.Collections) JournalRecordDaoImpl(org.folio.dao.JournalRecordDaoImpl) KafkaConfig(org.folio.kafka.KafkaConfig) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) StatusDto(org.folio.rest.jaxrs.model.StatusDto) InitialRecord(org.folio.rest.jaxrs.model.InitialRecord) Async(io.vertx.ext.unit.Async) RawRecordsDto(org.folio.rest.jaxrs.model.RawRecordsDto) RecordsMetadata(org.folio.rest.jaxrs.model.RecordsMetadata) OkapiConnectionParams(org.folio.dataimport.util.OkapiConnectionParams) AbstractRestTest(org.folio.rest.impl.AbstractRestTest) Test(org.junit.Test)

Example 5 with InitialRecord

use of org.folio.rest.jaxrs.model.InitialRecord in project mod-source-record-manager by folio-org.

the class ChangeEngineServiceImpl method parseRecords.

/**
 * Parse list of source records
 *
 * @param rawRecords    - list of raw records for parsing
 * @param jobExecution  - job execution of record's parsing
 * @param sourceChunkId - id of the JobExecutionSourceChunk
 * @param tenantId      - tenant id
 * @return - list of records with parsed or error data
 */
private Future<List<Record>> parseRecords(List<InitialRecord> rawRecords, RecordsMetadata.ContentType recordContentType, JobExecution jobExecution, String sourceChunkId, String tenantId, OkapiConnectionParams okapiParams) {
    if (CollectionUtils.isEmpty(rawRecords)) {
        return Future.succeededFuture(Collections.emptyList());
    }
    var counter = new MutableInt();
    // if number of records is more than THRESHOLD_CHUNK_SIZE update the progress every 20% of processed records,
    // otherwise update it once after all the records are processed
    int partition = rawRecords.size() > THRESHOLD_CHUNK_SIZE ? rawRecords.size() / 5 : rawRecords.size();
    var records = getParsedRecordsFromInitialRecords(rawRecords, recordContentType, jobExecution, sourceChunkId).stream().peek(stat -> {
        // NOSONAR
        if (counter.incrementAndGet() % partition == 0) {
            LOGGER.info("Parsed {} records out of {}", counter.intValue(), rawRecords.size());
            jobExecutionSourceChunkDao.getById(sourceChunkId, tenantId).compose(optional -> optional.map(sourceChunk -> jobExecutionSourceChunkDao.update(sourceChunk.withProcessedAmount(sourceChunk.getProcessedAmount() + counter.intValue()), tenantId)).orElseThrow(() -> new NotFoundException(format("Couldn't update jobExecutionSourceChunk progress, jobExecutionSourceChunk with id %s was not found", sourceChunkId))));
        }
    }).collect(Collectors.toList());
    Promise<List<Record>> promise = Promise.promise();
    List<Future> listFuture = executeInBatches(records, batch -> verifyMarcHoldings004Field(batch, okapiParams));
    filterMarcHoldingsBy004Field(records, listFuture, okapiParams, jobExecution, promise);
    return promise.future();
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) MutableInt(org.apache.commons.lang3.mutable.MutableInt) TAG_999(org.folio.services.afterprocessing.AdditionalFieldsUtil.TAG_999) Autowired(org.springframework.beans.factory.annotation.Autowired) RecordAnalyzer(org.folio.dataimport.util.marc.RecordAnalyzer) MARC_HOLDING(org.folio.rest.jaxrs.model.Record.RecordType.MARC_HOLDING) RecordType(org.folio.rest.jaxrs.model.Record.RecordType) ProfileSnapshotWrapper(org.folio.rest.jaxrs.model.ProfileSnapshotWrapper) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) MarcRecordAnalyzer(org.folio.dataimport.util.marc.MarcRecordAnalyzer) Map(java.util.Map) JobExecutionSourceChunkDao(org.folio.dao.JobExecutionSourceChunkDao) JobExecution(org.folio.rest.jaxrs.model.JobExecution) RecordParserBuilder(org.folio.services.parsers.RecordParserBuilder) JsonObject(io.vertx.core.json.JsonObject) DI_ERROR(org.folio.rest.jaxrs.model.DataImportEventTypes.DI_ERROR) AdditionalFieldsUtil.getValue(org.folio.services.afterprocessing.AdditionalFieldsUtil.getValue) InitialRecord(org.folio.rest.jaxrs.model.InitialRecord) StatusDto(org.folio.rest.jaxrs.model.StatusDto) MODULE_SPECIFIC_ARGS(org.folio.rest.RestVerticle.MODULE_SPECIFIC_ARGS) AdditionalFieldsUtil.getControlFieldValue(org.folio.services.afterprocessing.AdditionalFieldsUtil.getControlFieldValue) Collection(java.util.Collection) EventHandlingUtil.sendEventToKafka(org.folio.services.util.EventHandlingUtil.sendEventToKafka) UUID(java.util.UUID) JobExecutionSourceChunk(org.folio.rest.jaxrs.model.JobExecutionSourceChunk) RecordCollection(org.folio.rest.jaxrs.model.RecordCollection) Collectors(java.util.stream.Collectors) Future(io.vertx.core.Future) String.format(java.lang.String.format) NotFoundException(javax.ws.rs.NotFoundException) OkapiConnectionParams(org.folio.dataimport.util.OkapiConnectionParams) KafkaHeaderImpl(io.vertx.kafka.client.producer.impl.KafkaHeaderImpl) FolioRecord(org.folio.rest.jaxrs.model.ActionProfile.FolioRecord) Objects(java.util.Objects) List(java.util.List) StringUtils.isNotBlank(org.apache.commons.lang3.StringUtils.isNotBlank) Logger(org.apache.logging.log4j.Logger) DI_MARC_FOR_UPDATE_RECEIVED(org.folio.rest.jaxrs.model.DataImportEventTypes.DI_MARC_FOR_UPDATE_RECEIVED) KafkaHeaderUtils(org.folio.kafka.KafkaHeaderUtils) ParsedRecord(org.folio.rest.jaxrs.model.ParsedRecord) HrIdFieldService(org.folio.services.afterprocessing.HrIdFieldService) Json(io.vertx.core.json.Json) DI_RAW_RECORDS_CHUNK_PARSED(org.folio.rest.jaxrs.model.DataImportEventTypes.DI_RAW_RECORDS_CHUNK_PARSED) DataImportEventPayload(org.folio.rest.jaxrs.model.DataImportEventPayload) RawRecord(org.folio.rest.jaxrs.model.RawRecord) HashMap(java.util.HashMap) RecordsMetadata(org.folio.rest.jaxrs.model.RecordsMetadata) Function(java.util.function.Function) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) DI_MARC_FOR_DELETE_RECEIVED(org.folio.rest.jaxrs.model.DataImportEventTypes.DI_MARC_FOR_DELETE_RECEIVED) Value(org.springframework.beans.factory.annotation.Value) MARC_AUTHORITY(org.folio.rest.jaxrs.model.Record.RecordType.MARC_AUTHORITY) CompositeFuture(io.vertx.core.CompositeFuture) IterableUtils(org.apache.commons.collections4.IterableUtils) DataType(org.folio.rest.jaxrs.model.JobProfileInfo.DataType) Lists(com.google.common.collect.Lists) Action(org.folio.rest.jaxrs.model.ActionProfile.Action) ExternalIdsHolder(org.folio.rest.jaxrs.model.ExternalIdsHolder) Service(org.springframework.stereotype.Service) AdditionalFieldsUtil.addFieldToMarcRecord(org.folio.services.afterprocessing.AdditionalFieldsUtil.addFieldToMarcRecord) SourceStorageBatchClient(org.folio.rest.client.SourceStorageBatchClient) ActionProfile(org.folio.rest.jaxrs.model.ActionProfile) EntityType(org.folio.rest.jaxrs.model.EntityType) Record(org.folio.rest.jaxrs.model.Record) ParsedResult(org.folio.services.parsers.ParsedResult) RecordConversionUtil(org.folio.services.util.RecordConversionUtil) Promise(io.vertx.core.Promise) AdditionalFieldsUtil.hasIndicator(org.folio.services.afterprocessing.AdditionalFieldsUtil.hasIndicator) RawRecordsDto(org.folio.rest.jaxrs.model.RawRecordsDto) MARC_BIB(org.folio.rest.jaxrs.model.Record.RecordType.MARC_BIB) SUBFIELD_S(org.folio.services.afterprocessing.AdditionalFieldsUtil.SUBFIELD_S) StringUtils.isBlank(org.apache.commons.lang3.StringUtils.isBlank) ErrorRecord(org.folio.rest.jaxrs.model.ErrorRecord) SUBFIELD_I(org.folio.services.afterprocessing.AdditionalFieldsUtil.SUBFIELD_I) MarcRecordType(org.folio.dataimport.util.marc.MarcRecordType) Collections(java.util.Collections) KafkaHeader(io.vertx.kafka.client.producer.KafkaHeader) LogManager(org.apache.logging.log4j.LogManager) KafkaConfig(org.folio.kafka.KafkaConfig) MutableInt(org.apache.commons.lang3.mutable.MutableInt) NotFoundException(javax.ws.rs.NotFoundException) Future(io.vertx.core.Future) CompositeFuture(io.vertx.core.CompositeFuture) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

InitialRecord (org.folio.rest.jaxrs.model.InitialRecord)7 JobExecution (org.folio.rest.jaxrs.model.JobExecution)7 RawRecordsDto (org.folio.rest.jaxrs.model.RawRecordsDto)7 RecordsMetadata (org.folio.rest.jaxrs.model.RecordsMetadata)7 Future (io.vertx.core.Future)5 JsonObject (io.vertx.core.json.JsonObject)5 Async (io.vertx.ext.unit.Async)5 Collections (java.util.Collections)5 HashMap (java.util.HashMap)5 UUID (java.util.UUID)5 OkapiConnectionParams (org.folio.dataimport.util.OkapiConnectionParams)5 MarcRecordAnalyzer (org.folio.dataimport.util.marc.MarcRecordAnalyzer)5 KafkaConfig (org.folio.kafka.KafkaConfig)5 WireMock (com.github.tomakehurst.wiremock.client.WireMock)4 WireMock.created (com.github.tomakehurst.wiremock.client.WireMock.created)4 WireMock.get (com.github.tomakehurst.wiremock.client.WireMock.get)4 WireMock.ok (com.github.tomakehurst.wiremock.client.WireMock.ok)4 WireMock.post (com.github.tomakehurst.wiremock.client.WireMock.post)4 WireMock.verify (com.github.tomakehurst.wiremock.client.WireMock.verify)4 RegexPattern (com.github.tomakehurst.wiremock.matching.RegexPattern)4