folio-labs / folio-order-import-tool

Tool that imports a MARC record to create an order. This workaround is needed until FOLIO supports importing MARC records to create orders.
Apache License 2.0
5 stars 3 forks source link

ERROR - Could not find material type #47

Open LibraryIT opened 2 years ago

LibraryIT commented 2 years ago

I am setting up the order import tool and have run into a snag. During start up, it can't seem to find the material type set in the import.properties file. When I run start.jar, all of the checks pass except for material type:

ERROR [main] - materialType: Could not find material type by the name [physical]
ERROR [main] - FAILED TO START SERVICE: ONE OR MORE LOOKUPS OF UUIDS FOR CODES/NAMES FAILED.

The credentials are correct, the user the app runs on has the correct permissions, and the material type does exist. What am I missing? I cloned the Github repo and so should be on the latest version. Here is my import.properties file:

baseOkapiEndpoint = https://okapi-skidmore.folio.ebsco.com
okapi_username = <redacted>
okapi_password = <redacted>
tenant = fs00001051
permELocation = Electronic Resource
permLocation = On Order -- Item not yet in library
fiscalYearCode = FY2122
textForElectronicResources = Electronic Resource
noteType = General note
materialType = physical
purchaseOrderUnit = record

uploadFilePath = /var/tmp/folio-order-import

onValidationErrors = skipFailed
onIsbnInvalid = removeIsbn

tzTimeZone = America/New_York
folioUiUrl = https://skidmore.folio.ebsco.com/
maccabeelevine commented 2 years ago

Doing some triage... it looks like the app is checking the material type against a preconfigured array in Constants. https://github.com/folio-labs/folio-order-import-tool/blob/16fd746f895f4a465642f887b4f726d2609a57c2/src/main/java/org/olf/folio/order/listeners/ConfigurationCheck.java#L333

And that array doesn't include "physical" as a type.

I see that there's a method in the default MarcToFolio mapping materialTypeId() which uses that map. https://github.com/folio-labs/folio-order-import-tool/blob/f1e65fce8f021c4962273b893dc8ae04a21f70ae/src/main/java/org/olf/folio/order/mapping/MarcToFolio.java#L602

It's overridden in the sigma mapping to actually query FOLIO for possible material types. https://github.com/folio-labs/folio-order-import-tool/blob/f1e65fce8f021c4962273b893dc8ae04a21f70ae/src/main/java/org/olf/folio/order/mapping/MarcMapSigma.java#L58

But a) you're using the default (chi) mapping and b) that function doesn't seem to be used in the initial validation check, possibly for good reason.

@nielserik expertise probably needed here.

LibraryIT commented 2 years ago

"Physical" is one of our material types. Is it fair to say if we set the material type to something in the list, the app will complete the check?

EDIT: I set the material type to "unspecified" and was able to pass the check.