Commit 8bbb8927 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Refactor org.memobase to ch.memobase

parent 11497cb3
Pipeline #26593 passed with stages
in 4 minutes and 31 seconds
...@@ -6,12 +6,12 @@ plugins { ...@@ -6,12 +6,12 @@ plugins {
id 'org.jlleitschuh.gradle.ktlint' version '9.2.1' id 'org.jlleitschuh.gradle.ktlint' version '9.2.1'
} }
group 'org.memobase' group 'ch.memobase'
mainClassName = 'org.memobase.App' mainClassName = 'ch.memobase.App'
jar { jar {
manifest { manifest {
attributes 'Main-Class': 'org.memobase.App' attributes 'Main-Class': 'ch.memobase.App'
} }
} }
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase package ch.memobase
import ch.memobase.settings.SettingsLoader import ch.memobase.settings.SettingsLoader
import kotlin.system.exitProcess import kotlin.system.exitProcess
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.helpers.Constants.SettingsProps import ch.memobase.helpers.Constants.SettingsProps
class App { class App {
companion object { companion object {
......
...@@ -16,35 +16,36 @@ ...@@ -16,35 +16,36 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase package ch.memobase
import ch.memobase.rdf.NS import ch.memobase.rdf.NS
import ch.memobase.rdf.RICO import ch.memobase.rdf.RICO
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.builders.AgentContainerBuilder import ch.memobase.builders.AgentContainerBuilder
import org.memobase.builders.DateContainerBuilder import ch.memobase.builders.DateContainerBuilder
import org.memobase.builders.EnrichedFacetContainerBuilder import ch.memobase.builders.EnrichedFacetContainerBuilder
import org.memobase.builders.FacettedContainerBuilder import ch.memobase.builders.FacettedContainerBuilder
import org.memobase.builders.IFieldBuilder import ch.memobase.builders.IFieldBuilder
import org.memobase.builders.PersonFacetBuilder import ch.memobase.builders.PersonFacetBuilder
import org.memobase.builders.PlaceFacetBuilder import ch.memobase.builders.PlaceFacetBuilder
import org.memobase.builders.SuggestContainerBuilder import ch.memobase.builders.SuggestContainerBuilder
import org.memobase.helpers.AspectRatio import ch.memobase.helpers.AspectRatio
import org.memobase.helpers.Constants import ch.memobase.helpers.Constants
import org.memobase.helpers.ElasticSearchWrapper import ch.memobase.helpers.ElasticSearchWrapper
import org.memobase.helpers.Extract import ch.memobase.helpers.Extract
import org.memobase.helpers.FacetBuildHelpers import ch.memobase.helpers.FacetBuildHelpers
import org.memobase.helpers.Filter import ch.memobase.helpers.Filter
import org.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractInstitution import ch.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractInstitution
import org.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractRecordSet import ch.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractRecordSet
import org.memobase.helpers.JsonUtility import ch.memobase.helpers.JsonUtility
import org.memobase.helpers.TranslationMappers import ch.memobase.helpers.TranslationMappers
import org.memobase.model.DocumentsSearchDoc import ch.memobase.model.DocumentsSearchDoc
import org.memobase.model.EnrichedDigitalMetadata import ch.memobase.helpers.Constants.IdentifierType
import org.memobase.model.FacetContainer import ch.memobase.model.EnrichedDigitalMetadata
import org.memobase.model.LanguageContainer import ch.memobase.model.FacetContainer
import org.memobase.model.Schema import ch.memobase.model.LanguageContainer
import ch.memobase.model.Schema
class DocumentsSearchDocBuilder( class DocumentsSearchDocBuilder(
private val translationMappers: TranslationMappers, private val translationMappers: TranslationMappers,
...@@ -232,13 +233,13 @@ class DocumentsSearchDocBuilder( ...@@ -232,13 +233,13 @@ class DocumentsSearchDocBuilder(
broadcastTitle = Extract.typedEntityByType(recordTitles, "type", "broadcast", "title"), broadcastTitle = Extract.typedEntityByType(recordTitles, "type", "broadcast", "title"),
type = type, type = type,
sourceID = try { sourceID = try {
Extract.extractIdValue(recordIdentifiers, Constants.IdentifierType.original) ?: "NoSourceIdFound" Extract.extractIdValue(recordIdentifiers, IdentifierType.original) ?: "NoSourceIdFound"
} catch (ex: NoSuchElementException) { } catch (ex: NoSuchElementException) {
log.error("No source id found for record $key.") log.error("No source id found for record $key.")
"NoSourceIdFound" "NoSourceIdFound"
}, },
oldMemobaseId = try { oldMemobaseId = try {
Extract.extractIdValue(recordIdentifiers, Constants.IdentifierType.oldMemobase) ?: "" Extract.extractIdValue(recordIdentifiers, IdentifierType.oldMemobase) ?: ""
} catch (ex: NoSuchElementException) { } catch (ex: NoSuchElementException) {
log.warn("No old memobase id found for record $key.") log.warn("No old memobase id found for record $key.")
"" ""
......
...@@ -16,23 +16,24 @@ ...@@ -16,23 +16,24 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase package ch.memobase
import ch.memobase.rdf.MB import ch.memobase.rdf.MB
import ch.memobase.rdf.NS import ch.memobase.rdf.NS
import com.beust.klaxon.JsonArray import com.beust.klaxon.JsonArray
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.helpers.Date import ch.memobase.helpers.Date
import org.memobase.helpers.ElasticSearchWrapper import ch.memobase.helpers.ElasticSearchWrapper
import org.memobase.helpers.Extract import ch.memobase.helpers.Extract
import org.memobase.helpers.Constants import ch.memobase.helpers.Constants
import org.memobase.helpers.JsonUtility import ch.memobase.helpers.JsonUtility
import org.memobase.helpers.TranslationMappers import ch.memobase.helpers.TranslationMappers
import org.memobase.model.FacetContainer import ch.memobase.model.FacetContainer
import org.memobase.model.InstitutionSearchDoc import ch.memobase.model.InstitutionSearchDoc
import org.memobase.model.LanguageContainer import ch.memobase.helpers.Constants.QueryFields
import org.memobase.model.Schema import ch.memobase.model.LanguageContainer
import ch.memobase.model.Schema
class InstitutionSearchDocBuilder( class InstitutionSearchDocBuilder(
...@@ -103,7 +104,7 @@ class InstitutionSearchDocBuilder( ...@@ -103,7 +104,7 @@ class InstitutionSearchDocBuilder(
documentType = recordSetIds.flatMap { documentType = recordSetIds.flatMap {
elasticSearchWrapper.getDocumentTypesFromRecords( elasticSearchWrapper.getDocumentTypesFromRecords(
it, it,
Constants.QueryFields.recordSetFacet QueryFields.recordSetFacet
) )
}.distinctBy { it.filter }, }.distinctBy { it.filter },
keyVisualLink = institution[Constants.wikidataImage].let { if (it != null) it as String else "NoKeyVisualLinkDefined" }, keyVisualLink = institution[Constants.wikidataImage].let { if (it != null) it as String else "NoKeyVisualLinkDefined" },
......
...@@ -15,6 +15,6 @@ ...@@ -15,6 +15,6 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase package ch.memobase
class InvalidInputException(message: String) : Exception(message) class InvalidInputException(message: String) : Exception(message)
\ No newline at end of file
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase package ch.memobase
import ch.memobase.reporting.Report import ch.memobase.reporting.Report
import ch.memobase.reporting.ReportStatus import ch.memobase.reporting.ReportStatus
...@@ -30,17 +30,17 @@ import org.apache.kafka.streams.Topology ...@@ -30,17 +30,17 @@ import org.apache.kafka.streams.Topology
import org.apache.kafka.streams.kstream.KStream import org.apache.kafka.streams.kstream.KStream
import org.apache.kafka.streams.kstream.Predicate import org.apache.kafka.streams.kstream.Predicate
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.helpers.Constants.SettingsProps import ch.memobase.helpers.Constants.SettingsProps
import org.memobase.helpers.ElasticSearchWrapper import ch.memobase.helpers.ElasticSearchWrapper
import org.memobase.helpers.JsonUtility import ch.memobase.helpers.JsonUtility
import org.memobase.helpers.TranslationMappers import ch.memobase.helpers.TranslationMappers
import org.memobase.helpers.UpdateQueryBuilder import ch.memobase.helpers.UpdateQueryBuilder
import org.memobase.model.DocumentsSearchDoc import ch.memobase.model.DocumentsSearchDoc
import org.memobase.model.FacetContainer import ch.memobase.model.FacetContainer
import org.memobase.model.InstitutionSearchDoc import ch.memobase.model.InstitutionSearchDoc
import org.memobase.model.RecordSetSearchDoc import ch.memobase.model.RecordSetSearchDoc
import org.memobase.model.Schema import ch.memobase.model.Schema
import org.memobase.model.UpdateQuery import ch.memobase.model.UpdateQuery
class KafkaTopology( class KafkaTopology(
private val settings: SettingsLoader, private val settings: SettingsLoader,
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase package ch.memobase
import ch.memobase.rdf.DC import ch.memobase.rdf.DC
import ch.memobase.rdf.MB import ch.memobase.rdf.MB
...@@ -27,16 +27,17 @@ import ch.memobase.rdf.RICO.Types.RecordSet ...@@ -27,16 +27,17 @@ import ch.memobase.rdf.RICO.Types.RecordSet
import com.beust.klaxon.JsonArray import com.beust.klaxon.JsonArray
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.helpers.Date import ch.memobase.helpers.Date
import org.memobase.helpers.ElasticSearchWrapper import ch.memobase.helpers.ElasticSearchWrapper
import org.memobase.helpers.Extract import ch.memobase.helpers.Extract
import org.memobase.helpers.JsonUtility import ch.memobase.helpers.JsonUtility
import org.memobase.helpers.Constants import ch.memobase.helpers.Constants
import org.memobase.model.FacetContainer import ch.memobase.model.FacetContainer
import org.memobase.model.IntegerRange import ch.memobase.model.IntegerRange
import org.memobase.model.LanguageContainer import ch.memobase.model.LanguageContainer
import org.memobase.model.RecordSetSearchDoc import ch.memobase.model.RecordSetSearchDoc
import org.memobase.model.Schema import ch.memobase.helpers.Constants.QueryFields
import ch.memobase.model.Schema
class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchWrapper) { class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchWrapper) {
...@@ -177,7 +178,7 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW ...@@ -177,7 +178,7 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW
institution = institutionIds.map { elasticSearchWrapper.getInstitutionName(it) }, institution = institutionIds.map { elasticSearchWrapper.getInstitutionName(it) },
supportedByMemoriav = recordSet[Constants.sponsoredBy] != null, supportedByMemoriav = recordSet[Constants.sponsoredBy] != null,
name = name, name = name,
documentType = elasticSearchWrapper.getDocumentTypesFromRecords(id, Constants.QueryFields.recordSetFacet), documentType = elasticSearchWrapper.getDocumentTypesFromRecords(id, QueryFields.recordSetFacet),
keyVisualLink = recordSet[Constants.wikidataImage].let { if (it != null) it as String else "NoKeyVisualLinkDefined" }, keyVisualLink = recordSet[Constants.wikidataImage].let { if (it != null) it as String else "NoKeyVisualLinkDefined" },
numberOfDocuments = elasticSearchWrapper.countTotalNumberOfDocuments(id), numberOfDocuments = elasticSearchWrapper.countTotalNumberOfDocuments(id),
numberOfDocumentsPublished = elasticSearchWrapper.countNumberOfDocumentsPublished(id), numberOfDocumentsPublished = elasticSearchWrapper.countNumberOfDocumentsPublished(id),
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase package ch.memobase
import ch.memobase.settings.SettingsLoader import ch.memobase.settings.SettingsLoader
import java.net.ConnectException import java.net.ConnectException
...@@ -31,9 +31,9 @@ import org.elasticsearch.client.RequestOptions ...@@ -31,9 +31,9 @@ import org.elasticsearch.client.RequestOptions
import org.elasticsearch.client.RestClient import org.elasticsearch.client.RestClient
import org.elasticsearch.client.RestHighLevelClient import org.elasticsearch.client.RestHighLevelClient
import org.elasticsearch.client.indices.GetIndexRequest import org.elasticsearch.client.indices.GetIndexRequest
import org.memobase.helpers.ElasticSearchWrapper import ch.memobase.helpers.ElasticSearchWrapper
import org.memobase.helpers.Constants.SettingsProps import ch.memobase.helpers.Constants.SettingsProps
import org.memobase.helpers.TranslationMappers import ch.memobase.helpers.TranslationMappers
class Service(settings: SettingsLoader) { class Service(settings: SettingsLoader) {
companion object { companion object {
......
...@@ -16,16 +16,16 @@ ...@@ -16,16 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.builders package ch.memobase.builders
import ch.memobase.rdf.NS import ch.memobase.rdf.NS
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.helpers.Extract import ch.memobase.helpers.Extract
import org.memobase.helpers.FacetBuildHelpers import ch.memobase.helpers.FacetBuildHelpers
import org.memobase.helpers.Constants import ch.memobase.helpers.Constants
import org.memobase.model.AgentWithRelationContainer import ch.memobase.model.AgentWithRelationContainer
import org.memobase.model.LanguageContainer import ch.memobase.model.LanguageContainer
class AgentContainerBuilder( class AgentContainerBuilder(
private val identifiers: List<String>, private val identifiers: List<String>,
......
...@@ -15,15 +15,15 @@ ...@@ -15,15 +15,15 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.builders package ch.memobase.builders
import ch.memobase.rdf.NS import ch.memobase.rdf.NS
import com.beust.klaxon.JsonArray import com.beust.klaxon.JsonArray
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.helpers.DateFacetBuildHelpers import ch.memobase.helpers.DateFacetBuildHelpers
import org.memobase.helpers.Constants import ch.memobase.helpers.Constants
import org.memobase.model.DateContainer import ch.memobase.model.DateContainer
class DateContainerBuilder(private val containedIds: List<String>) : IFieldBuilder { class DateContainerBuilder(private val containedIds: List<String>) : IFieldBuilder {
private val log = LogManager.getLogger("DateContainerBuilder") private val log = LogManager.getLogger("DateContainerBuilder")
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.builders package ch.memobase.builders
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.helpers.Extract import ch.memobase.helpers.Extract
import org.memobase.helpers.Constants import ch.memobase.helpers.Constants
import org.memobase.model.EnrichedFacetContainer import ch.memobase.model.EnrichedFacetContainer
/** /**
* *
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.builders package ch.memobase.builders
import ch.memobase.rdf.NS import ch.memobase.rdf.NS
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import org.memobase.helpers.Extract import ch.memobase.helpers.Extract
import org.memobase.helpers.Constants import ch.memobase.helpers.Constants
import org.memobase.model.FacetContainer import ch.memobase.model.FacetContainer
/** /**
* @param identifiers: A list of identifiers to filter on. * @param identifiers: A list of identifiers to filter on.
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.builders package ch.memobase.builders
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
......
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.builders package ch.memobase.builders
import ch.memobase.rdf.NS import ch.memobase.rdf.NS
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.helpers.FacetBuildHelpers import ch.memobase.helpers.FacetBuildHelpers
import org.memobase.helpers.Constants import ch.memobase.helpers.Constants
import org.memobase.model.SimpleFacetContainer import ch.memobase.model.SimpleFacetContainer
class PersonFacetBuilder : IFieldBuilder { class PersonFacetBuilder : IFieldBuilder {
private val log = LogManager.getLogger("PersonFacetBuilder") private val log = LogManager.getLogger("PersonFacetBuilder")
......
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.builders package ch.memobase.builders
import ch.memobase.rdf.NS import ch.memobase.rdf.NS
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.helpers.FacetBuildHelpers import ch.memobase.helpers.FacetBuildHelpers
import org.memobase.helpers.Constants import ch.memobase.helpers.Constants
import org.memobase.model.SimpleFacetContainer import ch.memobase.model.SimpleFacetContainer
class PlaceFacetBuilder : IFieldBuilder { class PlaceFacetBuilder : IFieldBuilder {
private val log = LogManager.getLogger("PersonFacetBuilder") private val log = LogManager.getLogger("PersonFacetBuilder")
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.builders package ch.memobase.builders
import ch.memobase.rdf.NS import ch.memobase.rdf.NS
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import org.memobase.helpers.Extract import ch.memobase.helpers.Extract
import org.memobase.helpers.Constants import ch.memobase.helpers.Constants
import org.memobase.model.SuggestContainer import ch.memobase.model.SuggestContainer
class SuggestContainerBuilder(private val hasSubjectIds: List<String>) : IFieldBuilder { class SuggestContainerBuilder(private val hasSubjectIds: List<String>) : IFieldBuilder {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.helpers package ch.memobase.helpers
object AsciiFolder { object AsciiFolder {
fun foldToASCII( fun foldToASCII(
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.helpers package ch.memobase.helpers
import java.lang.NumberFormatException import java.lang.NumberFormatException
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.memobase.helpers package ch.memobase.helpers
object Constants { object Constants {