From fc5d0b2ab145cfcc45138a9660c053aff63b2375 Mon Sep 17 00:00:00 2001 From: cesarvh Date: Tue, 27 Oct 2020 13:53:58 -0700 Subject: [PATCH 01/19] NOJIRA Bumping UI and BAMPFA plugin versions --- build.properties | 2 +- cspace-ui/bampfa/build.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index 737e0a8dfd..ff570ad46c 100644 --- a/build.properties +++ b/build.properties @@ -21,7 +21,7 @@ domain.nuxeo=nuxeo-server # UI settings cspace.ui.library.name=cspaceUI -cspace.ui.version=4.0.0-ucb.1 +cspace.ui.version=4.0.0-ucb.2 #nuxeo nuxeo.release=9.10-HF30 diff --git a/cspace-ui/bampfa/build.properties b/cspace-ui/bampfa/build.properties index e38258a11f..22d1b8b50b 100644 --- a/cspace-ui/bampfa/build.properties +++ b/cspace-ui/bampfa/build.properties @@ -3,4 +3,4 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-bampfa tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileBAMPFA -tenant.ui.profile.plugin.version=2.0.0-rc.2 +tenant.ui.profile.plugin.version=2.0.0 From 4e56bfca9135f3806acee7f0996e0099c1c0f928 Mon Sep 17 00:00:00 2001 From: cesarvh Date: Tue, 27 Oct 2020 15:05:48 -0700 Subject: [PATCH 02/19] NOJIRA: Bumped UI version --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index ff570ad46c..e27987cbae 100644 --- a/build.properties +++ b/build.properties @@ -21,7 +21,7 @@ domain.nuxeo=nuxeo-server # UI settings cspace.ui.library.name=cspaceUI -cspace.ui.version=4.0.0-ucb.2 +cspace.ui.version=4.0.0-ucb.3.rc1 #nuxeo nuxeo.release=9.10-HF30 From 65cc02f5be1cb37df76b4be5637e02226d27ecaa Mon Sep 17 00:00:00 2001 From: cesarvh Date: Wed, 28 Oct 2020 12:03:39 -0700 Subject: [PATCH 03/19] NOJIRA: bumped ui plugin --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index e27987cbae..51aefba3ec 100644 --- a/build.properties +++ b/build.properties @@ -21,7 +21,7 @@ domain.nuxeo=nuxeo-server # UI settings cspace.ui.library.name=cspaceUI -cspace.ui.version=4.0.0-ucb.3.rc1 +cspace.ui.version=4.0.0-ucb.3 #nuxeo nuxeo.release=9.10-HF30 From b7c71e3f6591fe92a8ad6e40bf3ef217a6b98196 Mon Sep 17 00:00:00 2001 From: cesarvh Date: Tue, 3 Nov 2020 14:23:31 -0800 Subject: [PATCH 04/19] NOJIRA: Bumped UCBG package version to release 2.0.0 --- cspace-ui/ucbg/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cspace-ui/ucbg/build.properties b/cspace-ui/ucbg/build.properties index b51defa279..e1d6e03fd3 100644 --- a/cspace-ui/ucbg/build.properties +++ b/cspace-ui/ucbg/build.properties @@ -3,4 +3,4 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-ucbg tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileUCBG -tenant.ui.profile.plugin.version=2.0.0-rc.10 +tenant.ui.profile.plugin.version=2.0.0 From d2d20a85968ef0db41b3cf64eb807ab372532773 Mon Sep 17 00:00:00 2001 From: cesarvh Date: Tue, 17 Nov 2020 15:21:06 -0800 Subject: [PATCH 05/19] NOJIRA: bumping ucjeps ui to 2.0.0 --- cspace-ui/ucjeps/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cspace-ui/ucjeps/build.properties b/cspace-ui/ucjeps/build.properties index b00f9e1e10..df5d7ce239 100644 --- a/cspace-ui/ucjeps/build.properties +++ b/cspace-ui/ucjeps/build.properties @@ -3,4 +3,4 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-ucjeps tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileUCJEPS -tenant.ui.profile.plugin.version=2.0.0-rc.4 +tenant.ui.profile.plugin.version=2.0.0 From 3d0031aa550364bd936facd0fd13fc2d17eecc4d Mon Sep 17 00:00:00 2001 From: cesarvh Date: Wed, 2 Dec 2020 10:57:00 -0800 Subject: [PATCH 06/19] NOJIRA: Bumping pahma UI to v2.0.0 --- cspace-ui/pahma/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cspace-ui/pahma/build.properties b/cspace-ui/pahma/build.properties index 893d6894a5..f8c9fbf6db 100644 --- a/cspace-ui/pahma/build.properties +++ b/cspace-ui/pahma/build.properties @@ -3,4 +3,4 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-pahma tenant.ui.profile.plugin.library.name=cspaceUIPluginProfilePAHMA -tenant.ui.profile.plugin.version=2.0.0-rc.9 +tenant.ui.profile.plugin.version=2.0.0 From 07dee1dcc4a359641fd6604507b4eee0756bf397 Mon Sep 17 00:00:00 2001 From: Lam Voong Date: Wed, 16 Dec 2020 14:26:50 -0800 Subject: [PATCH 07/19] CC-1487: add ucbgLabelOrder report to right sidebar --- .../main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml index d868d2343d..59b33a3f5f 100644 --- a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml +++ b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml @@ -2,11 +2,12 @@ Label Orders - ucbgLabelOrder.jrxml + ucbgLabelOrder.jasper CollectionObject - false + + true false false true From 95204ec3ffc2e417e520ab7235c488348f0cae17 Mon Sep 17 00:00:00 2001 From: Lam Voong Date: Fri, 18 Dec 2020 09:58:13 -0800 Subject: [PATCH 08/19] Add migration script for NAGPRA Compliance --- .../post-init/06_nagpra-collectionobject.sql | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100755 src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql diff --git a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql new file mode 100755 index 0000000000..74e9e303e6 --- /dev/null +++ b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql @@ -0,0 +1,86 @@ +/* -- CSpace_v6.0-2 Pre-deploy for PAHMA + * + * CC-1478: migrates data from old to new tables: + * -- collectionobjects_anthropology_nagprainventorynamelist + * to collectionobjects_nagpra_nagprainventorynames + * -- collectionobjects_anthropology_nagpraapplicabilitylist + * to collectionobjects_nagpra_nagpracategories + * -- collectionobjects_pahma_pahmanagpracodelegacylist + * to collectionobjects_nagpra_graveassoccodes + * -- collectionobjects_anthropology_repatriationnotelist + * to collectionobjects_nagpra_repatriationnotes + * -- collectionobjects_anthropology_nagpraculturaldeterminationlist + * to collectionobjects_nagpra_nagpraculturaldeterminations + * + * Run as app_pahma: + * sudo su - app_pahma + * psql -h $DB_HOST -p $DB_PORT -d $PGDATABASE -U nuxeo$CSPACE_INSTANCE_ID -a -f cc1478_migrate.sql > cc1478_migrate.log 2>&1 + * +*/ + +DO $$ +DECLARE + c varchar[]; + carr varchar[] := array[['collectionobjects_anthropology_nagprainventorynamelist', + 'collectionobjects_nagpra_nagprainventorynames'] + , ['collectionobjects_anthropology_nagpraapplicabilitylist', + 'collectionobjects_nagpra_nagpracategories'] + , ['collectionobjects_pahma_pahmanagpracodelegacylist', + 'collectionobjects_nagpra_graveassoccodes'] + , ['collectionobjects_anthropology_repatriationnotelist', + 'collectionobjects_nagpra_repatriationnotes'] + , ['collectionobjects_anthropology_nagpraculturaldeterminationlist', + 'collectionobjects_nagpra_nagpraculturaldeterminations']]; + rc int; + tc0 int; + tc1 int; + tc int; + errmsg text; + +BEGIN + -- Check for correct database + IF (SELECT current_database() = 'pahma_domain_pahma') THEN + + -- Check tables exist + FOREACH c SLICE 1 IN ARRAY carr LOOP + IF ((SELECT true FROM pg_tables WHERE tablename = c[1]) AND (SELECT true FROM pg_tables WHERE tablename = c[2])) THEN + -- RAISE NOTICE 'INFO: TABLES EXIST: %', c[1]; + + -- check for existing and conflicting data on id and pos in new tables + EXECUTE 'select count(*) from ' || c[1] || ' t1 join ' || c[2] || ' t2 on (t1.id = t2.id and t1.pos = t2.pos)' + INTO rc; + + IF rc > 0 THEN + RAISE WARNING 'WARNING: % records in % contain duplicate id, pos.', rc, c[1]; + END IF; + + EXECUTE 'select count(*) from '|| c[2] + INTO tc0; + + -- copy records from original to destination tables + EXECUTE 'insert into '|| c[2] || ' (id, item, pos) ' || + ' select id, item, pos from ' || c[1]; + + EXECUTE 'select count(*) from '|| c[2] + INTO tc1; + + tc := tc1 - tc0; + + RAISE NOTICE 'INFO: INSERTED % % records into %', tc, c[1], c[2]; + + ELSE + RAISE WARNING 'ERROR: TABLE(S) MISSING: % or %', c[1], c[2]; + END IF; + + END LOOP; + + ELSE + RAISE WARNING 'ERROR: Not in pahma_domain_pahma database'; + END IF; + + EXCEPTION + WHEN OTHERS THEN + errmsg := SUBSTR(SQLERRM, 1, 100); + RAISE WARNING 'ERROR: %', errmsg; + +END $$; From 628627a79133b804d6b60b4c8b9e786f2e942462 Mon Sep 17 00:00:00 2001 From: Lam Voong Date: Mon, 21 Dec 2020 15:13:29 -0800 Subject: [PATCH 09/19] CC-1509: Update hiearchy (name/value) for Exhibition records --- .../upgrade/6.0.0/post-init/07_exhibition.sql | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql diff --git a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql new file mode 100644 index 0000000000..94a74ad5f8 --- /dev/null +++ b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql @@ -0,0 +1,58 @@ +/* -- CSpace_v6.0-2 Pre-deploy for PAHMA + * + * CC-1509: Related to CC-1267 + * + * Exhibition data is not being displayed in UI due to changes in CC-1267 to remove Exhibition customizations. + * + * Update hierarchy.primarytype values for exhibition records to remove customization suffix. + * + * Update hierarchy.name values for exhibition repeating group records + * from exhibitions_pahma to exhibitions_common for: + * -- exhibitionStatusGroup + * -- exhibitionSectionGroup + * -- exhibitionObjectGroup + * -- galleryRotationGroup + * +*/ + +DO $$ +DECLARE + uc integer; + errmsg text; + +BEGIN + -- Check for correct database + IF (SELECT current_database() = 'pahma_domain_pahma') THEN + + -- update Exhibition records with correct hiearchy.primarytype + update hierarchy + set primarytype = 'Exhibition' + where primarytype = 'ExhibitionTenant15'; + + get diagnostics uc = row_count; + + RAISE NOTICE '% hierarchy.primarytype records updated for Exhibitions', uc; + + -- update Exhibition repeating group records with correct hiearchy.name + update hierarchy + set name = regexp_replace(name, '^exhibitions_pahma:', 'exhibitions_common:') + where primarytype in ( + 'exhibitionObjectGroup', + 'exhibitionSectionGroup', + 'exhibitionStatusGroup', + 'galleryRotationGroup'); + + get diagnostics uc = row_count; + + RAISE NOTICE '% hierarchy.name records updated for Exhibitions repeating groups', uc; + + ELSE + RAISE WARNING 'ERROR: Not in pahma_domain_pahma database'; + END IF; + + EXCEPTION + WHEN OTHERS THEN + errmsg := SUBSTR(SQLERRM, 1, 100); + RAISE WARNING 'ERROR: %', errmsg; + +END $$; From aad9627196b3ef907c87ecc07961a9ff67097140 Mon Sep 17 00:00:00 2001 From: Lam Voong Date: Mon, 21 Dec 2020 15:51:42 -0800 Subject: [PATCH 10/19] CC-1478 and CC1509: pre-deploy scripts for v6.0.6 --- .../post-init/06_nagpra-collectionobject.sql | 87 +++++++++++++++++++ .../upgrade/6.0.0/post-init/07_exhibition.sql | 58 +++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql create mode 100644 src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql diff --git a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql new file mode 100644 index 0000000000..b97d81a5f0 --- /dev/null +++ b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql @@ -0,0 +1,87 @@ +/* -- CSpace_v6.0-2 Pre-deploy for PAHMA + * + * CC-1478: migrates data from old to new tables: + * -- collectionobjects_anthropology_nagprainventorynamelist + * to collectionobjects_nagpra_nagprainventorynames + * -- collectionobjects_anthropology_nagpraapplicabilitylist + * to collectionobjects_nagpra_nagpracategories + * -- collectionobjects_pahma_pahmanagpracodelegacylist + * to collectionobjects_nagpra_graveassoccodes + * -- collectionobjects_anthropology_repatriationnotelist + * to collectionobjects_nagpra_repatriationnotes + * -- collectionobjects_anthropology_nagpraculturaldeterminationlist + * to collectionobjects_nagpra_nagpraculturaldeterminations + * + * Run as app_pahma: + * sudo su - app_pahma + * psql -h $DB_HOST -p $DB_PORT -d $PGDATABASE -U nuxeo$CSPACE_INSTANCE_ID -a -f cc1478_migrate.sql > cc1478_migrate.log 2>&1 + * +*/ + +DO $$ +DECLARE + c varchar[]; + carr varchar[] := array[['collectionobjects_anthropology_nagprainventorynamelist', + 'collectionobjects_nagpra_nagprainventorynames'] + , ['collectionobjects_anthropology_nagpraapplicabilitylist', + 'collectionobjects_nagpra_nagpracategories'] + , ['collectionobjects_pahma_pahmanagpracodelegacylist', + 'collectionobjects_nagpra_graveassoccodes'] + , ['collectionobjects_anthropology_repatriationnotelist', + 'collectionobjects_nagpra_repatriationnotes'] + , ['collectionobjects_anthropology_nagpraculturaldeterminationlist', + 'collectionobjects_nagpra_nagpraculturaldeterminations']]; + rc int; + tc0 int; + tc1 int; + tc int; + errmsg text; + +BEGIN + -- Check for correct database + IF (SELECT current_database() = 'pahma_domain_pahma') THEN + + -- Check tables exist + FOREACH c SLICE 1 IN ARRAY carr LOOP + IF ((SELECT true FROM pg_tables WHERE tablename = c[1]) AND (SELECT true FROM pg_tables WHERE tablename = c[2])) THEN + -- RAISE NOTICE 'INFO: TABLES EXIST: %', c[1]; + + -- check for existing and conflicting data on id and pos in new tables + EXECUTE 'select count(*) from ' || c[1] || ' t1 join ' || c[2] || ' t2 on (t1.id = t2.id and t1.pos = t2.pos)' + INTO rc; + + IF rc > 0 THEN + RAISE WARNING 'WARNING: % records in % contain duplicate id, pos.', rc, c[1]; + END IF; + + EXECUTE 'select count(*) from '|| c[2] + INTO tc0; + + -- copy records from original to destination tables + EXECUTE 'insert into '|| c[2] || ' (id, item, pos) ' || + ' select id, item, pos from ' || c[1]; + + EXECUTE 'select count(*) from '|| c[2] + INTO tc1; + + tc := tc1 - tc0; + + RAISE NOTICE 'INFO: INSERTED % % records into %', tc, c[1], c[2]; + + ELSE + RAISE WARNING 'ERROR: TABLE(S) MISSING: % or %', c[1], c[2]; + END IF; + + END LOOP; + + ELSE + RAISE WARNING 'ERROR: Not in pahma_domain_pahma database'; + END IF; + + EXCEPTION + WHEN OTHERS THEN + errmsg := SUBSTR(SQLERRM, 1, 100); + RAISE WARNING 'ERROR: %', errmsg; + +END $$; + diff --git a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql new file mode 100644 index 0000000000..94a74ad5f8 --- /dev/null +++ b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql @@ -0,0 +1,58 @@ +/* -- CSpace_v6.0-2 Pre-deploy for PAHMA + * + * CC-1509: Related to CC-1267 + * + * Exhibition data is not being displayed in UI due to changes in CC-1267 to remove Exhibition customizations. + * + * Update hierarchy.primarytype values for exhibition records to remove customization suffix. + * + * Update hierarchy.name values for exhibition repeating group records + * from exhibitions_pahma to exhibitions_common for: + * -- exhibitionStatusGroup + * -- exhibitionSectionGroup + * -- exhibitionObjectGroup + * -- galleryRotationGroup + * +*/ + +DO $$ +DECLARE + uc integer; + errmsg text; + +BEGIN + -- Check for correct database + IF (SELECT current_database() = 'pahma_domain_pahma') THEN + + -- update Exhibition records with correct hiearchy.primarytype + update hierarchy + set primarytype = 'Exhibition' + where primarytype = 'ExhibitionTenant15'; + + get diagnostics uc = row_count; + + RAISE NOTICE '% hierarchy.primarytype records updated for Exhibitions', uc; + + -- update Exhibition repeating group records with correct hiearchy.name + update hierarchy + set name = regexp_replace(name, '^exhibitions_pahma:', 'exhibitions_common:') + where primarytype in ( + 'exhibitionObjectGroup', + 'exhibitionSectionGroup', + 'exhibitionStatusGroup', + 'galleryRotationGroup'); + + get diagnostics uc = row_count; + + RAISE NOTICE '% hierarchy.name records updated for Exhibitions repeating groups', uc; + + ELSE + RAISE WARNING 'ERROR: Not in pahma_domain_pahma database'; + END IF; + + EXCEPTION + WHEN OTHERS THEN + errmsg := SUBSTR(SQLERRM, 1, 100); + RAISE WARNING 'ERROR: %', errmsg; + +END $$; From 8555835b7fd05347de4b61e2c32f9633fbd59fdc Mon Sep 17 00:00:00 2001 From: Lam Voong Date: Tue, 22 Dec 2020 13:59:28 -0800 Subject: [PATCH 11/19] Remove migration and hierarchy update scripts; to be run manually --- .../post-init/06_nagpra-collectionobject.sql | 87 ------------------- .../upgrade/6.0.0/post-init/07_exhibition.sql | 58 ------------- 2 files changed, 145 deletions(-) delete mode 100644 src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql delete mode 100644 src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql diff --git a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql deleted file mode 100644 index b97d81a5f0..0000000000 --- a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql +++ /dev/null @@ -1,87 +0,0 @@ -/* -- CSpace_v6.0-2 Pre-deploy for PAHMA - * - * CC-1478: migrates data from old to new tables: - * -- collectionobjects_anthropology_nagprainventorynamelist - * to collectionobjects_nagpra_nagprainventorynames - * -- collectionobjects_anthropology_nagpraapplicabilitylist - * to collectionobjects_nagpra_nagpracategories - * -- collectionobjects_pahma_pahmanagpracodelegacylist - * to collectionobjects_nagpra_graveassoccodes - * -- collectionobjects_anthropology_repatriationnotelist - * to collectionobjects_nagpra_repatriationnotes - * -- collectionobjects_anthropology_nagpraculturaldeterminationlist - * to collectionobjects_nagpra_nagpraculturaldeterminations - * - * Run as app_pahma: - * sudo su - app_pahma - * psql -h $DB_HOST -p $DB_PORT -d $PGDATABASE -U nuxeo$CSPACE_INSTANCE_ID -a -f cc1478_migrate.sql > cc1478_migrate.log 2>&1 - * -*/ - -DO $$ -DECLARE - c varchar[]; - carr varchar[] := array[['collectionobjects_anthropology_nagprainventorynamelist', - 'collectionobjects_nagpra_nagprainventorynames'] - , ['collectionobjects_anthropology_nagpraapplicabilitylist', - 'collectionobjects_nagpra_nagpracategories'] - , ['collectionobjects_pahma_pahmanagpracodelegacylist', - 'collectionobjects_nagpra_graveassoccodes'] - , ['collectionobjects_anthropology_repatriationnotelist', - 'collectionobjects_nagpra_repatriationnotes'] - , ['collectionobjects_anthropology_nagpraculturaldeterminationlist', - 'collectionobjects_nagpra_nagpraculturaldeterminations']]; - rc int; - tc0 int; - tc1 int; - tc int; - errmsg text; - -BEGIN - -- Check for correct database - IF (SELECT current_database() = 'pahma_domain_pahma') THEN - - -- Check tables exist - FOREACH c SLICE 1 IN ARRAY carr LOOP - IF ((SELECT true FROM pg_tables WHERE tablename = c[1]) AND (SELECT true FROM pg_tables WHERE tablename = c[2])) THEN - -- RAISE NOTICE 'INFO: TABLES EXIST: %', c[1]; - - -- check for existing and conflicting data on id and pos in new tables - EXECUTE 'select count(*) from ' || c[1] || ' t1 join ' || c[2] || ' t2 on (t1.id = t2.id and t1.pos = t2.pos)' - INTO rc; - - IF rc > 0 THEN - RAISE WARNING 'WARNING: % records in % contain duplicate id, pos.', rc, c[1]; - END IF; - - EXECUTE 'select count(*) from '|| c[2] - INTO tc0; - - -- copy records from original to destination tables - EXECUTE 'insert into '|| c[2] || ' (id, item, pos) ' || - ' select id, item, pos from ' || c[1]; - - EXECUTE 'select count(*) from '|| c[2] - INTO tc1; - - tc := tc1 - tc0; - - RAISE NOTICE 'INFO: INSERTED % % records into %', tc, c[1], c[2]; - - ELSE - RAISE WARNING 'ERROR: TABLE(S) MISSING: % or %', c[1], c[2]; - END IF; - - END LOOP; - - ELSE - RAISE WARNING 'ERROR: Not in pahma_domain_pahma database'; - END IF; - - EXCEPTION - WHEN OTHERS THEN - errmsg := SUBSTR(SQLERRM, 1, 100); - RAISE WARNING 'ERROR: %', errmsg; - -END $$; - diff --git a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql deleted file mode 100644 index 94a74ad5f8..0000000000 --- a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql +++ /dev/null @@ -1,58 +0,0 @@ -/* -- CSpace_v6.0-2 Pre-deploy for PAHMA - * - * CC-1509: Related to CC-1267 - * - * Exhibition data is not being displayed in UI due to changes in CC-1267 to remove Exhibition customizations. - * - * Update hierarchy.primarytype values for exhibition records to remove customization suffix. - * - * Update hierarchy.name values for exhibition repeating group records - * from exhibitions_pahma to exhibitions_common for: - * -- exhibitionStatusGroup - * -- exhibitionSectionGroup - * -- exhibitionObjectGroup - * -- galleryRotationGroup - * -*/ - -DO $$ -DECLARE - uc integer; - errmsg text; - -BEGIN - -- Check for correct database - IF (SELECT current_database() = 'pahma_domain_pahma') THEN - - -- update Exhibition records with correct hiearchy.primarytype - update hierarchy - set primarytype = 'Exhibition' - where primarytype = 'ExhibitionTenant15'; - - get diagnostics uc = row_count; - - RAISE NOTICE '% hierarchy.primarytype records updated for Exhibitions', uc; - - -- update Exhibition repeating group records with correct hiearchy.name - update hierarchy - set name = regexp_replace(name, '^exhibitions_pahma:', 'exhibitions_common:') - where primarytype in ( - 'exhibitionObjectGroup', - 'exhibitionSectionGroup', - 'exhibitionStatusGroup', - 'galleryRotationGroup'); - - get diagnostics uc = row_count; - - RAISE NOTICE '% hierarchy.name records updated for Exhibitions repeating groups', uc; - - ELSE - RAISE WARNING 'ERROR: Not in pahma_domain_pahma database'; - END IF; - - EXCEPTION - WHEN OTHERS THEN - errmsg := SUBSTR(SQLERRM, 1, 100); - RAISE WARNING 'ERROR: %', errmsg; - -END $$; From f54894d8212ce071be895b6c6304f1cd522560be Mon Sep 17 00:00:00 2001 From: Lam Voong Date: Tue, 22 Dec 2020 14:04:31 -0800 Subject: [PATCH 12/19] CC-1478-1509-master: remove NAGPRA migration and hierarchy update scripts; to be run manually --- .../post-init/06_nagpra-collectionobject.sql | 86 ------------------- .../upgrade/6.0.0/post-init/07_exhibition.sql | 58 ------------- 2 files changed, 144 deletions(-) delete mode 100755 src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql delete mode 100644 src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql diff --git a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql deleted file mode 100755 index 74e9e303e6..0000000000 --- a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/06_nagpra-collectionobject.sql +++ /dev/null @@ -1,86 +0,0 @@ -/* -- CSpace_v6.0-2 Pre-deploy for PAHMA - * - * CC-1478: migrates data from old to new tables: - * -- collectionobjects_anthropology_nagprainventorynamelist - * to collectionobjects_nagpra_nagprainventorynames - * -- collectionobjects_anthropology_nagpraapplicabilitylist - * to collectionobjects_nagpra_nagpracategories - * -- collectionobjects_pahma_pahmanagpracodelegacylist - * to collectionobjects_nagpra_graveassoccodes - * -- collectionobjects_anthropology_repatriationnotelist - * to collectionobjects_nagpra_repatriationnotes - * -- collectionobjects_anthropology_nagpraculturaldeterminationlist - * to collectionobjects_nagpra_nagpraculturaldeterminations - * - * Run as app_pahma: - * sudo su - app_pahma - * psql -h $DB_HOST -p $DB_PORT -d $PGDATABASE -U nuxeo$CSPACE_INSTANCE_ID -a -f cc1478_migrate.sql > cc1478_migrate.log 2>&1 - * -*/ - -DO $$ -DECLARE - c varchar[]; - carr varchar[] := array[['collectionobjects_anthropology_nagprainventorynamelist', - 'collectionobjects_nagpra_nagprainventorynames'] - , ['collectionobjects_anthropology_nagpraapplicabilitylist', - 'collectionobjects_nagpra_nagpracategories'] - , ['collectionobjects_pahma_pahmanagpracodelegacylist', - 'collectionobjects_nagpra_graveassoccodes'] - , ['collectionobjects_anthropology_repatriationnotelist', - 'collectionobjects_nagpra_repatriationnotes'] - , ['collectionobjects_anthropology_nagpraculturaldeterminationlist', - 'collectionobjects_nagpra_nagpraculturaldeterminations']]; - rc int; - tc0 int; - tc1 int; - tc int; - errmsg text; - -BEGIN - -- Check for correct database - IF (SELECT current_database() = 'pahma_domain_pahma') THEN - - -- Check tables exist - FOREACH c SLICE 1 IN ARRAY carr LOOP - IF ((SELECT true FROM pg_tables WHERE tablename = c[1]) AND (SELECT true FROM pg_tables WHERE tablename = c[2])) THEN - -- RAISE NOTICE 'INFO: TABLES EXIST: %', c[1]; - - -- check for existing and conflicting data on id and pos in new tables - EXECUTE 'select count(*) from ' || c[1] || ' t1 join ' || c[2] || ' t2 on (t1.id = t2.id and t1.pos = t2.pos)' - INTO rc; - - IF rc > 0 THEN - RAISE WARNING 'WARNING: % records in % contain duplicate id, pos.', rc, c[1]; - END IF; - - EXECUTE 'select count(*) from '|| c[2] - INTO tc0; - - -- copy records from original to destination tables - EXECUTE 'insert into '|| c[2] || ' (id, item, pos) ' || - ' select id, item, pos from ' || c[1]; - - EXECUTE 'select count(*) from '|| c[2] - INTO tc1; - - tc := tc1 - tc0; - - RAISE NOTICE 'INFO: INSERTED % % records into %', tc, c[1], c[2]; - - ELSE - RAISE WARNING 'ERROR: TABLE(S) MISSING: % or %', c[1], c[2]; - END IF; - - END LOOP; - - ELSE - RAISE WARNING 'ERROR: Not in pahma_domain_pahma database'; - END IF; - - EXCEPTION - WHEN OTHERS THEN - errmsg := SUBSTR(SQLERRM, 1, 100); - RAISE WARNING 'ERROR: %', errmsg; - -END $$; diff --git a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql b/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql deleted file mode 100644 index 94a74ad5f8..0000000000 --- a/src/main/resources/db/postgresql/upgrade/6.0.0/post-init/07_exhibition.sql +++ /dev/null @@ -1,58 +0,0 @@ -/* -- CSpace_v6.0-2 Pre-deploy for PAHMA - * - * CC-1509: Related to CC-1267 - * - * Exhibition data is not being displayed in UI due to changes in CC-1267 to remove Exhibition customizations. - * - * Update hierarchy.primarytype values for exhibition records to remove customization suffix. - * - * Update hierarchy.name values for exhibition repeating group records - * from exhibitions_pahma to exhibitions_common for: - * -- exhibitionStatusGroup - * -- exhibitionSectionGroup - * -- exhibitionObjectGroup - * -- galleryRotationGroup - * -*/ - -DO $$ -DECLARE - uc integer; - errmsg text; - -BEGIN - -- Check for correct database - IF (SELECT current_database() = 'pahma_domain_pahma') THEN - - -- update Exhibition records with correct hiearchy.primarytype - update hierarchy - set primarytype = 'Exhibition' - where primarytype = 'ExhibitionTenant15'; - - get diagnostics uc = row_count; - - RAISE NOTICE '% hierarchy.primarytype records updated for Exhibitions', uc; - - -- update Exhibition repeating group records with correct hiearchy.name - update hierarchy - set name = regexp_replace(name, '^exhibitions_pahma:', 'exhibitions_common:') - where primarytype in ( - 'exhibitionObjectGroup', - 'exhibitionSectionGroup', - 'exhibitionStatusGroup', - 'galleryRotationGroup'); - - get diagnostics uc = row_count; - - RAISE NOTICE '% hierarchy.name records updated for Exhibitions repeating groups', uc; - - ELSE - RAISE WARNING 'ERROR: Not in pahma_domain_pahma database'; - END IF; - - EXCEPTION - WHEN OTHERS THEN - errmsg := SUBSTR(SQLERRM, 1, 100); - RAISE WARNING 'ERROR: %', errmsg; - -END $$; From 55d103778734d42fc0ef10f7aed2a6e2b6194a6a Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Tue, 22 Dec 2020 14:32:17 -0800 Subject: [PATCH 13/19] CC-1480: Bumping version of pahma ui plugin to use. --- cspace-ui/pahma/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cspace-ui/pahma/build.properties b/cspace-ui/pahma/build.properties index 05268f81e7..fb0c898235 100644 --- a/cspace-ui/pahma/build.properties +++ b/cspace-ui/pahma/build.properties @@ -3,4 +3,4 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-pahma tenant.ui.profile.plugin.library.name=cspaceUIPluginProfilePAHMA -tenant.ui.profile.plugin.version=3.0.0-d.5 +tenant.ui.profile.plugin.version=3.0.0-d.7 From 4cc72dff762fef1633e5e9dde180e00fb6d5b724 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Tue, 22 Dec 2020 16:41:04 -0800 Subject: [PATCH 14/19] CC-1480: Updating to latest version of pahma ui plugin. --- cspace-ui/pahma/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cspace-ui/pahma/build.properties b/cspace-ui/pahma/build.properties index fb0c898235..ef928c12fb 100644 --- a/cspace-ui/pahma/build.properties +++ b/cspace-ui/pahma/build.properties @@ -3,4 +3,4 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-pahma tenant.ui.profile.plugin.library.name=cspaceUIPluginProfilePAHMA -tenant.ui.profile.plugin.version=3.0.0-d.7 +tenant.ui.profile.plugin.version=3.0.0-d.8 From 31e75ca91fdc7b142b69e1c768a2352da8bd93e8 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Tue, 22 Dec 2020 16:58:26 -0800 Subject: [PATCH 15/19] NOJIRA: Updating payload for ucbgLabelOrder report to accept single records. --- .../main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml index d868d2343d..34231cd02e 100644 --- a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml +++ b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml @@ -6,7 +6,8 @@ CollectionObject - false + + true false false true From 403ada333c38e8a9a5e729d0e972e8a84be5ac01 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Tue, 22 Dec 2020 17:01:16 -0800 Subject: [PATCH 16/19] NOJIRA: Updating payload for ucbgLabelOrder report to accept single records. --- .../src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml index 34231cd02e..d8b736b398 100644 --- a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml +++ b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/ucbg/payloads/ucbgLabelOrder.xml @@ -2,7 +2,7 @@ Label Orders - ucbgLabelOrder.jrxml + ucbgLabelOrder.jasper CollectionObject From 187fef0dd12e5e2c9417a2680c5129b0e7f9e886 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Wed, 23 Dec 2020 15:12:09 -0800 Subject: [PATCH 17/19] CC-1492: Lam's report for creating CSV output for NAGRPA repatriation cataloging data. --- .../pahma/pahmaRepatriationNAGPRA.jrxml | 207 ++++++++++++++++++ .../payloads/pahmaRepatriationNAGPRA.xml | 20 ++ 2 files changed, 227 insertions(+) create mode 100644 services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/pahmaRepatriationNAGPRA.jrxml create mode 100644 services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/payloads/pahmaRepatriationNAGPRA.xml diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/pahmaRepatriationNAGPRA.jrxml b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/pahmaRepatriationNAGPRA.jrxml new file mode 100644 index 0000000000..bf24fc2c3a --- /dev/null +++ b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/pahmaRepatriationNAGPRA.jrxml @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/payloads/pahmaRepatriationNAGPRA.xml b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/payloads/pahmaRepatriationNAGPRA.xml new file mode 100644 index 0000000000..f96755b6e2 --- /dev/null +++ b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/payloads/pahmaRepatriationNAGPRA.xml @@ -0,0 +1,20 @@ + + + + Repatriation and NAGPRA Compliance + pahmaRepatriationNAGPRA.jasper + + Group + CollectionObject + + true + true + true + false + false + + text/csv + + text/csv + + From 8ba49954b8b72276f93bcffb230b5de227e13d83 Mon Sep 17 00:00:00 2001 From: Lam Voong Date: Thu, 14 Jan 2021 13:43:12 -0800 Subject: [PATCH 18/19] CC-1538: update NAGPRA table names --- .../resources/tenants/pahma/pahmaGroupNAGPRAexcel.jrxml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/pahmaGroupNAGPRAexcel.jrxml b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/pahmaGroupNAGPRAexcel.jrxml index 8e5177f373..80e50842ac 100644 --- a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/pahmaGroupNAGPRAexcel.jrxml +++ b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/pahmaGroupNAGPRAexcel.jrxml @@ -63,7 +63,7 @@ COALESCE(STRING_AGG(DISTINCT getdispl(fcoll.item),'␥'),'') AS "Field_collector COALESCE(scd.datedisplaydate,'') AS "Field_collection_date", COALESCE(REGEXP_REPLACE(cc.fieldcollectionnote, E'[\\n\\r]+', '¶', 'g' ),'') AS "Field_collection_note", COALESCE(cp.pahmatmslegacydepartment,'') AS "Legacy_department", -COALESCE(STRING_AGG(DISTINCT nal.item,'␥'),'') AS "Museums_NAGPRA_category_determinations", +COALESCE(STRING_AGG(DISTINCT getdispl(nc.item),'␥'),'') AS "Museums_NAGPRA_category_determinations", COALESCE(STRING_AGG(DISTINCT getdispl(inv.item),'␥'),'') AS "NAGPRA_inventory", COALESCE(STRING_AGG(DISTINCT acc.accnumber,'␥'),'') AS "Accession_numbers", COALESCE(STRING_AGG(DISTINCT acc.accdate, '␥'),'') AS "Accession_dates", @@ -107,8 +107,8 @@ JOIN hierarchy h1 ON (cc.id=h1.id) LEFT OUTER JOIN hierarchy hn ON (cc.id=hn.parentid AND hn.name='collectionobjects_common:objectNameList' AND (hn.pos=0)) LEFT OUTER JOIN objectnamegroup ong ON (ong.id=hn.id) LEFT OUTER JOIN collectionobjects_common_briefdescriptions bd ON (bd.id=cc.id AND (bd.pos=0)) -LEFT OUTER JOIN collectionobjects_anthropology_nagpraapplicabilitylist nal ON (nal.id=cc.id) -LEFT OUTER JOIN collectionobjects_anthropology_nagprainventorynamelist inv ON (inv.id=cc.id) +LEFT OUTER JOIN collectionobjects_nagpra_nagpracategories nc ON (nc.id=cc.id) +LEFT OUTER JOIN collectionobjects_nagpra_nagprainventorynames inv ON (inv.id=cc.id) LEFT OUTER JOIN collectionobjects_pahma_pahmafieldcollectionplacelist fcp ON (fcp.id=cc.id AND (fcp.pos=0 OR fcp.pos IS NULL)) LEFT OUTER JOIN places_common pcfcp ON (pcfcp.shortidentifier=REGEXP_REPLACE(fcp.item, '^.*item:name\((.*?)\)''.*', '\1')) LEFT OUTER JOIN hierarchy pcsidfcp ON (pcfcp.id=pcsidfcp.id) From 0ddd9d5aaf887f41606f1dbb067f16833227b121 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Thu, 28 Jan 2021 10:10:43 -0800 Subject: [PATCH 19/19] CC-1559: Added support for creating DB/repo specific schemas. --- .../services/common/ServiceMain.java | 69 +++++++++++++------ .../grant_pahma_reporters_privileges.sql | 5 +- .../pahma/payloads/2021NAGPRASAMPLE.xml | 64 +++++++++++++++++ 3 files changed, 116 insertions(+), 22 deletions(-) create mode 100644 services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/payloads/2021NAGPRASAMPLE.xml diff --git a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java index dbd183ddd4..2388cb7a92 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java +++ b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java @@ -117,6 +117,8 @@ private static void mirrorToStdOut(String str) { private static final String DROP_OBJECTS_SQL_COMMENT = "-- drop all the objects before dropping roles"; private static final String CSPACE_JEESERVER_HOME = "CSPACE_JEESERVER_HOME"; + private static final String CSPACE_UTILS_SCHEMANAME = "utils"; + private ServiceMain() { // Intentionally blank } @@ -770,7 +772,7 @@ public void firePostInitHandlers() throws Exception { Object o = instantiate(initHandlerClassname, IInitHandler.class); if (o != null && o instanceof IInitHandler){ IInitHandler handler = (IInitHandler)o; - handler.onRepositoryInitialized(JDBCTools.NUXEO_DATASOURCE_NAME, repositoryName, cspaceInstanceId, + handler.onRepositoryInitialized(JDBCTools.CSADMIN_NUXEO_DATASOURCE_NAME, repositoryName, cspaceInstanceId, sbt, fields, props); //The InitHandler may be the default one, // or specialized classes which still implement this interface and are registered in tenant-bindings.xml. @@ -957,7 +959,8 @@ private HashSet createNuxeoDatabases() throws Exception { JDBCTools.createNewDatabaseUser(JDBCTools.CSADMIN_DATASOURCE_NAME, repositoryName, cspaceInstanceId, dbType, readerUser, readerPW); } // Create the database - createDatabaseWithRights(dbType, dbName, nuxeoUser, nuxeoPW, readerUser, readerPW); + createDatabaseWithRights(dbType, dbName, nuxeoUser, nuxeoPW, readerUser); + createUtilsSchemaWithRights(dbType, nuxeoUser, repositoryName, cspaceInstanceId); initRepositoryDatabaseVersion(JDBCTools.NUXEO_DATASOURCE_NAME, repositoryName, cspaceInstanceId); } nuxeoDBsChecked.add(dbName); @@ -984,7 +987,7 @@ private HashSet createNuxeoDatabases() throws Exception { * @throws Exception */ private void createDatabaseWithRights(DatabaseProductType dbType, String dbName, String ownerName, - String ownerPW, String readerName, String readerPW) throws Exception { + String ownerPW, String readerName) throws Exception { Connection conn = null; Statement stmt = null; @@ -1009,30 +1012,56 @@ private void createDatabaseWithRights(DatabaseProductType dbType, String dbName, } // Note that select rights for reader must be granted after // Nuxeo startup. - } else if (dbType == DatabaseProductType.MYSQL) { - sql = "CREATE database " + dbName + " DEFAULT CHARACTER SET utf8"; - stmt.executeUpdate(sql); - sql = "GRANT ALL PRIVILEGES ON " + dbName + ".* TO '" + ownerName + "'@'localhost' IDENTIFIED BY '" - + ownerPW + "' WITH GRANT OPTION"; + } else { + throw new UnsupportedOperationException(String.format("", dbType)); + } + } catch (Exception e) { + String errMsg = String.format("The following SQL statement failed using credentials from datasource '%s': %s", + JDBCTools.CSADMIN_DATASOURCE_NAME, sql); + logger.error("createDatabaseWithRights failed on exception: " + e.getLocalizedMessage()); + if (errMsg != null) { + logger.error(errMsg); + } + throw e; // propagate + } finally { // close resources + try { + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (SQLException se) { + se.printStackTrace(); + } + } + } + + /* + * For a specific repo/db, create a schema for misc SQL functions + */ + private void createUtilsSchemaWithRights(DatabaseProductType dbType, String ownerName, + String repositoryName, String cspaceInstanceId) throws Exception { + Connection conn = null; + Statement stmt = null; + + String sql = null; + try { + conn = JDBCTools.getConnection(JDBCTools.CSADMIN_NUXEO_DATASOURCE_NAME, repositoryName, cspaceInstanceId); + stmt = conn.createStatement(); + if (dbType == DatabaseProductType.POSTGRESQL) { + sql = "CREATE SCHEMA IF NOT EXISTS " + CSPACE_UTILS_SCHEMANAME + " AUTHORIZATION " + ownerName; stmt.executeUpdate(sql); if (logger.isDebugEnabled()) { - logger.debug("Created db: '" + dbName + "' with owner: '" + ownerName + "'"); - } - if (readerName != null) { - sql = "GRANT SELECT ON " + dbName + ".* TO '" + readerName + "'@'localhost' IDENTIFIED BY '" - + readerPW + "' WITH GRANT OPTION"; - stmt.executeUpdate(sql); - if (logger.isDebugEnabled()) { - logger.debug(" Granted SELECT rights on: '" + dbName + "' to reader: '" + readerName + "'"); - } + logger.debug("Created SCHEMA: '" + CSPACE_UTILS_SCHEMANAME + "' with owner: '" + ownerName + "'"); } } else { - throw new UnsupportedOperationException("createDatabaseWithRights only supports PSQL - MySQL NYI!"); + throw new UnsupportedOperationException("CollectionSpace supports only PostgreSQL database servers."); } } catch (Exception e) { String errMsg = String.format("The following SQL statement failed using credentials from datasource '%s': %s", - JDBCTools.CSADMIN_DATASOURCE_NAME, sql); - logger.error("createDatabaseWithRights failed on exception: " + e.getLocalizedMessage()); + JDBCTools.CSADMIN_NUXEO_DATASOURCE_NAME, sql); + logger.error("createUtilsSchemaWithRights() failed with exception: " + e.getLocalizedMessage()); if (errMsg != null) { logger.error(errMsg); } diff --git a/services/common/src/main/resources/db/postgresql/grant_pahma_reporters_privileges.sql b/services/common/src/main/resources/db/postgresql/grant_pahma_reporters_privileges.sql index 7bee1875d9..11540b4a0e 100644 --- a/services/common/src/main/resources/db/postgresql/grant_pahma_reporters_privileges.sql +++ b/services/common/src/main/resources/db/postgresql/grant_pahma_reporters_privileges.sql @@ -4,7 +4,8 @@ BEGIN SELECT * FROM pg_catalog.pg_group WHERE groname = 'reporters_pahma') THEN - - GRANT SELECT ON ALL TABLES IN SCHEMA public TO GROUP reporters_pahma; + ELSE + CREATE ROLE reporters_pahma with nologin; END IF; + GRANT SELECT ON ALL TABLES IN SCHEMA public TO GROUP reporters_pahma; END $$; diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/payloads/2021NAGPRASAMPLE.xml b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/payloads/2021NAGPRASAMPLE.xml new file mode 100644 index 0000000000..f25a7db202 --- /dev/null +++ b/services/report/3rdparty/jasper-cs-report/src/main/resources/tenants/pahma/payloads/2021NAGPRASAMPLE.xml @@ -0,0 +1,64 @@ + + + + 2021NAGPRASAMPLE + + + + urn:cspace:pahma.cspace.berkeley.edu:vocabularies:name(pahmaNagpraCodeLegacies):item:name(pahmaNagpraCodeLegacies10)' 10: not reportable' + + + Repat notes for MN 2021NAGPRASAMPLE + + + urn:cspace:pahma.cspace.berkeley.edu:vocabularies:name(nagpraPahmaApplicabilities):item:name(nagpraPahmaApplicabilities01)'affiliated human skeletal remains (HSR)' + + + + urn:cspace:pahma.cspace.berkeley.edu:orgauthorities:name(organization):item:name(NAGPRA1611346562666)'NAGPRA' + RH note for PAHMA-NAGPRA Staff + + true + + + 1/1/2001 + 2001-01-02T00:00:00.000Z + + + + 1 + + 2001 + + + + 1 + urn:cspace:pahma.cspace.berkeley.edu:vocabularies:name(dateera):item:name(ce)'CE' + + + + + + 2001-01-01T00:00:00.000Z + + + true + urn:cspace:pahma.cspace.berkeley.edu:orgauthorities:name(organization):item:name(PAHMANAGPRAStaff1611346539517)'PAHMA-NAGPRA Staff' + + + + PAHMA cultural determination notes for 2021NAGPRASAMPLE + + + urn:cspace:pahma.cspace.berkeley.edu:vocabularies:name(nagpraPahmaInventoryNames):item:name(nagpraPahmaInventoryNames01)'AK-Alaska' + + + + urn:cspace:pahma.cspace.berkeley.edu:vocabularies:name(nagpradetermtype):item:name(unknown1)'unknown1' + urn:cspace:pahma.cspace.berkeley.edu:personauthorities:name(person):item:name(NatashaJohnson1611346486489)'Natasha Johnson' + CD note for 2021NAGPRASAMPLE + urn:cspace:pahma.cspace.berkeley.edu:orgauthorities:name(organization):item:name(KaagwaantaanClanofKlukwan1611346415910)'Kaagwaantaan Clan of Klukwan' + + + +