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