Search in sources :

Example 1 with MarcRecordType

use of org.folio.dataimport.util.marc.MarcRecordType in project mod-source-record-manager by folio-org.

the class DataImportPayloadContextBuilderImpl method getEntityType.

private EntityType getEntityType(Record marcRecord) {
    requireNonNull(marcRecord.getParsedRecord(), "Parsed record is null");
    requireNonNull(marcRecord.getParsedRecord().getContent(), "Parsed record content is null");
    MarcRecordType type = analyzer.process(new JsonObject(marcRecord.getParsedRecord().getContent().toString()));
    EntityType entityType = MARC_TO_ENTITY_TYPE.get(type);
    if (entityType == null) {
        throw new IllegalStateException("Unsupported Marc record type");
    }
    return entityType;
}
Also used : EntityType(org.folio.rest.jaxrs.model.EntityType) MarcRecordType(org.folio.dataimport.util.marc.MarcRecordType) JsonObject(io.vertx.core.json.JsonObject)

Example 2 with MarcRecordType

use of org.folio.dataimport.util.marc.MarcRecordType in project mod-source-record-manager by folio-org.

the class ChangeEngineServiceImpl method inferRecordType.

private RecordType inferRecordType(JobExecution jobExecution, ParsedResult recordParsedResult, String recordId, String chunkId) {
    if (Objects.equals(jobExecution.getJobProfileInfo().getDataType(), DataType.MARC)) {
        MarcRecordType marcRecordType = marcRecordAnalyzer.process(recordParsedResult.getParsedRecord());
        checkLeaderLine(marcRecordType, recordParsedResult, jobExecution, recordId, chunkId);
        return MarcRecordType.NA == marcRecordType ? null : RecordType.valueOf(MARC_FORMAT + marcRecordType.name());
    }
    return RecordType.valueOf(jobExecution.getJobProfileInfo().getDataType().value());
}
Also used : MarcRecordType(org.folio.dataimport.util.marc.MarcRecordType)

Aggregations

MarcRecordType (org.folio.dataimport.util.marc.MarcRecordType)2 JsonObject (io.vertx.core.json.JsonObject)1 EntityType (org.folio.rest.jaxrs.model.EntityType)1