From 25daa8ba830a5826f600d906ffd1b5fe03697a70 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Thu, 3 Aug 2023 08:20:07 +0200 Subject: [PATCH 01/18] Bump version to 7.0.0-RC1 --- dc-cudami-admin/pom.xml | 2 +- dc-cudami-client/pom.xml | 2 +- dc-cudami-lobid-client/pom.xml | 2 +- dc-cudami-model/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-backend-api/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-backend-file/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-backend-inmemory/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-backend-jdbi/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-backend-lobid/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-business/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-webapp/pom.xml | 2 +- dc-cudami-server/pom.xml | 2 +- pom.xml | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dc-cudami-admin/pom.xml b/dc-cudami-admin/pom.xml index 0c6f5de3c7..97c031d654 100644 --- a/dc-cudami-admin/pom.xml +++ b/dc-cudami-admin/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Management Webapp diff --git a/dc-cudami-client/pom.xml b/dc-cudami-client/pom.xml index 6b6222d617..a1f39feea8 100644 --- a/dc-cudami-client/pom.xml +++ b/dc-cudami-client/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Repository Client diff --git a/dc-cudami-lobid-client/pom.xml b/dc-cudami-lobid-client/pom.xml index f4539f091e..8eb133c919 100644 --- a/dc-cudami-lobid-client/pom.xml +++ b/dc-cudami-lobid-client/pom.xml @@ -7,7 +7,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami lobid.org Client diff --git a/dc-cudami-model/pom.xml b/dc-cudami-model/pom.xml index 31a8c0bedd..9f3b0c81bd 100644 --- a/dc-cudami-model/pom.xml +++ b/dc-cudami-model/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Model diff --git a/dc-cudami-server/dc-cudami-server-backend-api/pom.xml b/dc-cudami-server/dc-cudami-server-backend-api/pom.xml index 1016f6af7f..ec92e28794 100644 --- a/dc-cudami-server/dc-cudami-server-backend-api/pom.xml +++ b/dc-cudami-server/dc-cudami-server-backend-api/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Repository Server (Backend API) diff --git a/dc-cudami-server/dc-cudami-server-backend-file/pom.xml b/dc-cudami-server/dc-cudami-server-backend-file/pom.xml index 58a4c36751..0f7f8692ff 100644 --- a/dc-cudami-server/dc-cudami-server-backend-file/pom.xml +++ b/dc-cudami-server/dc-cudami-server-backend-file/pom.xml @@ -5,7 +5,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Repository Server (Backend IMPL File) diff --git a/dc-cudami-server/dc-cudami-server-backend-inmemory/pom.xml b/dc-cudami-server/dc-cudami-server-backend-inmemory/pom.xml index 3854a91578..70acda03f6 100644 --- a/dc-cudami-server/dc-cudami-server-backend-inmemory/pom.xml +++ b/dc-cudami-server/dc-cudami-server-backend-inmemory/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Repository Server (Backend IMPL InMemory) diff --git a/dc-cudami-server/dc-cudami-server-backend-jdbi/pom.xml b/dc-cudami-server/dc-cudami-server-backend-jdbi/pom.xml index 84fdcbe18a..0cb334afc9 100644 --- a/dc-cudami-server/dc-cudami-server-backend-jdbi/pom.xml +++ b/dc-cudami-server/dc-cudami-server-backend-jdbi/pom.xml @@ -8,7 +8,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Repository Server (Backend IMPL JDBI PostgreSql) diff --git a/dc-cudami-server/dc-cudami-server-backend-lobid/pom.xml b/dc-cudami-server/dc-cudami-server-backend-lobid/pom.xml index 3299902302..0bc40cb9ff 100644 --- a/dc-cudami-server/dc-cudami-server-backend-lobid/pom.xml +++ b/dc-cudami-server/dc-cudami-server-backend-lobid/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Repository Server (Backend IMPL External System lobid.org) diff --git a/dc-cudami-server/dc-cudami-server-business/pom.xml b/dc-cudami-server/dc-cudami-server-business/pom.xml index 49ad6f02bf..1ab8f573e8 100644 --- a/dc-cudami-server/dc-cudami-server-business/pom.xml +++ b/dc-cudami-server/dc-cudami-server-business/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Repository Server (Business) diff --git a/dc-cudami-server/dc-cudami-server-webapp/pom.xml b/dc-cudami-server/dc-cudami-server-webapp/pom.xml index 0c944f6cf9..4805f52eb7 100644 --- a/dc-cudami-server/dc-cudami-server-webapp/pom.xml +++ b/dc-cudami-server/dc-cudami-server-webapp/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Repository Server (Webapp) diff --git a/dc-cudami-server/pom.xml b/dc-cudami-server/pom.xml index c7543c64ee..48b1ce4b25 100644 --- a/dc-cudami-server/pom.xml +++ b/dc-cudami-server/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-SNAPSHOT + 7.0.0-RC1 DigitalCollections: cudami Repository Server diff --git a/pom.xml b/pom.xml index 02d9249e65..5764e833e9 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-SNAPSHOT + 7.0.0-RC1 pom DigitalCollections: cudami From 2892834919642cc72b0607b033f2ffb796519060 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Thu, 3 Aug 2023 16:51:04 +0200 Subject: [PATCH 02/18] Fix saveUrlAlias (one question mark placeholder in sql more than given params) --- .../impl/database/migration/V9_02_02__DML_Fill_urlaliases.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/java/de/digitalcollections/cudami/server/backend/impl/database/migration/V9_02_02__DML_Fill_urlaliases.java b/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/java/de/digitalcollections/cudami/server/backend/impl/database/migration/V9_02_02__DML_Fill_urlaliases.java index 5a113807e6..cdecf02e2b 100644 --- a/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/java/de/digitalcollections/cudami/server/backend/impl/database/migration/V9_02_02__DML_Fill_urlaliases.java +++ b/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/java/de/digitalcollections/cudami/server/backend/impl/database/migration/V9_02_02__DML_Fill_urlaliases.java @@ -322,7 +322,7 @@ private UrlAlias buildUrlAlias( private void saveUrlAlias(JdbcTemplate jdbcTemplate, UrlAlias urlAlias) throws SQLException { String updateQuery = - "INSERT INTO url_aliases (uuid,created,last_published,\"primary\",slug,target_identifiable_type,target_language,target_uuid,website_uuid) VALUES(?::uuid,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,?,?,?,?,?,?::uuid,?::uuid);"; + "INSERT INTO url_aliases (uuid,created,last_published,\"primary\",slug,target_identifiable_type,target_language,target_uuid,website_uuid) VALUES(?::uuid,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,?,?,?,?,?::uuid,?::uuid);"; try { jdbcTemplate.update( updateQuery, From d7979eb34256598cf1d77245a86a3dbbda1d63ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20F=C3=B6rster?= Date: Fri, 4 Aug 2023 13:07:30 +0200 Subject: [PATCH 03/18] Fix migration 14.10.00: wrong FK leads to errors --- ...V14.10.00__DDL_add_missing_pks_and_fks.sql | 64 +++++++++++++++++-- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.10.00__DDL_add_missing_pks_and_fks.sql b/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.10.00__DDL_add_missing_pks_and_fks.sql index c943d30ba8..aef0d1db51 100644 --- a/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.10.00__DDL_add_missing_pks_and_fks.sql +++ b/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.10.00__DDL_add_missing_pks_and_fks.sql @@ -1,73 +1,123 @@ ALTER TABLE familynames + DROP CONSTRAINT IF EXISTS familynames_pkey, ADD CONSTRAINT familynames_pkey PRIMARY KEY (uuid), - ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; - -ALTER TABLE geolocations - ADD CONSTRAINT geolocations_pkey PRIMARY KEY (uuid), + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE givennames + DROP CONSTRAINT IF EXISTS givennames_pkey, ADD CONSTRAINT givennames_pkey PRIMARY KEY (uuid), + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE identifiables + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE entities + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE agents + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE articles + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE collections + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE corporatebodies + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE fileresources + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE fileresources_application + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE fileresources_audio + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE fileresources_image + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE fileresources_linkeddata + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE fileresources_text + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE fileresources_video + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE headwordentries + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image, + DROP CONSTRAINT IF EXISTS fk_headword, ADD CONSTRAINT fk_headword FOREIGN KEY (headword) REFERENCES headwords; ALTER TABLE persons - ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image, - ADD CONSTRAINT fk_locationofbirth FOREIGN KEY (locationofbirth) REFERENCES geolocations, - ADD CONSTRAINT fk_locationofdeath FOREIGN KEY (locationofdeath) REFERENCES geolocations; + DROP CONSTRAINT IF EXISTS fk_locationofbirth, + DROP CONSTRAINT IF EXISTS fk_locationofdeath, + DROP CONSTRAINT IF EXISTS fk_previewfileresource, + ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; + +ALTER TABLE geolocations + DROP CONSTRAINT IF EXISTS geolocations_pkey, + ADD CONSTRAINT geolocations_pkey PRIMARY KEY (uuid), + DROP CONSTRAINT IF EXISTS fk_previewfileresource, + ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; + +CREATE TRIGGER tr_persons_geolocations_locofbirth +BEFORE INSERT OR UPDATE +ON persons +FOR EACH ROW +EXECUTE FUNCTION check_uuid_exists('geolocations', 'locationofbirth'); + +CREATE TRIGGER tr_persons_geolocations_locofdeath +BEFORE INSERT OR UPDATE +ON persons +FOR EACH ROW +EXECUTE FUNCTION check_uuid_exists('geolocations', 'locationofdeath'); + +CREATE TRIGGER tr_geolocations_persons_prevent_removal +AFTER DELETE +ON geolocations +FOR EACH ROW +EXECUTE FUNCTION is_not_referenced_by('persons', 'locationofbirth', 'persons', 'locationofdeath'); + +CREATE TRIGGER tr_humansettlements_persons_prevent_removal +AFTER DELETE +ON humansettlements +FOR EACH ROW +EXECUTE FUNCTION is_not_referenced_by('persons', 'locationofbirth', 'persons', 'locationofdeath'); ALTER TABLE projects + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE topics + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE webpages + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; ALTER TABLE websites + DROP CONSTRAINT IF EXISTS fk_previewfileresource, ADD CONSTRAINT fk_previewfileresource FOREIGN KEY (previewfileresource) REFERENCES fileresources_image; From f89a46f0953644d53549769b4ffb9ea524dbafb7 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Fri, 4 Aug 2023 14:27:57 +0200 Subject: [PATCH 04/18] Fix missing long text in collection view --- .../identifiable/entity/CollectionsController.java | 8 +++++--- .../main/resources/templates/collections/view.html | 12 ++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/CollectionsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/CollectionsController.java index 796c302a4a..a1eeab3a2d 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/CollectionsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/CollectionsController.java @@ -98,17 +98,19 @@ public String view( } model.addAttribute("collection", collection); - List existingLanguages = getExistingLanguagesFromIdentifiables(List.of(collection)); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + List existingLanguages = getExistingLanguagesFromIdentifiable(collection); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); List existingSubcollectionsLanguages = getExistingLanguagesFromIdentifiables(collection.getChildren()); + String dataLanguageSubcollections = + getDataLanguage(targetDataLanguage, existingSubcollectionsLanguages, languageService); model .addAttribute("existingSubcollectionsLanguages", existingSubcollectionsLanguages) - .addAttribute("dataLanguageSubcollections", getDataLanguage(null, languageService)); + .addAttribute("dataLanguageSubcollections", dataLanguageSubcollections); List parents = ((CudamiCollectionsClient) service).getParents(uuid); model.addAttribute("parents", parents); diff --git a/dc-cudami-admin/src/main/resources/templates/collections/view.html b/dc-cudami-admin/src/main/resources/templates/collections/view.html index b83f90e5d3..cde0204387 100644 --- a/dc-cudami-admin/src/main/resources/templates/collections/view.html +++ b/dc-cudami-admin/src/main/resources/templates/collections/view.html @@ -75,18 +75,18 @@

Collection

- -
-
-
+
+
+
+
-
+
- +
From 22cf92c87e7f045f33358384e7e092a5a2bfc927 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Fri, 4 Aug 2023 14:48:52 +0200 Subject: [PATCH 05/18] Fix datalanguage in view --- .../controller/identifiable/entity/WebsitesController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/WebsitesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/WebsitesController.java index 217f8b826d..9247af618f 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/WebsitesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/WebsitesController.java @@ -229,16 +229,18 @@ public String view( } List existingLanguages = getExistingLanguagesFromIdentifiable(website); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); List existingWebpageLanguages = getExistingLanguagesFromIdentifiables(website.getRootPages()); + String dataLanguageWebpages = + getDataLanguage(targetDataLanguage, existingWebpageLanguages, languageService); model .addAttribute("existingWebpageLanguages", existingWebpageLanguages) - .addAttribute("dataLanguageWebpages", getDataLanguage(null, languageService)); + .addAttribute("dataLanguageWebpages", dataLanguageWebpages); model.addAttribute("website", website); return "websites/view"; From a810dc4e65d8b177a63c828a4d4de7a9a9995943 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Fri, 4 Aug 2023 14:49:30 +0200 Subject: [PATCH 06/18] Fix website label rendering --- dc-cudami-admin/src/main/resources/templates/webpages/view.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dc-cudami-admin/src/main/resources/templates/webpages/view.html b/dc-cudami-admin/src/main/resources/templates/webpages/view.html index 0c23d9440d..c8c10115ea 100644 --- a/dc-cudami-admin/src/main/resources/templates/webpages/view.html +++ b/dc-cudami-admin/src/main/resources/templates/webpages/view.html @@ -32,7 +32,7 @@

Webpage

From 48ddd1c18fecd92806d4eec6399d7f087af73b2b Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Fri, 4 Aug 2023 14:50:12 +0200 Subject: [PATCH 07/18] Fix string concatenation spotbug --- .../StringToFilterCriteriaGenericConverter.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dc-cudami-server/dc-cudami-server-webapp/src/main/java/de/digitalcollections/cudami/server/controller/converter/StringToFilterCriteriaGenericConverter.java b/dc-cudami-server/dc-cudami-server-webapp/src/main/java/de/digitalcollections/cudami/server/controller/converter/StringToFilterCriteriaGenericConverter.java index 31b191ceed..141f67be9a 100644 --- a/dc-cudami-server/dc-cudami-server-webapp/src/main/java/de/digitalcollections/cudami/server/controller/converter/StringToFilterCriteriaGenericConverter.java +++ b/dc-cudami-server/dc-cudami-server-webapp/src/main/java/de/digitalcollections/cudami/server/controller/converter/StringToFilterCriteriaGenericConverter.java @@ -139,7 +139,7 @@ private FilterCriterion buildFilterCriterion(String filterSource) { String expression = null; boolean isNativeExpression = false; String operationAcronym = null; - String operationValue = ""; + StringBuilder operationValue = new StringBuilder(); if (newStyle) { expression = filterParts[0]; if (expression.startsWith("[") && expression.endsWith("]")) { @@ -151,9 +151,9 @@ private FilterCriterion buildFilterCriterion(String filterSource) { for (int i = 2; i < filterParts.length; i++) { if (i > 2) { // add separator again (was part of value and no filter separator) - operationValue += ":"; + operationValue.append(":"); } - operationValue += filterParts[i]; + operationValue.append(filterParts[i]); } } else { // old style without expression part @@ -162,7 +162,7 @@ private FilterCriterion buildFilterCriterion(String filterSource) { ':'); // index of the first occurrence of ":" (operation value may contain // ":", too... operationAcronym = filterSource.substring(0, separatorPosition); - operationValue = filterSource.substring(separatorPosition + 1); + operationValue.append(filterSource.substring(separatorPosition + 1)); } // Convert the operation acronym to enum @@ -176,7 +176,7 @@ private FilterCriterion buildFilterCriterion(String filterSource) { expression, isNativeExpression, filterOperation, - operationValue, + operationValue.toString(), conversionService); } From c03f8fb46c28b1f28e01233bb67029d84af437cc Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Fri, 4 Aug 2023 14:50:57 +0200 Subject: [PATCH 08/18] Fix case where constraint was not existing --- .../V14.04.00__DDL_rearrange_indexes_of_identifiers.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.04.00__DDL_rearrange_indexes_of_identifiers.sql b/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.04.00__DDL_rearrange_indexes_of_identifiers.sql index f528d45f8c..cb1d60ddb7 100644 --- a/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.04.00__DDL_rearrange_indexes_of_identifiers.sql +++ b/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.04.00__DDL_rearrange_indexes_of_identifiers.sql @@ -4,7 +4,7 @@ */ DROP INDEX IF EXISTS idx_identifiers_uniq; ALTER TABLE identifiers - DROP CONSTRAINT unique_namespace_identifier, + DROP CONSTRAINT IF EXISTS unique_namespace_identifier, ADD CONSTRAINT unique_namespace_identifier_identifiable UNIQUE (identifiable, namespace, identifier), ADD CONSTRAINT unique_namespace_identifier UNIQUE (namespace, identifier) INCLUDE (identifiable); From 61c271b1a9bbba7dd263c4706f3d2e752187db20 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Fri, 4 Aug 2023 15:41:00 +0200 Subject: [PATCH 09/18] Fixes for dataLanguages --- .../identifiable/entity/ArticlesController.java | 2 +- .../entity/DigitalObjectsController.java | 15 +++++++++++---- .../identifiable/entity/EventsController.java | 2 +- .../entity/HeadwordEntriesController.java | 2 +- .../identifiable/entity/ProjectsController.java | 2 +- .../identifiable/entity/TopicsController.java | 14 ++++++++++---- .../entity/agent/CorporateBodiesController.java | 2 +- .../entity/agent/FamilynamesController.java | 2 +- .../entity/agent/GivennamesController.java | 2 +- .../entity/agent/PersonsController.java | 2 +- .../geo/location/GeoLocationsController.java | 2 +- .../identifiable/entity/work/ItemsController.java | 7 +++++-- .../entity/work/ManifestationsController.java | 6 ++++-- .../identifiable/entity/work/WorksController.java | 12 +++++++++--- .../resource/FileResourcesMetadataController.java | 2 +- .../controller/relation/PredicatesController.java | 2 +- .../src/main/resources/templates/works/view.html | 2 +- 17 files changed, 51 insertions(+), 27 deletions(-) diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesController.java index cc86fbd8b1..84d32717ae 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesController.java @@ -86,7 +86,7 @@ public String view( model.addAttribute("article", article); List existingLanguages = getExistingLanguagesFromIdentifiable(article); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/DigitalObjectsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/DigitalObjectsController.java index 09a2ff75a0..c4d0aaa0e1 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/DigitalObjectsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/DigitalObjectsController.java @@ -55,7 +55,7 @@ public String view( model.addAttribute("digitalObject", digitalObject); List existingLanguages = getExistingLanguagesFromIdentifiable(digitalObject); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); @@ -64,27 +64,34 @@ public String view( List existingCollectionsLanguages = ((CudamiDigitalObjectsClient) service).getLanguagesOfCollections(uuid); + String dataLanguageCollections = + getDataLanguage(targetDataLanguage, existingCollectionsLanguages, languageService); model .addAttribute( "existingCollectionsLanguages", languageService.sortLanguages(displayLocale, existingCollectionsLanguages)) - .addAttribute("dataLanguageCollections", getDataLanguage(null, languageService)); + .addAttribute("dataLanguageCollections", dataLanguageCollections); List existingProjectsLanguages = ((CudamiDigitalObjectsClient) service).getLanguagesOfProjects(uuid); + String dataLanguageProjects = + getDataLanguage(targetDataLanguage, existingProjectsLanguages, languageService); model .addAttribute( "existingProjectsLanguages", languageService.sortLanguages(displayLocale, existingProjectsLanguages)) - .addAttribute("dataLanguageProjects", getDataLanguage(null, languageService)); + .addAttribute("dataLanguageProjects", dataLanguageProjects); List existingContainedDigitalObjectsLanguages = ((CudamiDigitalObjectsClient) service).getLanguagesOfContainedDigitalObjects(uuid); + String dataLanguageDigitalObjects = + getDataLanguage( + targetDataLanguage, existingContainedDigitalObjectsLanguages, languageService); model .addAttribute( "existingDigitalObjectsLanguages", languageService.sortLanguages(displayLocale, existingContainedDigitalObjectsLanguages)) - .addAttribute("dataLanguageDigitalObjects", getDataLanguage(null, languageService)); + .addAttribute("dataLanguageDigitalObjects", dataLanguageDigitalObjects); return "digitalobjects/view"; } diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsController.java index 67531a3ede..fdedca6ff9 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsController.java @@ -82,7 +82,7 @@ public String view( model.addAttribute("event", event); List existingLanguages = getExistingLanguagesFromIdentifiable(event); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesController.java index 4b2386de33..78ca3d676c 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesController.java @@ -87,7 +87,7 @@ public String view( model.addAttribute("headwordEntry", headwordEntry); List existingLanguages = getExistingLanguagesFromIdentifiable(headwordEntry); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsController.java index 571d5b2339..c3b914d8f4 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsController.java @@ -86,7 +86,7 @@ public String view( model.addAttribute("project", project); List existingLanguages = getExistingLanguagesFromIdentifiable(project); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/TopicsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/TopicsController.java index 422201dbec..971a157e98 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/TopicsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/TopicsController.java @@ -98,33 +98,39 @@ public String view( model.addAttribute("topic", topic); List existingLanguages = getExistingLanguagesFromIdentifiable(topic); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); List existingSubtopicsLanguages = getExistingLanguagesFromIdentifiables(topic.getChildren()); + String dataLanguageSubtopics = + getDataLanguage(targetDataLanguage, existingSubtopicsLanguages, languageService); model .addAttribute("existingSubtopicsLanguages", existingSubtopicsLanguages) - .addAttribute("dataLanguageSubtopics", getDataLanguage(null, languageService)); + .addAttribute("dataLanguageSubtopics", dataLanguageSubtopics); final Locale displayLocale = LocaleContextHolder.getLocale(); List existingEntitiesLanguages = ((CudamiTopicsClient) service).getLanguagesOfEntities(uuid); + String dataLanguageEntities = + getDataLanguage(targetDataLanguage, existingEntitiesLanguages, languageService); model .addAttribute( "existingEntitiesLanguages", languageService.sortLanguages(displayLocale, existingEntitiesLanguages)) - .addAttribute("dataLanguageEntities", getDataLanguage(null, languageService)); + .addAttribute("dataLanguageEntities", dataLanguageEntities); List existingFileResourcesLanguages = ((CudamiTopicsClient) service).getLanguagesOfFileResources(uuid); + String dataLanguageFileResources = + getDataLanguage(targetDataLanguage, existingFileResourcesLanguages, languageService); model .addAttribute( "existingFileResourcesLanguages", languageService.sortLanguages(displayLocale, existingFileResourcesLanguages)) - .addAttribute("dataLanguageFileResources", getDataLanguage(null, languageService)); + .addAttribute("dataLanguageFileResources", dataLanguageFileResources); BreadcrumbNavigation breadcrumbNavigation = ((CudamiTopicsClient) service).getBreadcrumbNavigation(uuid); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/CorporateBodiesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/CorporateBodiesController.java index 9a96313633..64e9823bd5 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/CorporateBodiesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/CorporateBodiesController.java @@ -88,7 +88,7 @@ public String view( model.addAttribute("corporateBody", corporateBody); List existingLanguages = getExistingLanguagesFromIdentifiable(corporateBody); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/FamilynamesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/FamilynamesController.java index 3a0046ca11..5306aca906 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/FamilynamesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/FamilynamesController.java @@ -232,7 +232,7 @@ public String view( model.addAttribute("familyName", familyName); List existingLanguages = getExistingLanguagesFromIdentifiable(familyName); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/GivennamesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/GivennamesController.java index 70f298212c..6df5033278 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/GivennamesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/GivennamesController.java @@ -232,7 +232,7 @@ public String view( model.addAttribute("givenName", givenName); List existingLanguages = getExistingLanguagesFromIdentifiable(givenName); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/PersonsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/PersonsController.java index 688d3a7765..4e29f23a3a 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/PersonsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/agent/PersonsController.java @@ -87,7 +87,7 @@ public String view( model.addAttribute("person", person); List existingLanguages = getExistingLanguagesFromIdentifiable(person); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/geo/location/GeoLocationsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/geo/location/GeoLocationsController.java index 9d4f8393c9..e6db5bbfd2 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/geo/location/GeoLocationsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/geo/location/GeoLocationsController.java @@ -59,7 +59,7 @@ public String view( model.addAttribute("geoLocation", geoLocation); List existingLanguages = getExistingLanguagesFromIdentifiable(geoLocation); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ItemsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ItemsController.java index 0b89753f94..3b93708dae 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ItemsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ItemsController.java @@ -63,18 +63,21 @@ public String view( model.addAttribute("item", item); List existingLanguages = getExistingLanguagesFromIdentifiable(item); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); Locale displayLocale = LocaleContextHolder.getLocale(); + List existingDigitalObjectsLanguages = languageService.sortLanguages( displayLocale, ((CudamiItemsClient) service).getLanguagesOfDigitalObjects(uuid)); + String dataLanguageDigitalObjects = + getDataLanguage(targetDataLanguage, existingDigitalObjectsLanguages, languageService); model .addAttribute("existingDigitalObjectsLanguages", existingDigitalObjectsLanguages) - .addAttribute("dataLanguageDigitalObjects", getDataLanguage(null, languageService)); + .addAttribute("dataLanguageDigitalObjects", dataLanguageDigitalObjects); return "items/view"; } diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ManifestationsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ManifestationsController.java index 79c584c936..1e16cb0799 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ManifestationsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ManifestationsController.java @@ -56,7 +56,7 @@ public String view( model.addAttribute("manifestation", manifestation); List existingLanguages = getExistingLanguagesFromIdentifiable(manifestation); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); @@ -65,9 +65,11 @@ public String view( List existingItemsLanguages = languageService.sortLanguages( displayLocale, ((CudamiManifestationsClient) service).getLanguagesOfItems(uuid)); + String dataLanguageItems = + getDataLanguage(targetDataLanguage, existingItemsLanguages, languageService); model .addAttribute("existingItemsLanguages", existingItemsLanguages) - .addAttribute("dataLanguageItems", getDataLanguage(null, languageService)); + .addAttribute("dataLanguageItems", dataLanguageItems); return "manifestations/view"; } diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksController.java index 85ebe4bb4e..da1a838463 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksController.java @@ -55,15 +55,21 @@ public String view( model.addAttribute("work", work); List existingLanguages = getExistingLanguagesFromIdentifiable(work); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); + model + .addAttribute("existingLanguages", existingLanguages) + .addAttribute("dataLanguage", dataLanguage); + Locale displayLocale = LocaleContextHolder.getLocale(); + List existingManifestationsLanguages = languageService.sortLanguages( displayLocale, ((CudamiWorksClient) service).getLanguagesOfManifestations(uuid)); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguageManifestations = + getDataLanguage(targetDataLanguage, existingManifestationsLanguages, languageService); model - .addAttribute("existingLanguages", existingLanguages) .addAttribute("existingManifestationsLanguages", existingManifestationsLanguages) - .addAttribute("dataLanguage", dataLanguage); + .addAttribute("dataLanguageManifestations", dataLanguageManifestations); return "works/view"; } diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataController.java index c028f3f572..648ddfc0b1 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataController.java @@ -90,7 +90,7 @@ public String view( model.addAttribute("fileresource", resource); List existingLanguages = getExistingLanguagesFromIdentifiable(resource); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("existingLanguages", existingLanguages) .addAttribute("dataLanguage", dataLanguage); diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/relation/PredicatesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/relation/PredicatesController.java index b798b1416c..553ebe0013 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/relation/PredicatesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/relation/PredicatesController.java @@ -247,7 +247,7 @@ public String view( predicate.getLabel() != null ? languageService.getExistingLanguagesForLocales(predicate.getLabel().getLocales()) : List.of(); - String dataLanguage = getDataLanguage(targetDataLanguage, languageService); + String dataLanguage = getDataLanguage(targetDataLanguage, existingLanguages, languageService); model .addAttribute("predicate", predicate) diff --git a/dc-cudami-admin/src/main/resources/templates/works/view.html b/dc-cudami-admin/src/main/resources/templates/works/view.html index fae137a040..1f687a8673 100644 --- a/dc-cudami-admin/src/main/resources/templates/works/view.html +++ b/dc-cudami-admin/src/main/resources/templates/works/view.html @@ -125,7 +125,7 @@

Work

Show language dependent values in  - +
Date: Fri, 4 Aug 2023 16:15:24 +0200 Subject: [PATCH 10/18] Add missing links to objects view and edit under topic --- .../identifiable/IdentifiableController.java | 21 +++++++++++++++++++ .../main/resources/templates/topics/view.html | 8 ++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/IdentifiableController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/IdentifiableController.java index 0a526b57c2..a7c2ccfa12 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/IdentifiableController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/IdentifiableController.java @@ -1,6 +1,7 @@ package de.digitalcollections.cudami.admin.controller.identifiable; import de.digitalcollections.cudami.admin.business.i18n.LanguageService; +import de.digitalcollections.cudami.admin.controller.ParameterHelper; import de.digitalcollections.cudami.client.CudamiClient; import de.digitalcollections.cudami.client.identifiable.CudamiIdentifiablesClient; import de.digitalcollections.cudami.client.identifiable.entity.CudamiHeadwordEntriesClient; @@ -162,4 +163,24 @@ public String viewBase64Encoded(@PathVariable String base64, Model model) } return doForward(identifiable, model); } + + @GetMapping("/identifiables/{uuid:" + ParameterHelper.UUID_PATTERN + "}/view") + public String view(@PathVariable UUID uuid, Model model) + throws TechnicalException, ResourceNotFoundException { + Identifiable identifiable = service.getByUuid(uuid); + if (identifiable == null) { + throw new ResourceNotFoundException(); + } + return doForward(identifiable, model); + } + + @GetMapping("/identifiables/{uuid:" + ParameterHelper.UUID_PATTERN + "}/edit") + public String edit(@PathVariable UUID uuid, Model model) + throws TechnicalException, ResourceNotFoundException { + Identifiable identifiable = service.getByUuid(uuid); + if (identifiable == null) { + throw new ResourceNotFoundException(); + } + return doForward(identifiable, model) + "/edit"; + } } diff --git a/dc-cudami-admin/src/main/resources/templates/topics/view.html b/dc-cudami-admin/src/main/resources/templates/topics/view.html index fa18756775..97421d2355 100644 --- a/dc-cudami-admin/src/main/resources/templates/topics/view.html +++ b/dc-cudami-admin/src/main/resources/templates/topics/view.html @@ -297,7 +297,13 @@

Topic

} function formatActionsEntities(value, row) { - return ''; + /*[+ + const baseUrl = [[@{'/identifiables'}]] + '/' + row.uuid; + +]*/ + return [ + renderViewAction(baseUrl + "/view"), + renderEditAction(baseUrl) + ].join(' '); } function formatActionsFileresources(value, row) { From 82fd941f3df06fae73d475bcaac7b4c41feb8a04 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Fri, 4 Aug 2023 16:22:12 +0200 Subject: [PATCH 11/18] Add changes to changelog --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e179fd37eb..90c6fe53c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Add Lobid-Clients for missing Lobid objects - Add persistence support for new field `Headword.labelNormalized` - Add sorting to Buckets and Bucket objects handling in `HeadwordRepositoryImpl` - +- Add action links to object's view and edit under topic + ### Changed - WEMI parts: Manifestations, Works @@ -64,6 +65,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) by `"und"` - `getByValue` method in `PredicateRepositoryImpl` - Comment not supported sorting throwing warning every time in `EntityToEntityRelationRepositoryImpl` +- Fix saveUrlAlias (one question mark placeholder in sql more than given params) +- Fix sql migrations 14.10.00, 14.04.00, 9.02.02 +- Fix data language handling in admin webapp +- Fix visibility of long text in collection view +- Fix website label rendering ### Removed From a400c3ce1007224a1871b4ed576357ef48a0ca1f Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Fri, 4 Aug 2023 16:23:55 +0200 Subject: [PATCH 12/18] Bump version to 7.0.0-RC2 --- dc-cudami-admin/pom.xml | 2 +- dc-cudami-client/pom.xml | 2 +- dc-cudami-lobid-client/pom.xml | 2 +- dc-cudami-model/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-backend-api/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-backend-file/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-backend-inmemory/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-backend-jdbi/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-backend-lobid/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-business/pom.xml | 2 +- dc-cudami-server/dc-cudami-server-webapp/pom.xml | 2 +- dc-cudami-server/pom.xml | 2 +- pom.xml | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dc-cudami-admin/pom.xml b/dc-cudami-admin/pom.xml index 97c031d654..920958425b 100644 --- a/dc-cudami-admin/pom.xml +++ b/dc-cudami-admin/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Management Webapp diff --git a/dc-cudami-client/pom.xml b/dc-cudami-client/pom.xml index a1f39feea8..d4d952ffac 100644 --- a/dc-cudami-client/pom.xml +++ b/dc-cudami-client/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Repository Client diff --git a/dc-cudami-lobid-client/pom.xml b/dc-cudami-lobid-client/pom.xml index 8eb133c919..8a270cf00e 100644 --- a/dc-cudami-lobid-client/pom.xml +++ b/dc-cudami-lobid-client/pom.xml @@ -7,7 +7,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami lobid.org Client diff --git a/dc-cudami-model/pom.xml b/dc-cudami-model/pom.xml index 9f3b0c81bd..ed46fbb5da 100644 --- a/dc-cudami-model/pom.xml +++ b/dc-cudami-model/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Model diff --git a/dc-cudami-server/dc-cudami-server-backend-api/pom.xml b/dc-cudami-server/dc-cudami-server-backend-api/pom.xml index ec92e28794..526b126bd5 100644 --- a/dc-cudami-server/dc-cudami-server-backend-api/pom.xml +++ b/dc-cudami-server/dc-cudami-server-backend-api/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Repository Server (Backend API) diff --git a/dc-cudami-server/dc-cudami-server-backend-file/pom.xml b/dc-cudami-server/dc-cudami-server-backend-file/pom.xml index 0f7f8692ff..1c3ea4a6e1 100644 --- a/dc-cudami-server/dc-cudami-server-backend-file/pom.xml +++ b/dc-cudami-server/dc-cudami-server-backend-file/pom.xml @@ -5,7 +5,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Repository Server (Backend IMPL File) diff --git a/dc-cudami-server/dc-cudami-server-backend-inmemory/pom.xml b/dc-cudami-server/dc-cudami-server-backend-inmemory/pom.xml index 70acda03f6..812ead3049 100644 --- a/dc-cudami-server/dc-cudami-server-backend-inmemory/pom.xml +++ b/dc-cudami-server/dc-cudami-server-backend-inmemory/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Repository Server (Backend IMPL InMemory) diff --git a/dc-cudami-server/dc-cudami-server-backend-jdbi/pom.xml b/dc-cudami-server/dc-cudami-server-backend-jdbi/pom.xml index 0cb334afc9..f1f14674e8 100644 --- a/dc-cudami-server/dc-cudami-server-backend-jdbi/pom.xml +++ b/dc-cudami-server/dc-cudami-server-backend-jdbi/pom.xml @@ -8,7 +8,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Repository Server (Backend IMPL JDBI PostgreSql) diff --git a/dc-cudami-server/dc-cudami-server-backend-lobid/pom.xml b/dc-cudami-server/dc-cudami-server-backend-lobid/pom.xml index 0bc40cb9ff..46122ef15a 100644 --- a/dc-cudami-server/dc-cudami-server-backend-lobid/pom.xml +++ b/dc-cudami-server/dc-cudami-server-backend-lobid/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Repository Server (Backend IMPL External System lobid.org) diff --git a/dc-cudami-server/dc-cudami-server-business/pom.xml b/dc-cudami-server/dc-cudami-server-business/pom.xml index 1ab8f573e8..904a3fd8a5 100644 --- a/dc-cudami-server/dc-cudami-server-business/pom.xml +++ b/dc-cudami-server/dc-cudami-server-business/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Repository Server (Business) diff --git a/dc-cudami-server/dc-cudami-server-webapp/pom.xml b/dc-cudami-server/dc-cudami-server-webapp/pom.xml index 4805f52eb7..1e51eb0292 100644 --- a/dc-cudami-server/dc-cudami-server-webapp/pom.xml +++ b/dc-cudami-server/dc-cudami-server-webapp/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami-server - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Repository Server (Webapp) diff --git a/dc-cudami-server/pom.xml b/dc-cudami-server/pom.xml index 48b1ce4b25..e01e6fe658 100644 --- a/dc-cudami-server/pom.xml +++ b/dc-cudami-server/pom.xml @@ -6,7 +6,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-RC1 + 7.0.0-RC2 DigitalCollections: cudami Repository Server diff --git a/pom.xml b/pom.xml index 106c91086e..97038eec72 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ de.digitalcollections.cudami dc-cudami - 7.0.0-RC1 + 7.0.0-RC2 pom DigitalCollections: cudami From 0d580021c33b2810acf045148c1df09aa73c82ee Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Mon, 7 Aug 2023 11:16:36 +0200 Subject: [PATCH 13/18] Fix NPE --- .../semantic/CudamiHeadwordsClient.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/dc-cudami-client/src/main/java/de/digitalcollections/cudami/client/semantic/CudamiHeadwordsClient.java b/dc-cudami-client/src/main/java/de/digitalcollections/cudami/client/semantic/CudamiHeadwordsClient.java index 3351aa54bd..cc93b873f5 100644 --- a/dc-cudami-client/src/main/java/de/digitalcollections/cudami/client/semantic/CudamiHeadwordsClient.java +++ b/dc-cudami-client/src/main/java/de/digitalcollections/cudami/client/semantic/CudamiHeadwordsClient.java @@ -11,6 +11,7 @@ import de.digitalcollections.model.list.buckets.BucketsResponse; import de.digitalcollections.model.semantic.Headword; import java.net.http.HttpClient; +import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -22,17 +23,22 @@ public CudamiHeadwordsClient(HttpClient http, String serverUrl, ObjectMapper map public BucketObjectsResponse findBucketObjects( BucketObjectsRequest bucketObjectsRequest) throws TechnicalException { + BucketObjectsResponse result; String url = String.format("%s/bucketobjects", baseEndpoint); Bucket bucket = bucketObjectsRequest.getBucket(); - Headword startObject = bucket.getStartObject(); - Headword endObject = bucket.getEndObject(); - url = url + "?startId=" + startObject.getUuid(); - url = url + "&endId=" + endObject.getUuid(); + if (bucket != null && bucket.getStartObject() != null && bucket.getEndObject() != null) { + Headword startObject = bucket.getStartObject(); + Headword endObject = bucket.getEndObject(); + url = url + "?startId=" + startObject.getUuid(); + url = url + "&endId=" + endObject.getUuid(); - url = url + "&" + getFindParamsAsString(bucketObjectsRequest); + url = url + "&" + getFindParamsAsString(bucketObjectsRequest); - BucketObjectsResponse result = - (BucketObjectsResponse) doGetRequestForObject(url, BucketObjectsResponse.class); + result = + (BucketObjectsResponse) doGetRequestForObject(url, BucketObjectsResponse.class); + } else { + result = new BucketObjectsResponse<>(bucketObjectsRequest, new ArrayList<>()); + } return result; } From d89842941141c372709878337f313d45f66b9986 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Mon, 7 Aug 2023 11:54:24 +0200 Subject: [PATCH 14/18] Fix missing drop constraint --- .../V14.04.00__DDL_rearrange_indexes_of_identifiers.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.04.00__DDL_rearrange_indexes_of_identifiers.sql b/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.04.00__DDL_rearrange_indexes_of_identifiers.sql index cb1d60ddb7..44e40f999c 100644 --- a/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.04.00__DDL_rearrange_indexes_of_identifiers.sql +++ b/dc-cudami-server/dc-cudami-server-backend-jdbi/src/main/resources/de/digitalcollections/cudami/server/backend/impl/database/migration/V14.04.00__DDL_rearrange_indexes_of_identifiers.sql @@ -4,7 +4,8 @@ */ DROP INDEX IF EXISTS idx_identifiers_uniq; ALTER TABLE identifiers - DROP CONSTRAINT IF EXISTS unique_namespace_identifier, + DROP CONSTRAINT IF EXISTS unique_namespace_identifier_identifiable, ADD CONSTRAINT unique_namespace_identifier_identifiable UNIQUE (identifiable, namespace, identifier), + DROP CONSTRAINT IF EXISTS unique_namespace_identifier, ADD CONSTRAINT unique_namespace_identifier UNIQUE (namespace, identifier) INCLUDE (identifiable); From d52399d469cd75d2ba07fe9f7435958a8641ed69 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Mon, 7 Aug 2023 16:42:10 +0200 Subject: [PATCH 15/18] Move doForward up into AbstractIdentifiablesController. Needed CudamiClient in all constructor calls... --- .../AbstractIdentifiablesController.java | 82 +++++++++++++- .../identifiable/IdentifiableController.java | 101 +----------------- .../entity/AbstractEntitiesController.java | 6 +- .../entity/ArticlesAPIController.java | 2 +- .../entity/ArticlesController.java | 2 +- .../entity/CollectionsAPIController.java | 2 +- .../entity/CollectionsController.java | 2 +- .../entity/DigitalObjectsAPIController.java | 2 +- .../entity/DigitalObjectsController.java | 2 +- .../entity/EntitiesController.java | 44 ++++++++ .../entity/EventsAPIController.java | 2 +- .../identifiable/entity/EventsController.java | 2 +- .../entity/HeadwordEntriesAPIController.java | 2 +- .../entity/HeadwordEntriesController.java | 2 +- .../entity/ProjectsAPIController.java | 2 +- .../entity/ProjectsController.java | 2 +- .../entity/TopicsAPIController.java | 2 +- .../identifiable/entity/TopicsController.java | 2 +- .../entity/WebsitesAPIController.java | 2 +- .../entity/WebsitesController.java | 2 +- .../agent/CorporateBodiesAPIController.java | 2 +- .../agent/CorporateBodiesController.java | 2 +- .../agent/FamilynamesAPIController.java | 2 +- .../entity/agent/FamilynamesController.java | 2 +- .../entity/agent/GivennamesAPIController.java | 2 +- .../entity/agent/GivennamesController.java | 2 +- .../entity/agent/PersonsAPIController.java | 2 +- .../entity/agent/PersonsController.java | 2 +- .../location/GeoLocationsAPIController.java | 2 +- .../geo/location/GeoLocationsController.java | 2 +- .../entity/work/ItemsAPIController.java | 2 +- .../entity/work/ItemsController.java | 2 +- .../work/ManifestationsAPIController.java | 2 +- .../entity/work/ManifestationsController.java | 2 +- .../entity/work/WorksAPIController.java | 2 +- .../entity/work/WorksController.java | 2 +- .../FileResourcesMetadataAPIController.java | 2 +- .../FileResourcesMetadataController.java | 2 +- .../ImageFileResourcesAPIController.java | 2 +- .../semantic/SubjectsAPIController.java | 8 +- .../semantic/SubjectsController.java | 2 +- .../web/WebpagesAPIController.java | 2 +- .../identifiable/web/WebpagesController.java | 2 +- .../main/resources/templates/topics/view.html | 2 +- 44 files changed, 174 insertions(+), 145 deletions(-) create mode 100644 dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EntitiesController.java diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/AbstractIdentifiablesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/AbstractIdentifiablesController.java index 33535be6f7..8657dd0d42 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/AbstractIdentifiablesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/AbstractIdentifiablesController.java @@ -3,9 +3,12 @@ import de.digitalcollections.cudami.admin.business.i18n.LanguageService; import de.digitalcollections.cudami.admin.controller.AbstractUniqueObjectController; import de.digitalcollections.cudami.admin.controller.ParameterHelper; +import de.digitalcollections.cudami.client.CudamiClient; import de.digitalcollections.cudami.client.identifiable.CudamiIdentifiablesClient; import de.digitalcollections.model.exception.TechnicalException; import de.digitalcollections.model.identifiable.Identifiable; +import de.digitalcollections.model.identifiable.IdentifiableObjectType; +import de.digitalcollections.model.identifiable.entity.HeadwordEntry; import de.digitalcollections.model.list.paging.PageRequest; import de.digitalcollections.model.list.paging.PageResponse; import java.util.*; @@ -13,14 +16,19 @@ import java.util.stream.Stream; import org.apache.commons.lang3.tuple.Pair; import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.ui.Model; import org.springframework.util.CollectionUtils; public class AbstractIdentifiablesController< I extends Identifiable, C extends CudamiIdentifiablesClient> extends AbstractUniqueObjectController { - protected AbstractIdentifiablesController(C service, LanguageService languageService) { + private final CudamiClient cudamiClient; + + protected AbstractIdentifiablesController( + C service, CudamiClient cudamiClient, LanguageService languageService) { super(service, languageService); + this.cudamiClient = cudamiClient; } protected List getExistingLanguagesFromIdentifiable(Identifiable identifiable) { @@ -99,4 +107,76 @@ protected PageResponse search(String searchField, String searchTerm, PageRequ } } } + + public String doForward(Identifiable identifiable, Model model) throws TechnicalException { + final String uuid = identifiable.getUuid().toString(); + IdentifiableObjectType identifiableObjectType = identifiable.getIdentifiableObjectType(); + switch (identifiableObjectType) { + case ARTICLE: + return "forward:/articles/" + uuid; + // List subtopics = + // subtopicService.getSubtopicsOfEntity(entity.getUuid()); + // if (!subtopics.isEmpty()) { + // Subtopic subtopic = subtopics.get(0); + // return "forward:/knowledge/node/" + subtopic.getUuid().toString(); + // } + + case COLLECTION: + return "forward:/collections/" + uuid; + case CORPORATE_BODY: + return "forward:/corporatebodies/" + uuid; + case DIGITAL_OBJECT: + return "forward:/digitalobjects/" + uuid; + case GEO_LOCATION: + return "forward:/geolocations/" + uuid; + // GeoLocation geoLocation = geoLocationsService.findOne(entity.getUuid()); + // GeoLocationType geoLocationType = geoLocation.getGeoLocationType(); + // switch (geoLocationType) { + // case CANYON: + // return "forward:/geo/canyons/" + uuid; + // case CAVE: + // return "forward:/geo/caves/" + uuid; + // case CONTINENT: + // return "forward:/geo/continents/" + uuid; + // case COUNTRY: + // return "forward:/geo/countries/" + uuid; + // case CREEK: + // return "forward:/geo/creeks/" + uuid; + // case HUMAN_SETTLEMENT: + // return "forward:/geo/human_settlements/" + uuid; + // case LAKE: + // return "forward:/geo/lakes/" + uuid; + // case MOUNTAIN: + // return "forward:/geo/mountains/" + uuid; + // case OCEAN: + // return "forward:/geo/oceans/" + uuid; + // case RIVER: + // return "forward:/geo/rivers/" + uuid; + // case SEA: + // return "forward:/geo/seas/" + uuid; + // case STILL_WATERS: + // return "forward:/geo/still_waters/" + uuid; + // case VALLEY: + // return "forward:/geo/valleys/" + uuid; + // } + case HEADWORD_ENTRY: + HeadwordEntry headwordEntry = + cudamiClient.forHeadwordEntries().getByUuid(identifiable.getUuid()); + UUID headwordUuid = headwordEntry.getHeadword().getUuid(); + return "redirect:/headwords/" + headwordUuid; + case ITEM: + return "forward:/items/" + uuid; + case MANIFESTATION: + return "forward:/manifestations/" + uuid; + case PERSON: + return "forward:/persons/" + uuid; + case TOPIC: + return "forward:/topics/" + uuid; + case WORK: + return "forward:/works/" + uuid; + default: + throw new TechnicalException( + "Unhandled object type " + identifiable.getIdentifiableObjectType()); + } + } } diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/IdentifiableController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/IdentifiableController.java index a7c2ccfa12..fd98976165 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/IdentifiableController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/IdentifiableController.java @@ -1,21 +1,16 @@ package de.digitalcollections.cudami.admin.controller.identifiable; import de.digitalcollections.cudami.admin.business.i18n.LanguageService; -import de.digitalcollections.cudami.admin.controller.ParameterHelper; import de.digitalcollections.cudami.client.CudamiClient; import de.digitalcollections.cudami.client.identifiable.CudamiIdentifiablesClient; -import de.digitalcollections.cudami.client.identifiable.entity.CudamiHeadwordEntriesClient; import de.digitalcollections.model.exception.ResourceNotFoundException; import de.digitalcollections.model.exception.TechnicalException; import de.digitalcollections.model.identifiable.Identifiable; -import de.digitalcollections.model.identifiable.IdentifiableObjectType; -import de.digitalcollections.model.identifiable.entity.HeadwordEntry; import de.digitalcollections.model.list.paging.PageRequest; import de.digitalcollections.model.list.paging.PageResponse; import de.digitalcollections.model.list.sorting.Order; import java.nio.charset.StandardCharsets; import java.util.List; -import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.codec.binary.Base64; @@ -30,82 +25,8 @@ public class IdentifiableController extends AbstractIdentifiablesController> { - CudamiHeadwordEntriesClient headwordEntriesService; - public IdentifiableController(CudamiClient client, LanguageService languageService) { - super(client.forIdentifiables(), languageService); - this.headwordEntriesService = client.forHeadwordEntries(); - } - - public String doForward(Identifiable identifiable, Model model) throws TechnicalException { - final String uuid = identifiable.getUuid().toString(); - IdentifiableObjectType identifiableObjectType = identifiable.getIdentifiableObjectType(); - switch (identifiableObjectType) { - case ARTICLE: - return "forward:/articles/" + uuid; - // List subtopics = - // subtopicService.getSubtopicsOfEntity(entity.getUuid()); - // if (!subtopics.isEmpty()) { - // Subtopic subtopic = subtopics.get(0); - // return "forward:/knowledge/node/" + subtopic.getUuid().toString(); - // } - - case COLLECTION: - return "forward:/collections/" + uuid; - case CORPORATE_BODY: - return "forward:/corporatebodies/" + uuid; - case DIGITAL_OBJECT: - return "forward:/digitalobjects/" + uuid; - case GEO_LOCATION: - return "forward:/geolocations/" + uuid; - // GeoLocation geoLocation = geoLocationsService.findOne(entity.getUuid()); - // GeoLocationType geoLocationType = geoLocation.getGeoLocationType(); - // switch (geoLocationType) { - // case CANYON: - // return "forward:/geo/canyons/" + uuid; - // case CAVE: - // return "forward:/geo/caves/" + uuid; - // case CONTINENT: - // return "forward:/geo/continents/" + uuid; - // case COUNTRY: - // return "forward:/geo/countries/" + uuid; - // case CREEK: - // return "forward:/geo/creeks/" + uuid; - // case HUMAN_SETTLEMENT: - // return "forward:/geo/human_settlements/" + uuid; - // case LAKE: - // return "forward:/geo/lakes/" + uuid; - // case MOUNTAIN: - // return "forward:/geo/mountains/" + uuid; - // case OCEAN: - // return "forward:/geo/oceans/" + uuid; - // case RIVER: - // return "forward:/geo/rivers/" + uuid; - // case SEA: - // return "forward:/geo/seas/" + uuid; - // case STILL_WATERS: - // return "forward:/geo/still_waters/" + uuid; - // case VALLEY: - // return "forward:/geo/valleys/" + uuid; - // } - case HEADWORD_ENTRY: - HeadwordEntry headwordEntry = headwordEntriesService.getByUuid(identifiable.getUuid()); - UUID headwordUuid = headwordEntry.getHeadword().getUuid(); - return "redirect:/headwords/" + headwordUuid; - case ITEM: - return "forward:/items/" + uuid; - case MANIFESTATION: - return "forward:/manifestations/" + uuid; - case PERSON: - return "forward:/persons/" + uuid; - case TOPIC: - return "forward:/topics/" + uuid; - case WORK: - return "forward:/works/" + uuid; - default: - throw new TechnicalException( - "Unhandled object type " + identifiable.getIdentifiableObjectType()); - } + super(client.forIdentifiables(), client, languageService); } @GetMapping(value = "/identifiables") @@ -163,24 +84,4 @@ public String viewBase64Encoded(@PathVariable String base64, Model model) } return doForward(identifiable, model); } - - @GetMapping("/identifiables/{uuid:" + ParameterHelper.UUID_PATTERN + "}/view") - public String view(@PathVariable UUID uuid, Model model) - throws TechnicalException, ResourceNotFoundException { - Identifiable identifiable = service.getByUuid(uuid); - if (identifiable == null) { - throw new ResourceNotFoundException(); - } - return doForward(identifiable, model); - } - - @GetMapping("/identifiables/{uuid:" + ParameterHelper.UUID_PATTERN + "}/edit") - public String edit(@PathVariable UUID uuid, Model model) - throws TechnicalException, ResourceNotFoundException { - Identifiable identifiable = service.getByUuid(uuid); - if (identifiable == null) { - throw new ResourceNotFoundException(); - } - return doForward(identifiable, model) + "/edit"; - } } diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/AbstractEntitiesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/AbstractEntitiesController.java index 444cf6137c..4f81e47490 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/AbstractEntitiesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/AbstractEntitiesController.java @@ -2,6 +2,7 @@ import de.digitalcollections.cudami.admin.business.i18n.LanguageService; import de.digitalcollections.cudami.admin.controller.identifiable.AbstractIdentifiablesController; +import de.digitalcollections.cudami.client.CudamiClient; import de.digitalcollections.cudami.client.identifiable.entity.CudamiEntitiesClient; import de.digitalcollections.model.exception.TechnicalException; import de.digitalcollections.model.identifiable.entity.Entity; @@ -12,8 +13,9 @@ public class AbstractEntitiesController> extends AbstractIdentifiablesController { - protected AbstractEntitiesController(C service, LanguageService languageService) { - super(service, languageService); + protected AbstractEntitiesController( + C service, CudamiClient cudamiClient, LanguageService languageService) { + super(service, cudamiClient, languageService); } protected PageResponse search(String searchField, String searchTerm, PageRequest pageRequest) diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesAPIController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesAPIController.java index 37e500f9ba..375987186c 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesAPIController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesAPIController.java @@ -30,7 +30,7 @@ public class ArticlesAPIController private static final Logger LOGGER = LoggerFactory.getLogger(ArticlesAPIController.class); public ArticlesAPIController(CudamiClient client, LanguageService languageService) { - super(client.forArticles(), languageService); + super(client.forArticles(), client, languageService); } @GetMapping("/api/articles/new") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesController.java index 84d32717ae..1571707a57 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ArticlesController.java @@ -27,7 +27,7 @@ public class ArticlesController extends AbstractEntitiesController { public DigitalObjectsController(CudamiClient client, LanguageService languageService) { - super(client.forDigitalObjects(), languageService); + super(client.forDigitalObjects(), client, languageService); } @GetMapping("/digitalobjects") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EntitiesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EntitiesController.java new file mode 100644 index 0000000000..ccf1730ad7 --- /dev/null +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EntitiesController.java @@ -0,0 +1,44 @@ +package de.digitalcollections.cudami.admin.controller.identifiable.entity; + +import de.digitalcollections.cudami.admin.business.i18n.LanguageService; +import de.digitalcollections.cudami.admin.controller.ParameterHelper; +import de.digitalcollections.cudami.client.CudamiClient; +import de.digitalcollections.cudami.client.identifiable.entity.CudamiEntitiesClient; +import de.digitalcollections.model.exception.ResourceNotFoundException; +import de.digitalcollections.model.exception.TechnicalException; +import de.digitalcollections.model.identifiable.entity.Entity; +import java.util.UUID; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +@Controller +public class EntitiesController + extends AbstractEntitiesController> { + + protected EntitiesController( + CudamiEntitiesClient service, CudamiClient cudamiClient, LanguageService languageService) { + super(service, cudamiClient, languageService); + } + + @GetMapping("/entities/{uuid:" + ParameterHelper.UUID_PATTERN + "}") + public String view(@PathVariable UUID uuid, Model model) + throws TechnicalException, ResourceNotFoundException { + Entity entity = service.getByUuid(uuid); + if (entity == null) { + throw new ResourceNotFoundException(); + } + return doForward(entity, model); + } + + @GetMapping("/entities/{uuid:" + ParameterHelper.UUID_PATTERN + "}/edit") + public String edit(@PathVariable UUID uuid, Model model) + throws TechnicalException, ResourceNotFoundException { + Entity entity = service.getByUuid(uuid); + if (entity == null) { + throw new ResourceNotFoundException(); + } + return doForward(entity, model) + "/edit"; + } +} diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsAPIController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsAPIController.java index 8f53d090de..575a961cf0 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsAPIController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsAPIController.java @@ -21,7 +21,7 @@ public class EventsAPIController extends AbstractEntitiesController { public EventsAPIController(CudamiClient client, LanguageService languageService) { - super(client.forEvents(), languageService); + super(client.forEvents(), client, languageService); } /* diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsController.java index fdedca6ff9..6d40ad7211 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EventsController.java @@ -23,7 +23,7 @@ public class EventsController extends AbstractEntitiesController { public EventsController(CudamiClient client, LanguageService languageService) { - super(client.forEvents(), languageService); + super(client.forEvents(), client, languageService); } @GetMapping("/events/new") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesAPIController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesAPIController.java index 8c6af18ee0..f7c4bf13e8 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesAPIController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesAPIController.java @@ -31,7 +31,7 @@ public class HeadwordEntriesAPIController private static final Logger LOGGER = LoggerFactory.getLogger(HeadwordEntriesAPIController.class); public HeadwordEntriesAPIController(CudamiClient client, LanguageService languageService) { - super(client.forHeadwordEntries(), languageService); + super(client.forHeadwordEntries(), client, languageService); } @GetMapping("/api/headwordentries/new") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesController.java index 78ca3d676c..589411697a 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/HeadwordEntriesController.java @@ -28,7 +28,7 @@ public class HeadwordEntriesController private static final Logger LOGGER = LoggerFactory.getLogger(HeadwordEntriesController.class); public HeadwordEntriesController(CudamiClient client, LanguageService languageService) { - super(client.forHeadwordEntries(), languageService); + super(client.forHeadwordEntries(), client, languageService); } @GetMapping("/headwordentries/new") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsAPIController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsAPIController.java index 98a6348735..8d6cf08d75 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsAPIController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsAPIController.java @@ -37,7 +37,7 @@ public class ProjectsAPIController private static final Logger LOGGER = LoggerFactory.getLogger(ProjectsAPIController.class); public ProjectsAPIController(CudamiClient client, LanguageService languageService) { - super(client.forProjects(), languageService); + super(client.forProjects(), client, languageService); } @PostMapping("/api/projects/{uuid:" + ParameterHelper.UUID_PATTERN + "}/digitalobjects") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsController.java index c3b914d8f4..9ca58af1ec 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/ProjectsController.java @@ -27,7 +27,7 @@ public class ProjectsController extends AbstractEntitiesController { public ItemsAPIController(LanguageService languageService, CudamiClient client) { - super(client.forItems(), languageService); + super(client.forItems(), client, languageService); } @SuppressFBWarnings diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ItemsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ItemsController.java index 3b93708dae..572cdfb71e 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ItemsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ItemsController.java @@ -26,7 +26,7 @@ public class ItemsController extends AbstractEntitiesController { public ManifestationsAPIController(CudamiClient client, LanguageService languageService) { - super(client.forManifestations(), languageService); + super(client.forManifestations(), client, languageService); } @SuppressFBWarnings diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ManifestationsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ManifestationsController.java index 1e16cb0799..bb84039de2 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ManifestationsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/ManifestationsController.java @@ -25,7 +25,7 @@ public class ManifestationsController extends AbstractEntitiesController { public ManifestationsController(CudamiClient client, LanguageService languageService) { - super(client.forManifestations(), languageService); + super(client.forManifestations(), client, languageService); } @GetMapping("/manifestations") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksAPIController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksAPIController.java index 7246d9f49d..1153529a40 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksAPIController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksAPIController.java @@ -25,7 +25,7 @@ public class WorksAPIController extends AbstractEntitiesController { public WorksAPIController(CudamiClient client, LanguageService languageService) { - super(client.forWorks(), languageService); + super(client.forWorks(), client, languageService); } @SuppressFBWarnings diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksController.java index da1a838463..6aec8284c2 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/work/WorksController.java @@ -24,7 +24,7 @@ public class WorksController extends AbstractEntitiesController { public WorksController(CudamiClient client, LanguageService languageService) { - super(client.forWorks(), languageService); + super(client.forWorks(), client, languageService); } @GetMapping("/works") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataAPIController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataAPIController.java index 2e759ecf97..c1e78ed97c 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataAPIController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataAPIController.java @@ -38,7 +38,7 @@ public class FileResourcesMetadataAPIController LoggerFactory.getLogger(FileResourcesMetadataAPIController.class); public FileResourcesMetadataAPIController(CudamiClient client, LanguageService languageService) { - super(client.forFileResourcesMetadata(), languageService); + super(client.forFileResourcesMetadata(), client, languageService); } @GetMapping("/api/fileresources/new") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataController.java index 648ddfc0b1..07eccb2db9 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/FileResourcesMetadataController.java @@ -30,7 +30,7 @@ public class FileResourcesMetadataController LoggerFactory.getLogger(FileResourcesMetadataController.class); public FileResourcesMetadataController(CudamiClient client, LanguageService languageService) { - super(client.forFileResourcesMetadata(), languageService); + super(client.forFileResourcesMetadata(), client, languageService); } @GetMapping(value = "/fileresources/new") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/ImageFileResourcesAPIController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/ImageFileResourcesAPIController.java index 46d119c5e4..ceaa284aee 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/ImageFileResourcesAPIController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/resource/ImageFileResourcesAPIController.java @@ -36,7 +36,7 @@ public class ImageFileResourcesAPIController LoggerFactory.getLogger(ImageFileResourcesAPIController.class); public ImageFileResourcesAPIController(CudamiClient client, LanguageService languageService) { - super(client.forImageFileResources(), languageService); + super(client.forImageFileResources(), client, languageService); } @GetMapping("/api/imagefileresources/new") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/semantic/SubjectsAPIController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/semantic/SubjectsAPIController.java index da431a65dd..5e3f849091 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/semantic/SubjectsAPIController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/semantic/SubjectsAPIController.java @@ -2,9 +2,10 @@ import de.digitalcollections.cudami.admin.business.api.service.exceptions.ServiceException; import de.digitalcollections.cudami.admin.business.i18n.LanguageService; -import de.digitalcollections.cudami.admin.controller.AbstractUniqueObjectController; +import de.digitalcollections.cudami.admin.controller.identifiable.AbstractIdentifiablesController; import de.digitalcollections.cudami.admin.model.bootstraptable.BTResponse; import de.digitalcollections.cudami.client.CudamiClient; +import de.digitalcollections.cudami.client.identifiable.entity.semantic.CudamiSubjectsClient; import de.digitalcollections.model.exception.TechnicalException; import de.digitalcollections.model.identifiable.semantic.Subject; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -17,12 +18,13 @@ /** Controller for all public "Subjects" endpoints (API). */ @RestController -public class SubjectsAPIController extends AbstractUniqueObjectController { +public class SubjectsAPIController + extends AbstractIdentifiablesController { private static final Logger LOGGER = LoggerFactory.getLogger(SubjectsAPIController.class); public SubjectsAPIController(CudamiClient client, LanguageService languageService) { - super(client.forSubjects(), languageService); + super(client.forSubjects(), client, languageService); } @SuppressFBWarnings diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/semantic/SubjectsController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/semantic/SubjectsController.java index bbdc939a4a..9f2659cf7b 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/semantic/SubjectsController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/semantic/SubjectsController.java @@ -49,7 +49,7 @@ public SubjectsController( LanguageService languageService, MessageSource messageSource, LabelNotBlankValidator labelNotBlankValidator) { - super(client.forSubjects(), languageService); + super(client.forSubjects(), client, languageService); this.cudamiConfigClient = client.forConfig(); this.labelNotBlankValidator = labelNotBlankValidator; this.messageSource = messageSource; diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/web/WebpagesAPIController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/web/WebpagesAPIController.java index 405072dfb2..6b60fde7ee 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/web/WebpagesAPIController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/web/WebpagesAPIController.java @@ -33,7 +33,7 @@ public class WebpagesAPIController private static final Logger LOGGER = LoggerFactory.getLogger(WebpagesAPIController.class); public WebpagesAPIController(CudamiClient client, LanguageService languageService) { - super(client.forWebpages(), languageService); + super(client.forWebpages(), client, languageService); } @GetMapping("/api/webpages/new") diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/web/WebpagesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/web/WebpagesController.java index 5cfda7ef30..1b34537c02 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/web/WebpagesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/web/WebpagesController.java @@ -34,7 +34,7 @@ public class WebpagesController private final CudamiWebsitesClient websiteService; public WebpagesController(CudamiClient client, LanguageService languageService) { - super(client.forWebpages(), languageService); + super(client.forWebpages(), client, languageService); this.websiteService = client.forWebsites(); } diff --git a/dc-cudami-admin/src/main/resources/templates/topics/view.html b/dc-cudami-admin/src/main/resources/templates/topics/view.html index 97421d2355..91a46014bc 100644 --- a/dc-cudami-admin/src/main/resources/templates/topics/view.html +++ b/dc-cudami-admin/src/main/resources/templates/topics/view.html @@ -298,7 +298,7 @@

Topic

function formatActionsEntities(value, row) { /*[+ - const baseUrl = [[@{'/identifiables'}]] + '/' + row.uuid; + const baseUrl = [[@{'/entities'}]] + '/' + row.uuid; +]*/ return [ renderViewAction(baseUrl + "/view"), From 4c357faef272070bf9a5476db3ab3c096bb2ba44 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Mon, 7 Aug 2023 16:52:51 +0200 Subject: [PATCH 16/18] Fix url path --- dc-cudami-admin/src/main/resources/templates/topics/view.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dc-cudami-admin/src/main/resources/templates/topics/view.html b/dc-cudami-admin/src/main/resources/templates/topics/view.html index 91a46014bc..426f26af53 100644 --- a/dc-cudami-admin/src/main/resources/templates/topics/view.html +++ b/dc-cudami-admin/src/main/resources/templates/topics/view.html @@ -301,7 +301,7 @@

Topic

const baseUrl = [[@{'/entities'}]] + '/' + row.uuid; +]*/ return [ - renderViewAction(baseUrl + "/view"), + renderViewAction(baseUrl), renderEditAction(baseUrl) ].join(' '); } From feac698b480e52df6014a24f251f0a42e71e21e3 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Tue, 8 Aug 2023 08:03:12 +0200 Subject: [PATCH 17/18] Fix constructor --- .../controller/identifiable/entity/EntitiesController.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EntitiesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EntitiesController.java index ccf1730ad7..61e18ebd46 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EntitiesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/entity/EntitiesController.java @@ -17,9 +17,8 @@ public class EntitiesController extends AbstractEntitiesController> { - protected EntitiesController( - CudamiEntitiesClient service, CudamiClient cudamiClient, LanguageService languageService) { - super(service, cudamiClient, languageService); + public EntitiesController(CudamiClient cudamiClient, LanguageService languageService) { + super(cudamiClient.forEntities(), cudamiClient, languageService); } @GetMapping("/entities/{uuid:" + ParameterHelper.UUID_PATTERN + "}") From 92e59987b9ff8341aed07ff9841ed71f15994e10 Mon Sep 17 00:00:00 2001 From: Ralf Eichinger Date: Tue, 8 Aug 2023 08:10:18 +0200 Subject: [PATCH 18/18] Reuse variable --- .../identifiable/AbstractIdentifiablesController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/AbstractIdentifiablesController.java b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/AbstractIdentifiablesController.java index 8657dd0d42..350c0edb4d 100644 --- a/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/AbstractIdentifiablesController.java +++ b/dc-cudami-admin/src/main/java/de/digitalcollections/cudami/admin/controller/identifiable/AbstractIdentifiablesController.java @@ -175,8 +175,7 @@ public String doForward(Identifiable identifiable, Model model) throws Technical case WORK: return "forward:/works/" + uuid; default: - throw new TechnicalException( - "Unhandled object type " + identifiable.getIdentifiableObjectType()); + throw new TechnicalException("Unhandled object type " + identifiableObjectType); } } }