Commit 32ac836b authored by Thomas Bernhart's avatar Thomas Bernhart
Browse files

Remove null check from ingestBinaries

parent b97ef272
Pipeline #22050 passed with stages
in 3 minutes and 53 seconds
...@@ -92,20 +92,18 @@ class Ingester( ...@@ -92,20 +92,18 @@ class Ingester(
@Throws(FcrepoOperationFailedException::class, IOException::class, MissingMimeTypeException::class, SftpClientException::class, URISyntaxException::class) @Throws(FcrepoOperationFailedException::class, IOException::class, MissingMimeTypeException::class, SftpClientException::class, URISyntaxException::class)
private fun ingestBinaries( private fun ingestBinaries(
sftpLocators: List<Pair<String, String?>>, sftpLocators: List<Pair<String, String>>,
rdfHandler: RdfHandler, rdfHandler: RdfHandler,
transaction: FedoraTransactionClient transaction: FedoraTransactionClient
) { ) {
sftpLocators.forEach { sftpLocators.forEach {
val digitalInstantiationUrl = it.first val digitalInstantiationUrl = it.first
it.second.let { path -> it.second.let { path ->
if (path != null) { sftpClient.open(File(path)).use { stream ->
sftpClient.open(File(path)).use { stream -> val binaryUri = "$digitalInstantiationUrl/${Service.BINARY_FILE_URI_PATH}"
val binaryUri = "$digitalInstantiationUrl/${Service.BINARY_FILE_URI_PATH}" val mimeType = rdfHandler.getMimeType(digitalInstantiationUrl)
val mimeType = rdfHandler.getMimeType(digitalInstantiationUrl) log.info("Ingesting binary $binaryUri with mime type $mimeType.")
log.info("Ingesting binary $binaryUri with mime type $mimeType.") transaction.createOrUpdateBinaryResource(URI(binaryUri), stream, mimeType)
transaction.createOrUpdateBinaryResource(URI(binaryUri), stream, mimeType)
}
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment