From 2988405deb090ac299f6a6eb114e3af59d658e2d Mon Sep 17 00:00:00 2001 From: Angel Montenegro Date: Wed, 19 Jun 2024 14:17:06 -0600 Subject: [PATCH] Add r ai d identifier (#7044) * Deactivated records should get 409 on GET requests * Add RAiD identifier * Fix unit tests * Fix unit tests --- .../src/main/resources/i18n/identifiers_en.properties | 2 +- .../orcid/core/manager/IdentifierTypeManagerTest.java | 2 +- orcid-persistence/src/main/resources/db-master.xml | 4 +++- .../identifier-types/identifier-type-52-RAiD.xml | 11 +++++++++++ .../resources/db/updates/varchar_to_text_hsqldb.xml | 10 ++++++++++ 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 orcid-persistence/src/main/resources/db/updates/identifier-types/identifier-type-52-RAiD.xml create mode 100644 orcid-persistence/src/main/resources/db/updates/varchar_to_text_hsqldb.xml diff --git a/orcid-core/src/main/resources/i18n/identifiers_en.properties b/orcid-core/src/main/resources/i18n/identifiers_en.properties index 4c9a2c1bf0e..f9610cdd636 100644 --- a/orcid-core/src/main/resources/i18n/identifiers_en.properties +++ b/orcid-core/src/main/resources/i18n/identifiers_en.properties @@ -50,4 +50,4 @@ org.orcid.jaxb.model.record.WorkExternalIdentifierType.proposal-id=Proposal ID org.orcid.jaxb.model.record.WorkExternalIdentifierType.cstr=cstr\: Science and technology resource identification org.orcid.jaxb.model.record.WorkExternalIdentifierType.k10plus=k10plus\: K10plus org.orcid.jaxb.model.record.WorkExternalIdentifierType.cgn=cgn\: Culturegraph Number - +org.orcid.jaxb.model.record.WorkExternalIdentifierType.raid=raid\: RAiD is an identifier for research projects and sub-projects or activies within such projects. diff --git a/orcid-core/src/test/java/org/orcid/core/manager/IdentifierTypeManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/IdentifierTypeManagerTest.java index d0a0e917d62..33ab95c6f4d 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/IdentifierTypeManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/IdentifierTypeManagerTest.java @@ -85,7 +85,7 @@ public void after() { @Test public void test0FetchEntities(){ Map map = idTypeMan.fetchIdentifierTypesByAPITypeName(null); - assertEquals(42+v2Ids.size(), map.size()); + assertEquals(43+v2Ids.size(), map.size()); checkExists(map,"other-id"); for (String id : v2Ids){ checkExists(map, id); diff --git a/orcid-persistence/src/main/resources/db-master.xml b/orcid-persistence/src/main/resources/db-master.xml index 50751220853..b1fc81b796a 100644 --- a/orcid-persistence/src/main/resources/db-master.xml +++ b/orcid-persistence/src/main/resources/db-master.xml @@ -388,5 +388,7 @@ - + + + diff --git a/orcid-persistence/src/main/resources/db/updates/identifier-types/identifier-type-52-RAiD.xml b/orcid-persistence/src/main/resources/db/updates/identifier-types/identifier-type-52-RAiD.xml new file mode 100644 index 00000000000..510fe916951 --- /dev/null +++ b/orcid-persistence/src/main/resources/db/updates/identifier-types/identifier-type-52-RAiD.xml @@ -0,0 +1,11 @@ + + + + select count(*) from identifier_type where id_name='RAiD'; + + INSERT INTO identifier_type (id, id_name, id_resolution_prefix, id_deprecated, date_created, last_modified, primary_use) VALUES (52, 'RAiD', 'https://raid.org/', false, now(), now(), 'professional-activities'); + UPDATE identifier_type SET "case_sensitive" = false WHERE id_name = 'RAiD'; + + \ No newline at end of file diff --git a/orcid-persistence/src/main/resources/db/updates/varchar_to_text_hsqldb.xml b/orcid-persistence/src/main/resources/db/updates/varchar_to_text_hsqldb.xml new file mode 100644 index 00000000000..cd8a562759f --- /dev/null +++ b/orcid-persistence/src/main/resources/db/updates/varchar_to_text_hsqldb.xml @@ -0,0 +1,10 @@ + + + + + ALTER TABLE identifier_type ALTER COLUMN primary_use varchar(1000); + + + \ No newline at end of file