Commit 3065d8e5 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Replace constant strings with constant vals

parent d7c7682c
...@@ -37,6 +37,7 @@ import org.memobase.helpers.Filter ...@@ -37,6 +37,7 @@ import org.memobase.helpers.Filter
import org.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractInstitution import org.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractInstitution
import org.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractRecordSet import org.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractRecordSet
import org.memobase.helpers.Constants import org.memobase.helpers.Constants
import org.memobase.helpers.JsonUtility
import org.memobase.helpers.TranslationMappers import org.memobase.helpers.TranslationMappers
import org.memobase.model.DocumentsSearchDoc import org.memobase.model.DocumentsSearchDoc
import org.memobase.model.EnrichedDigitalMetadata import org.memobase.model.EnrichedDigitalMetadata
...@@ -53,7 +54,7 @@ class DocumentsSearchDocBuilder( ...@@ -53,7 +54,7 @@ class DocumentsSearchDocBuilder(
fun transform(key: String, input: Map<String, JsonObject>): Schema { fun transform(key: String, input: Map<String, JsonObject>): Schema {
val record = input["record"] ?: throw InvalidInputException("No record defined in the message.") val record = input[JsonUtility.recordTag] ?: throw InvalidInputException("No record defined in the message.")
val digitalObject = val digitalObject =
input.values.firstOrNull { it["@type"] == NS.rico + "Instantiation" && it["type"] == "digitalObject" } input.values.firstOrNull { it["@type"] == NS.rico + "Instantiation" && it["type"] == "digitalObject" }
val physicalObject = val physicalObject =
......
...@@ -27,6 +27,7 @@ import org.memobase.helpers.Date ...@@ -27,6 +27,7 @@ import org.memobase.helpers.Date
import org.memobase.helpers.ElasticSearchWrapper import org.memobase.helpers.ElasticSearchWrapper
import org.memobase.helpers.Extract import org.memobase.helpers.Extract
import org.memobase.helpers.Constants import org.memobase.helpers.Constants
import org.memobase.helpers.JsonUtility
import org.memobase.helpers.TranslationMappers import org.memobase.helpers.TranslationMappers
import org.memobase.model.FacetContainer import org.memobase.model.FacetContainer
import org.memobase.model.InstitutionSearchDoc import org.memobase.model.InstitutionSearchDoc
...@@ -42,7 +43,7 @@ class InstitutionSearchDocBuilder( ...@@ -42,7 +43,7 @@ class InstitutionSearchDocBuilder(
fun transform(key: String, input: Map<String, JsonObject>): Schema { fun transform(key: String, input: Map<String, JsonObject>): Schema {
val institution = val institution =
input["institution"] ?: throw InvalidInputException("No institution entity found in message $key.") input[JsonUtility.institutionTag] ?: throw InvalidInputException("No institution entity found in message $key.")
val identifiers = mutableListOf<JsonObject>() val identifiers = mutableListOf<JsonObject>()
val cantons = mutableListOf<FacetContainer>() val cantons = mutableListOf<FacetContainer>()
val municipalities = mutableListOf<LanguageContainer>() val municipalities = mutableListOf<LanguageContainer>()
......
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