Search in sources :

Example 1 with EntityType

use of org.folio.rest.jaxrs.model.EntityType 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 EntityType

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

the class RecordConversionUtilTest method shouldReturnMarcHolding.

@Test
public void shouldReturnMarcHolding() {
    EntityType entityType = RecordConversionUtil.getEntityType(new Record().withRecordType(Record.RecordType.MARC_HOLDING));
    assertEquals(EntityType.MARC_HOLDINGS, entityType);
}
Also used : EntityType(org.folio.rest.jaxrs.model.EntityType) Record(org.folio.rest.jaxrs.model.Record) Test(org.junit.Test)

Example 3 with EntityType

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

the class RecordConversionUtilTest method shouldReturnEdifactInvoice.

@Test
public void shouldReturnEdifactInvoice() {
    EntityType entityType = RecordConversionUtil.getEntityType(new Record().withRecordType(Record.RecordType.EDIFACT));
    assertEquals(EntityType.EDIFACT_INVOICE, entityType);
}
Also used : EntityType(org.folio.rest.jaxrs.model.EntityType) Record(org.folio.rest.jaxrs.model.Record) Test(org.junit.Test)

Example 4 with EntityType

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

the class RecordConversionUtilTest method shouldReturnMarcAuthority.

@Test
public void shouldReturnMarcAuthority() {
    EntityType entityType = RecordConversionUtil.getEntityType(new Record().withRecordType(Record.RecordType.MARC_AUTHORITY));
    assertEquals(EntityType.MARC_AUTHORITY, entityType);
}
Also used : EntityType(org.folio.rest.jaxrs.model.EntityType) Record(org.folio.rest.jaxrs.model.Record) Test(org.junit.Test)

Example 5 with EntityType

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

the class RecordConversionUtilTest method shouldReturnMarcBib.

@Test
public void shouldReturnMarcBib() {
    EntityType entityType = RecordConversionUtil.getEntityType(new Record().withRecordType(Record.RecordType.MARC_BIB));
    assertEquals(EntityType.MARC_BIBLIOGRAPHIC, entityType);
}
Also used : EntityType(org.folio.rest.jaxrs.model.EntityType) Record(org.folio.rest.jaxrs.model.Record) Test(org.junit.Test)

Aggregations

EntityType (org.folio.rest.jaxrs.model.EntityType)5 Record (org.folio.rest.jaxrs.model.Record)4 Test (org.junit.Test)4 JsonObject (io.vertx.core.json.JsonObject)1 MarcRecordType (org.folio.dataimport.util.marc.MarcRecordType)1