From 3d66c37c460cace2a430f02922d0c1ac7494b477 Mon Sep 17 00:00:00 2001 From: Ruben Andreassen Date: Mon, 4 Dec 2017 13:03:42 +0000 Subject: [PATCH] Squashed commit of the following: commit e19a34609316e0fbd0fd83bc3d452651101ecf2f Author: Ruben Andreassen Date: Mon Dec 4 12:20:54 2017 +0100 Forgot username commit 0d478a726b3f230d97506ac3d051fcfd3b1dd699 Merge: 45288aa 8aa4150 Author: Ruben Andreassen Date: Mon Dec 4 10:56:10 2017 +0100 Merge dataporten into 4334-oauth-dataporten commit 45288aaa1db6898dbab3d2be9760ef026ea7ae3d Merge: caf6371 4648b6a Author: Ruben Date: Fri Dec 1 14:45:44 2017 +0100 Merge pull request #1 from IQSS/develop test commit 4648b6a48cc988a92e119b2f7c12926cb29817b5 Merge: 0f36aa0 fff836c Author: kcondon Date: Thu Nov 30 18:44:35 2017 -0500 Merge pull request #4331 from IQSS/4330-no-affiliation add null check for datasetAuthor.getAffiliation() #4330 commit fff836cc017968e80c06f4b6e6571017cac6a072 Author: Philip Durbin Date: Thu Nov 30 16:39:26 2017 -0500 add null check for datasetAuthor.getAffiliation() #4330 commit 0f36aa0b1c9f43694ce328b7078cc3ea0c84cdc1 Merge: e2878ce fad8669 Author: kcondon Date: Thu Nov 30 15:07:54 2017 -0500 Merge pull request #4325 from IQSS/4324-header-padding Fixed padding layout issue with dataverse name text link in header #4324 commit fad8669594d88dd36dc450491fab8fdb793196cb Author: Michael Heppler Date: Thu Nov 30 10:14:53 2017 -0500 Fixed padding layout issue with dataverse name text link in header. [ref #4324] commit e2878ce22e254768cfd9d0004235d321a35daa31 Merge: d785c5c cb9647f Author: kcondon Date: Wed Nov 29 18:22:53 2017 -0500 Merge pull request #4305 from IQSS/4304-navbar-search use "?" (`?`) rather than "&" (`&`) before "q" #4304 commit d785c5c3be5ec0df372006a18d74f700d2b99ec9 Merge: a881f36 3cc02d0 Author: kcondon Date: Wed Nov 29 18:19:25 2017 -0500 Merge pull request #4302 from IQSS/3700-export-schema.org implement export of schema.org JSON-LD #3700 commit 3cc02d032a2a4607b2bcb4c59f4bab5ab37125b6 Author: Philip Durbin Date: Wed Nov 29 12:53:04 2017 -0500 have dataset page get cached JSON-LD, if available #3700 commit 84224bd93a68bfa924d721b3b91996efd8701ce8 Author: Philip Durbin Date: Wed Nov 29 12:45:53 2017 -0500 guard against null terms.getTermsOfUse() #3700 commit ba9c6bd138140862258c62cbbcbca7a701180b91 Author: Philip Durbin Date: Wed Nov 29 12:28:16 2017 -0500 API: document "schema.org" as a supported export format #3700 commit e5c2528a43575f14a685d69c4ce27f55bd771448 Author: Philip Durbin Date: Wed Nov 29 12:11:17 2017 -0500 capitalize Schema.org in guides #3700 commit 086824dc2651ccea389a83b8c5f91aa469c439c5 Author: Philip Durbin Date: Wed Nov 29 10:57:32 2017 -0500 note that we know "affliation" throws a warning #3700 commit a881f36c567be43dab62de82f24c4112b4cd7975 Merge: b20ab14 23b865c Author: kcondon Date: Tue Nov 28 16:28:04 2017 -0500 Merge pull request #4312 from IQSS/4197-bundle-error Fixed bundle reference to "parent" dataverse for Theme + Widget pg #4197 commit 34859e7e192e6fc8f2100be9b274065c5b4be1c8 Merge: 2f278cc b20ab14 Author: Philip Durbin Date: Tue Nov 28 16:24:56 2017 -0500 Merge branch 'develop' into 3700-export-schema.org #3700 commit 23b865c9473e05b2f7662f69bd0a4ebb5f7313a7 Author: Michael Heppler Date: Tue Nov 28 14:42:12 2017 -0500 Fixed bundle reference to "parent" dataverse for Theme + Widget pg. [ref #4197] commit b20ab147bad9da846a7075b5efd28ec8910a60db Merge: caf6371 8e6354a Author: kcondon Date: Tue Nov 28 14:01:39 2017 -0500 Merge pull request #4277 from IQSS/4197-dv-header 4197 dv header commit 8e6354a0fee38892f3b851b81e12afae48ac743f Author: Michael Heppler Date: Tue Nov 28 13:23:15 2017 -0500 Changed references from "customization" to "theme" in Theme + Widgets pg. [ref #4197] commit c312a85b8d2f96b7e0e77c384afdfd77007b5739 Author: Derek Murphy Date: Tue Nov 28 13:05:39 2017 -0500 Doc rewrites [#4197] Rewrote some text on the config page for clarity, changed terminology usage in dataverse management page to make it more consistent commit f68b81d6d177bd2e4720ff973e47e0216e8e21d3 Author: Michael Heppler Date: Tue Nov 28 12:15:40 2017 -0500 Removed commented out theme logic found in QA. [ref #4197] commit 624922ff42dbc80a1479835ae691a6e8bcac9333 Author: Philip Durbin Date: Tue Nov 28 11:09:26 2017 -0500 when adding row to dataversetheme, use white instead of gray #4197 commit cb9647ffc95ca3282a2d94328a2ac2e24652fa44 Author: Philip Durbin Date: Mon Nov 27 10:27:30 2017 -0500 use "?" (?) rather than "&" (&) before "q" #4304 commit d8028f1abf3d9a97370e386b1ea1e20d9930a4f8 Merge: 36d9228 caf6371 Author: Philip Durbin Date: Mon Nov 27 09:33:03 2017 -0500 Merge branch 'develop' into 4197-dv-header #4197 commit 2f278ccf473cff13de2e4627b15726ec2ba8e4ce Author: Philip Durbin Date: Wed Nov 22 12:33:56 2017 -0500 cleanup #3700 commit b00d4d6f4c091aa68a816f06d3129322fc751122 Author: Philip Durbin Date: Wed Nov 22 12:28:25 2017 -0500 capitalize "Schema.org" #3700 commit 8f526631f3f8aa3cf03223576b974088d4ed26a8 Author: Philip Durbin Date: Wed Nov 22 11:06:41 2017 -0500 implement export of schema.org JSON-LD #3700 commit caf637114f1b8b0083b352e268e991cb9415d713 Merge: c67a39f d80b9d1 Author: kcondon Date: Tue Nov 21 16:29:07 2017 -0500 Merge pull request #4297 from IQSS/orcid_v21 orcid v2.1 changes (mainly https for profile page link) commit c67a39f7dec679ab922ad0fe37b661f8f2fdc5f0 Merge: 0918fae a756751 Author: kcondon Date: Mon Nov 20 15:48:37 2017 -0500 Merge pull request #4252 from IQSS/2243-schema.org-json-ld 2243 schema.org json ld commit d80b9d1bd6c09aa2de107e5b47408414c47b3e44 Author: Pete Meyer Date: Mon Nov 20 14:32:09 2017 -0500 orcid v2.1 changes (mainly https for profile page link) commit 0918faecafcb156d4764fa05777e6034f2dea32c Merge: 3013c0d dcfcbaf Author: kcondon Date: Mon Nov 20 14:31:41 2017 -0500 Merge pull request #4276 from IQSS/4250-ingest-failed make it clear that file upload is complete #4250 commit 3013c0ddb5036f1afbb46ee512831bcc48640731 Merge: b4cea62 3f0f7e8 Author: kcondon Date: Mon Nov 20 14:21:37 2017 -0500 Merge pull request #4275 from IQSS/4262-describe-method move `describe` from EjbDataverseEngine to Command interface #4262 commit 36d92287950b49d9be86979f298a63535bcfa35e Merge: d612189 b4cea62 Author: Philip Durbin Date: Fri Nov 17 16:38:34 2017 -0500 Merge branch 'develop' into 4197-dv-header #4197 commit dcfcbaf63f590362badb0c647a61f7fa59f42f48 Merge: 268c3dc b4cea62 Author: Philip Durbin Date: Fri Nov 17 16:36:21 2017 -0500 Merge branch 'develop' into 4250-ingest-failed #4250 commit 3f0f7e8a7e36727a19bbf456449630409664530a Merge: 633a19d b4cea62 Author: Philip Durbin Date: Fri Nov 17 16:33:37 2017 -0500 Merge branch 'develop' into 4262-describe-method #4262 commit a756751f70945b60bcd3f8018edbf37c9c489c7d Merge: eec1163 b4cea62 Author: Philip Durbin Date: Fri Nov 17 16:32:43 2017 -0500 Merge branch 'develop' into 2243-schema.org-json-ld #2243 Conflicts (just imports: src/main/java/edu/harvard/iq/dataverse/DatasetPage.java commit eec1163fdf60b1fb44c6c635840fd2e1ba22f9ea Author: Leonid Andreev Date: Fri Nov 17 15:58:38 2017 -0500 Per conversation with jgautier stipped the '@type="person"' attribute in the author fragment; since it can be a person or an organization; this results in a warning from google validation tool (because "Thing" is not supposed to have an affiliation) but it appears to be ok to live with it. commit 0801d56fd07db8967f479d04d7ddeef5a2a18c4e Author: Leonid Andreev Date: Fri Nov 17 15:36:04 2017 -0500 ldjson should will only be embedded into the page if this is the LATEST PUBLISHED version (#2243) commit a2742c53c642e009b65620b10bf3a51873e21dc8 Author: Leonid Andreev Date: Fri Nov 17 15:08:40 2017 -0500 latest changest to ld json formatting, making the fragment pass the google validation tool test. (#2243) commit d61218902c0b47ddd37ea6d4a2c8bc0920d0e599 Author: Derek Murphy Date: Fri Nov 17 13:01:55 2017 -0500 Docs: extremely nitpicky word change [#4197] Changed a couple words in the config page. commit d277669672ab92a2678e651335e2b4f22b01186c Author: Michael Heppler Date: Thu Nov 16 16:21:29 2017 -0500 Added tip to Installation Guide > Configuration > Custom Header related to disable root theme. [ref #4197] commit 80219c513f3fe3699ed9e3cfe0207eb76e60289e Author: Derek Murphy Date: Thu Nov 16 11:43:59 2017 -0500 Syntax + typo fix Small edit, fixed a typo and a syntax error in (ironically) a header in the docs commit e0399c1cc274e0294563c071a204bbf2242de9a5 Author: Leonid Andreev Date: Wed Nov 15 19:50:54 2017 -0500 ...and a quick fix for the "temporalCoverage" entry (#2243) commit 67882ff7add249d340715f7f3b0ae364692ee1a0 Author: Leonid Andreev Date: Wed Nov 15 19:41:05 2017 -0500 the ld json fragment should now be structured as specified in the issue #2243. commit 8b8391f92b8c97950016cb40a336ca9307302c42 Author: Leonid Andreev Date: Wed Nov 15 13:24:22 2017 -0500 added topicClassifications and kewords to JSONLD. (#2243) commit 28f705cbf52822a9778b73fb887f9ffe81faf6c7 Author: Philip Durbin Date: Wed Nov 15 12:58:11 2017 -0500 implement :DisableRootDataverseTheme db setting #4197 commit 268c3dcd0ba5552da8209ef71c3b24df5f32a8ff Author: Michael Heppler Date: Wed Nov 15 12:54:50 2017 -0500 Revised ingest error popover message text. Fixed icon spacing issue. [ref #4250] commit 7cd2fea02f1fb746f6af85034b8bbc328f4bbb1f Author: Philip Durbin Date: Wed Nov 15 12:01:57 2017 -0500 Revert "stub out UI for disabling root dataverse theme #4197 " This reverts commit b9c3c56b96b20492c0b3ed81bf7746ca3ff7fcc4. We're going to use a database setting instead. commit b9c3c56b96b20492c0b3ed81bf7746ca3ff7fcc4 Author: Philip Durbin Date: Wed Nov 15 08:53:36 2017 -0500 stub out UI for disabling root dataverse theme #4197 commit 1f938e9155c570c4f274fcd3603e74f369297ce0 Author: Philip Durbin Date: Wed Nov 15 08:18:25 2017 -0500 Revert "only show header for non-root dataverses #4197 " This reverts commit 8eccacd27ff01b68530ce3fd1f0c0a1f139393ac. commit 633a19ddd31efae8b5e5990f21074dd47b3751d1 Author: Philip Durbin Date: Tue Nov 14 19:02:10 2017 -0500 affectedDvObjects is a better name for this field #4262 commit 9a3f4a3101a2a26dc0ca8043595e84056e96ae78 Author: Philip Durbin Date: Tue Nov 14 17:10:06 2017 -0500 add the role to the message #4262 commit 7cfc8bab11e24daca562f2a3ae16cf737e94487e Author: Philip Durbin Date: Tue Nov 14 10:09:18 2017 -0500 override `describe` in AssignRoleCommand #4262 commit 023cb8fdb36e69175d092a5437b54225f2ccd60d Author: Philip Durbin Date: Mon Nov 13 16:09:43 2017 -0500 remove parameters since the Command has them #4262 commit 8eccacd27ff01b68530ce3fd1f0c0a1f139393ac Author: Philip Durbin Date: Mon Nov 13 15:52:37 2017 -0500 only show header for non-root dataverses #4197 commit 7795e7008640d4b7c491ed613e4b944349ae3fe3 Author: Philip Durbin Date: Mon Nov 13 15:22:08 2017 -0500 change header background from gray to white #4197 commit e434dd0a2b3f5b4c22c35a33030f5a62109bd011 Author: Philip Durbin Date: Mon Nov 13 14:28:23 2017 -0500 make it clear that file upload is complete #4250 commit 26eb11d2ed1c3e8c3f5f983bfed6401b9a2c48c9 Author: Philip Durbin Date: Mon Nov 13 14:18:57 2017 -0500 move `describe` from EjbDataverseEngine to Command interface #4262 commit 7d03e70c7d06329e6851160410cb251171b804b3 Author: Philip Durbin Date: Tue Nov 7 16:21:37 2017 -0500 consistency between DC.subject and JSON-LD keywords #2243 commit 9f1d0573443a72716988a7f54b866fae7c3805d8 Author: Leonid Andreev Date: Mon Nov 6 21:58:32 2017 -0500 one more addition for #2243 - added temporalCoverage. commit 8c74e376412ab0a14aed3c1b48fb5720460f2f6c Author: Leonid Andreev Date: Mon Nov 6 21:28:06 2017 -0500 A few quick fixes for getJsonLd() (and the corresponding test in DatasetVersionTest()); (ref #2243) commit c9417815d896a4a385b9a4968453ba23e1f631c4 Author: Philip Durbin Date: Fri Nov 3 12:21:12 2017 -0400 explain why ui:insert lines are in the template #2243 commit 1aa323a0d94d3f31b3befdb2c188326bffda4f7a Author: Philip Durbin Date: Fri Nov 3 12:20:52 2017 -0400 remove unused imports used in this branch #2243 commit f8ca59f32ee4d6f81a348a35b31859d9bf96a1a4 Author: Philip Durbin Date: Fri Nov 3 12:13:05 2017 -0400 add tests for getJsonLd and getPublicationDateAsString #2243 commit b1db8ee00207d9ca5a3ea1459268bfbae12f8cf9 Author: Philip Durbin Date: Fri Nov 3 11:26:37 2017 -0400 rename to publicationDateAsString and improve javadoc #2243 commit 8f3083c3d4b900ebcd14fd21ee6298045335da88 Author: Philip Durbin Date: Fri Nov 3 11:14:13 2017 -0400 delete cruft (unused method) #2243 commit 6c5f0440f04beba54270d882155c34ed8ee28e3a Author: Philip Durbin Date: Thu Nov 2 15:41:12 2017 -0400 use dateModified and proper schemaVersion URL #2243 commit 171c8f3e1c5b340b66900fded3cab53d1180308a Author: Philip Durbin Date: Thu Nov 2 15:29:35 2017 -0400 move getJsonLd method to DatasetVersion entity #2243 commit 485a5ca71a91eb04d1935e3b46f0dc76ded0f15b Author: Philip Durbin Date: Thu Nov 2 15:25:37 2017 -0400 don't even try to figure out if the author is a person or not #2243 commit 80b5a8871e219590e7cc27423160cd5e3b64d7e5 Author: Philip Durbin Date: Thu Nov 2 15:19:49 2017 -0400 limit to non-published, not just non-drafts #2243 Also add helper method. commit ad71c6aa8b05c3cf6ecf90c1023fba2607acef71 Author: Philip Durbin Date: Thu Nov 2 15:17:32 2017 -0400 use same date format as meta name="DC.date" #2243 commit 2cc958dbd907c5027ce2d73fe912f0da193ce0b7 Author: Philip Durbin Date: Wed Nov 1 13:30:15 2017 -0400 fix a number of issues (listed below) #3793 #2243 - only show published versions - show URL to DOI dynamically (was hard coded) - show publication date - show correct publisher - show correct provider commit 5ad88fcd33ad0f0a1fb95cc239191216e2fcd60f Author: Philip Durbin Date: Wed Nov 1 13:15:00 2017 -0400 better author name parsing (could be an org!) #3793 #2243 commit 1b625965835ea1814e2e4534153142dc426f0f79 Author: Philip Durbin Date: Tue Oct 31 14:57:01 2017 -0400 stub out dataset in json-ld format #3793 --- .../source/admin/metadataexport.rst | 9 +- doc/sphinx-guides/source/api/native-api.rst | 2 +- .../source/installation/config.rst | 12 + .../source/user/dataverse-management.rst | 2 +- src/main/java/Bundle.properties | 11 +- .../dataverse/DOIDataCiteRegisterService.java | 2 +- .../edu/harvard/iq/dataverse/DatasetPage.java | 69 +++-- .../harvard/iq/dataverse/DatasetVersion.java | 272 ++++++++++++++++- .../iq/dataverse/DataverseHeaderFragment.java | 12 + .../iq/dataverse/EjbDataverseEngine.java | 15 +- .../harvard/iq/dataverse/SettingsWrapper.java | 4 + .../iq/dataverse/ThemeWidgetFragment.java | 4 +- .../harvard/iq/dataverse/api/Dataverses.java | 4 - .../oauth2/impl/DataportenOAuth2AP.java | 4 +- .../providers/oauth2/impl/OrcidOAuth2AP.java | 2 +- .../engine/command/AbstractCommand.java | 25 +- .../iq/dataverse/engine/command/Command.java | 3 +- .../command/impl/AssignRoleCommand.java | 5 + .../export/SchemaDotOrgExporter.java | 86 ++++++ .../settings/SettingsServiceBean.java | 6 + .../iq/dataverse/util/SystemConfig.java | 4 + src/main/webapp/dataset.xhtml | 9 +- src/main/webapp/dataverse_header.xhtml | 10 +- src/main/webapp/dataverse_template.xhtml | 2 + .../file-download-button-fragment.xhtml | 2 +- src/main/webapp/loginpage.xhtml | 2 +- src/main/webapp/resources/css/structure.css | 6 +- src/main/webapp/themeAndWidgetsFragment.xhtml | 8 +- .../iq/dataverse/DatasetVersionTest.java | 52 ++++ .../export/SchemaDotOrgExporterTest.java | 280 ++++++++++++++++++ 30 files changed, 847 insertions(+), 77 deletions(-) create mode 100644 src/main/java/edu/harvard/iq/dataverse/export/SchemaDotOrgExporter.java create mode 100644 src/test/java/edu/harvard/iq/dataverse/export/SchemaDotOrgExporterTest.java diff --git a/doc/sphinx-guides/source/admin/metadataexport.rst b/doc/sphinx-guides/source/admin/metadataexport.rst index 8c50ceacd84..c6ebef0ce15 100644 --- a/doc/sphinx-guides/source/admin/metadataexport.rst +++ b/doc/sphinx-guides/source/admin/metadataexport.rst @@ -7,7 +7,12 @@ Metadata Export Automatic Exports ----------------- -Unlike in DVN v3, publishing a dataset in Dataverse 4 automaticalliy starts a metadata export job, that will run in the background, asynchronously. Once completed, it will make the dataset metadata exported and cached in all the supported formats (Dublin Core, Data Documentation Initiative (DDI), and native JSON). There is no need to run the export manually. +Publishing a dataset automatically starts a metadata export job, that will run in the background, asynchronously. Once completed, it will make the dataset metadata exported and cached in all the supported formats: + +- Dublin Core +- Data Documentation Initiative (DDI) +- Schema.org JSON-LD +- native JSON (Dataverse-specific) A scheduled timer job that runs nightly will attempt to export any published datasets that for whatever reason haven't been exported yet. This timer is activated automatically on the deployment, or restart, of the application. So, again, no need to start or configure it manually. (See the "Application Timers" section of this guide for more information) @@ -28,4 +33,4 @@ Note, that creating, modifying, or re-exporting an OAI set will also attempt to Export Failures --------------- -An export batch job, whether started via the API, or by the application timer, will leave a detailed log in your configured logs directory. This is the same location where your main Glassfish server.log is found. The name of the log file is ``export_[timestamp].log`` - for example, *export_2016-08-23T03-35-23.log*. The log will contain the numbers of datasets processed successfully and those for which metadata export failed, with some information on the failures detected. Please attach this log file if you need to contact Dataverse support about metadata export problems. \ No newline at end of file +An export batch job, whether started via the API, or by the application timer, will leave a detailed log in your configured logs directory. This is the same location where your main Glassfish server.log is found. The name of the log file is ``export_[timestamp].log`` - for example, *export_2016-08-23T03-35-23.log*. The log will contain the numbers of datasets processed successfully and those for which metadata export failed, with some information on the failures detected. Please attach this log file if you need to contact Dataverse support about metadata export problems. diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index 756966a610c..7b3659d31e3 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -152,7 +152,7 @@ Delete the dataset whose id is passed:: GET http://$SERVER/api/datasets/export?exporter=ddi&persistentId=$persistentId -.. note:: Supported exporters (export formats) are ``ddi``, ``oai_ddi``, ``dcterms``, ``oai_dc``, and ``dataverse_json``. +.. note:: Supported exporters (export formats) are ``ddi``, ``oai_ddi``, ``dcterms``, ``oai_dc``, ``schema.org`` , and ``dataverse_json``. |CORS| Lists all the file metadata, for the given dataset and version:: diff --git a/doc/sphinx-guides/source/installation/config.rst b/doc/sphinx-guides/source/installation/config.rst index 90db8d55afb..6c3335bc414 100644 --- a/doc/sphinx-guides/source/installation/config.rst +++ b/doc/sphinx-guides/source/installation/config.rst @@ -385,6 +385,13 @@ Once you have the location of your custom header HTML file, run this curl comman ``curl -X PUT -d '/var/www/dataverse/branding/custom-header.html' http://localhost:8080/api/admin/settings/:HeaderCustomizationFile`` +If you have enabled a custom header or navbar logo, you might prefer to disable the theme of the root dataverse. You can do so by setting ``:DisableRootDataverseTheme`` to ``true`` like this: + +``curl -X PUT -d 'true' http://localhost:8080/api/admin/settings/:DisableRootDataverseTheme`` + +Please note: Disabling the display of the root dataverse theme also disables your ability to edit it. Remember that dataverse owners can set their dataverses to "inherit theme" from the root. Those dataverses will continue to inherit the root dataverse theme (even though it no longer displays on the root). If you would like to edit the root dataverse theme in the future, you will have to re-enable it first. + + Custom Footer +++++++++++++ @@ -679,6 +686,11 @@ See :ref:`Branding Your Installation` above. See :ref:`Branding Your Installation` above. +:DisableRootDataverseTheme +++++++++++++++++++++++++++ + +See :ref:`Branding Your Installation` above. + :FooterCustomizationFile ++++++++++++++++++++++++ diff --git a/doc/sphinx-guides/source/user/dataverse-management.rst b/doc/sphinx-guides/source/user/dataverse-management.rst index be12c3b32aa..233a2fa0b0c 100755 --- a/doc/sphinx-guides/source/user/dataverse-management.rst +++ b/doc/sphinx-guides/source/user/dataverse-management.rst @@ -61,7 +61,7 @@ Tip: The metadata fields you select as required will appear on the Create Datase Theme ==================================================== -The Theme feature provides you with a way to customize the look of your dataverse. You can decide either to use the customization from the dataverse above yours or upload your own image file. Supported image types are JPEG, TIFF, or PNG and should be no larger than 500 KB. The maximum display size for an image file in a dataverse's theme is 940 pixels wide by 120 pixels high. Additionally, you can select the colors for the header of your dataverse and the text that appears in your dataverse. You can also add a link to your personal website, the website for your organization or institution, your department, journal, etc. +The Theme feature provides you with a way to customize the look of your dataverse. You can decide either to use the theme from the dataverse containing your dataverse (even up to the root dataverse, AKA the homepage), or upload your own image file. Supported image types are JPEG, TIFF, or PNG and should be no larger than 500 KB. The maximum display size for an image file in a dataverse's theme is 940 pixels wide by 120 pixels high. Additionally, you can select the colors for the header of your dataverse and the text that appears in your dataverse. You can also add a link to your personal website, the website for your organization or institution, your department, journal, etc. .. _dataverse-widgets: diff --git a/src/main/java/Bundle.properties b/src/main/java/Bundle.properties index fe0f3e8d3f6..e9b1f43902f 100755 --- a/src/main/java/Bundle.properties +++ b/src/main/java/Bundle.properties @@ -753,9 +753,9 @@ dataverse.results.cards.foundInMetadata=Found in Metadata Fields: dataverse.results.cards.files.tabularData=Tabular Data dataverse.results.solrIsDown=Please note: Due to an internal error, browsing and searching is not available. dataverse.theme.title=Theme -dataverse.theme.inheritCustomization.title=Check this to use the existing theme. -dataverse.theme.inheritCustomization.label=Inherit Customization -dataverse.theme.inheritCustomization.checkbox=Inherit customization from {0} +dataverse.theme.inheritCustomization.title=For this dataverse, use the same theme as the parent dataverse. +dataverse.theme.inheritCustomization.label=Inherit Theme +dataverse.theme.inheritCustomization.checkbox=Inherit theme from {0} dataverse.theme.logo=Logo dataverse.theme.logo.tip=Supported image types are JPG, TIF, or PNG and should be no larger than 500 KB. The maximum display size for an image file in a dataverse's theme is 940 pixels wide by 120 pixels high. dataverse.theme.logo.format=Logo Format @@ -798,6 +798,7 @@ dataverse.theme.website.title=URL for your personal website, institution, or any dataverse.theme.website.tip=The website will be linked behind the tagline. To have a website listed, you must also provide a tagline. dataverse.theme.website.watermark=Your personal site, http://... dataverse.theme.website.invalidMsg=Invalid URL. +dataverse.theme.disabled=The theme for the root dataverse has been administratively disabled with the :DisableRootDataverseTheme database setting. dataverse.widgets.title=Widgets dataverse.widgets.notPublished.why.header=Why Use Widgets? dataverse.widgets.notPublished.why.reason1=Increases the web visibility of your data by allowing you to embed your dataverse and datasets into your personal or project website. @@ -1110,6 +1111,7 @@ dataset.editBtn.itemLabel.deaccession=Deaccession Dataset dataset.exportBtn=Export Metadata dataset.exportBtn.itemLabel.ddi=DDI dataset.exportBtn.itemLabel.dublinCore=Dublin Core +dataset.exportBtn.itemLabel.schemaDotOrg=Schema.org JSON-LD dataset.exportBtn.itemLabel.json=JSON metrics.title=Metrics metrics.title.tip=View more metrics information @@ -1344,7 +1346,8 @@ file.spss-savEncoding.current=Current Selection: file.spss-porExtraLabels=Variable Labels file.spss-porExtraLabels.title=Upload an additional text file with extra variable labels. file.spss-porExtraLabels.selectToAddBtn=Select File to Add -file.ingestFailed=Tabular Data Ingest Failed +file.ingestFailed.header=Upload Completed with Errors +file.ingestFailed.message=Tabular data ingest failed. file.explore.twoRavens=TwoRavens file.map=Map file.mapData=Map Data diff --git a/src/main/java/edu/harvard/iq/dataverse/DOIDataCiteRegisterService.java b/src/main/java/edu/harvard/iq/dataverse/DOIDataCiteRegisterService.java index 17a6b1759eb..e058ecd4b83 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DOIDataCiteRegisterService.java +++ b/src/main/java/edu/harvard/iq/dataverse/DOIDataCiteRegisterService.java @@ -268,7 +268,7 @@ public String generateXML() { if (author.getIdType() != null && author.getIdValue() != null && !author.getIdType().isEmpty() && !author.getIdValue().isEmpty() && author.getAffiliation() != null && !author.getAffiliation().getDisplayValue().isEmpty()) { if (author.getIdType().equals("ORCID")) { - creatorsElement.append("" + author.getIdValue() + ""); + creatorsElement.append("" + author.getIdValue() + ""); } if (author.getIdType().equals("ISNI")) { creatorsElement.append("" + author.getIdValue() + ""); diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java index 2cae4aae9f6..d83ca7a645c 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java @@ -80,11 +80,13 @@ import edu.harvard.iq.dataverse.datasetutility.TwoRavensHelper; import edu.harvard.iq.dataverse.datasetutility.WorldMapPermissionHelper; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; +import edu.harvard.iq.dataverse.engine.command.impl.GetLatestPublishedDatasetVersionCommand; import edu.harvard.iq.dataverse.engine.command.impl.RequestRsyncScriptCommand; import edu.harvard.iq.dataverse.engine.command.impl.PublishDatasetResult; import edu.harvard.iq.dataverse.engine.command.impl.RestrictFileCommand; import edu.harvard.iq.dataverse.engine.command.impl.ReturnDatasetToAuthorCommand; import edu.harvard.iq.dataverse.engine.command.impl.SubmitDatasetForReviewCommand; +import edu.harvard.iq.dataverse.export.SchemaDotOrgExporter; import java.util.Collections; import javax.faces.event.AjaxBehaviorEvent; @@ -3944,23 +3946,6 @@ public String getDescription() { return workingVersion.getDescriptionPlainText(); } - /** - * dataset publication date unpublished datasets will return an empty - * string. - * - * @return String dataset publication date (dd MMM yyyy). - */ - public String getPublicationDate() { - assert (null != workingVersion); - if (DatasetVersion.VersionState.DRAFT == workingVersion.getVersionState()) { - return ""; - } - Date rel_date = workingVersion.getReleaseTime(); - SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); - String r = fmt.format(rel_date.getTime()); - return r; - } - /** * dataset authors * @@ -3971,16 +3956,6 @@ public List getDatasetAuthors() { return workingVersion.getDatasetAuthorNames(); } - /** - * dataset subjects - * - * @return array of String containing the subjects for a page - */ - public List getDatasetSubjects() { - assert (null != workingVersion); - return workingVersion.getDatasetSubjects(); - } - /** * publisher (aka - name of root dataverse) * @@ -4066,4 +4041,44 @@ public List getDatasetSummaryFields() { return DatasetUtil.getDatasetSummaryFields(workingVersion, customFields); } + Boolean thisLatestReleasedVersion = null; + + public boolean isThisLatestReleasedVersion() { + if (thisLatestReleasedVersion != null) { + return thisLatestReleasedVersion; + } + + if (!workingVersion.isPublished()) { + thisLatestReleasedVersion = false; + return false; + } + + DatasetVersion latestPublishedVersion = null; + Command cmd = new GetLatestPublishedDatasetVersionCommand(dvRequestService.getDataverseRequest(), dataset); + try { + latestPublishedVersion = commandEngine.submit(cmd); + } catch (Exception ex) { + // whatever... + } + + thisLatestReleasedVersion = workingVersion.equals(latestPublishedVersion); + + return thisLatestReleasedVersion; + + } + + public String getJsonLd() { + if (isThisLatestReleasedVersion()) { + ExportService instance = ExportService.getInstance(settingsService); + String jsonLd = instance.getExportAsString(dataset, SchemaDotOrgExporter.NAME); + if (jsonLd != null) { + logger.fine("Returning cached schema.org JSON-LD."); + return jsonLd; + } else { + logger.fine("No cached schema.org JSON-LD available. Going to the database."); + return workingVersion.getJsonLd(); + } + } + return ""; + } } diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java b/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java index 030a10244a2..ca5791786a7 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java @@ -3,8 +3,10 @@ import edu.harvard.iq.dataverse.util.MarkupChecker; import edu.harvard.iq.dataverse.DatasetFieldType.FieldType; import edu.harvard.iq.dataverse.util.StringUtil; +import edu.harvard.iq.dataverse.util.SystemConfig; import edu.harvard.iq.dataverse.workflows.WorkflowComment; import java.io.Serializable; +import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -17,6 +19,9 @@ import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; +import javax.json.Json; +import javax.json.JsonArrayBuilder; +import javax.json.JsonObjectBuilder; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -142,6 +147,9 @@ public enum License { @Transient private String contributorNames; + + @Transient + private String jsonLd; @OneToMany(mappedBy="datasetVersion", cascade={CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST}) private List datasetVersionUsers; @@ -417,6 +425,10 @@ public boolean isReleased() { return versionState.equals(VersionState.RELEASED); } + public boolean isPublished() { + return isReleased(); + } + public boolean isDraft() { return versionState.equals(VersionState.DRAFT); } @@ -706,6 +718,42 @@ public List getDatasetAuthors() { return retList; } + public List getTimePeriodsCovered() { + List retList = new ArrayList<>(); + for (DatasetField dsf : this.getDatasetFields()) { + if (dsf.getDatasetFieldType().getName().equals(DatasetFieldConstant.timePeriodCovered)) { + for (DatasetFieldCompoundValue timePeriodValue : dsf.getDatasetFieldCompoundValues()) { + String start = ""; + String end = ""; + for (DatasetField subField : timePeriodValue.getChildDatasetFields()) { + if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.timePeriodCoveredStart)) { + if (subField.isEmptyForDisplay()) { + start = null; + } else { + // we want to use "getValue()", as opposed to "getDisplayValue()" here - + // as the latter method prepends the value with the word "Start:"! + start = subField.getValue(); + } + } + if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.timePeriodCoveredEnd)) { + if (subField.isEmptyForDisplay()) { + end = null; + } else { + // see the comment above + end = subField.getValue(); + } + } + + } + if (start != null && end != null) { + retList.add(start + "/" + end); + } + } + } + } + return retList; + } + /** * @return List of Strings containing the names of the authors. */ @@ -729,7 +777,55 @@ public List getDatasetSubjects() { } return subjects; } - + + /** + * @return List of Strings containing the version's Topic Classifications + */ + public List getTopicClassifications() { + return getCompoundChildFieldValues(DatasetFieldConstant.topicClassification, DatasetFieldConstant.topicClassValue); + } + + /** + * @return List of Strings containing the version's Keywords + */ + public List getKeywords() { + return getCompoundChildFieldValues(DatasetFieldConstant.keyword, DatasetFieldConstant.keywordValue); + } + + /** + * @return List of Strings containing the version's PublicationCitations + */ + public List getPublicationCitationValues() { + return getCompoundChildFieldValues(DatasetFieldConstant.publication, DatasetFieldConstant.publicationCitation); + } + + /** + * @param parentFieldName compound dataset field A (from DatasetFieldConstant.*) + * @param childFieldName dataset field B, child field of A (from DatasetFieldConstant.*) + * @return List of values of the child field + */ + public List getCompoundChildFieldValues(String parentFieldName, String childFieldName) { + List keywords = new ArrayList<>(); + for (DatasetField dsf : this.getDatasetFields()) { + if (dsf.getDatasetFieldType().getName().equals(parentFieldName)) { + for (DatasetFieldCompoundValue keywordFieldValue : dsf.getDatasetFieldCompoundValues()) { + for (DatasetField subField : keywordFieldValue.getChildDatasetFields()) { + if (subField.getDatasetFieldType().getName().equals(childFieldName)) { + String keyword = subField.getValue(); + // Field values should NOT be empty or, especially, null, + // - in the ideal world. But as we are realizing, they CAN + // be null in real life databases. So, a check, just in case: + if (!StringUtil.isEmpty(keyword)) { + keywords.add(subField.getValue()); + } + } + } + } + } + } + return keywords; + } + public String getDatasetProducersString(){ String retVal = ""; for (DatasetField dsf : this.getDatasetFields()) { @@ -1099,4 +1195,178 @@ public List getWorkflowComments() { return workflowComments; } + /** + * dataset publication date unpublished datasets will return an empty + * string. + * + * @return String dataset publication date in ISO 8601 format (yyyy-MM-dd). + */ + public String getPublicationDateAsString() { + if (DatasetVersion.VersionState.DRAFT == this.getVersionState()) { + return ""; + } + Date rel_date = this.getReleaseTime(); + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); + String r = fmt.format(rel_date.getTime()); + return r; + } + + // TODO: Consider moving this comment into the Exporter code. + // The export subsystem assumes there is only + // one metadata export in a given format per dataset (it uses the current + // released (published) version. This JSON fragment is generated for a + // specific released version - and we can have multiple released versions. + // So something will need to be modified to accommodate this. -- L.A. + + public String getJsonLd() { + // We show published datasets only for "datePublished" field below. + if (!this.isPublished()) { + return ""; + } + + if (jsonLd != null) { + return jsonLd; + } + JsonObjectBuilder job = Json.createObjectBuilder(); + job.add("@context", "http://schema.org"); + job.add("@type", "Dataset"); + job.add("identifier", this.getDataset().getPersistentURL()); + job.add("name", this.getTitle()); + JsonArrayBuilder authors = Json.createArrayBuilder(); + for (DatasetAuthor datasetAuthor : this.getDatasetAuthors()) { + JsonObjectBuilder author = Json.createObjectBuilder(); + String name = datasetAuthor.getName().getValue(); + DatasetField authorAffiliation = datasetAuthor.getAffiliation(); + String affiliation = null; + if (authorAffiliation != null) { + affiliation = datasetAuthor.getAffiliation().getValue(); + } + // We are aware of "givenName" and "familyName" but instead of a person it might be an organization such as "Gallup Organization". + //author.add("@type", "Person"); + author.add("name", name); + // We are aware that the following error is thrown by https://search.google.com/structured-data/testing-tool + // "The property affiliation is not recognized by Google for an object of type Thing." + // Someone at Google has said this is ok. + // This logic could be moved into the `if (authorAffiliation != null)` block above. + if (!StringUtil.isEmpty(affiliation)) { + author.add("affiliation", affiliation); + } + authors.add(author); + } + job.add("author", authors); + /** + * We are aware that there is a "datePublished" field but it means "Date + * of first broadcast/publication." This only makes sense for a 1.0 + * version. + */ + String datePublished = this.getDataset().getPublicationDateFormattedYYYYMMDD(); + if (datePublished != null) { + job.add("datePublished", datePublished); + } + + /** + * "dateModified" is more appropriate for a version: "The date on which + * the CreativeWork was most recently modified or when the item's entry + * was modified within a DataFeed." + */ + job.add("dateModified", this.getPublicationDateAsString()); + job.add("version", this.getVersionNumber().toString()); + job.add("description", this.getDescriptionPlainText()); + /** + * "keywords" - contains subject(s), datasetkeyword(s) and topicclassification(s) + * metadata fields for the version. -- L.A. + * (see #2243 for details/discussion/feedback from Google) + */ + JsonArrayBuilder keywords = Json.createArrayBuilder(); + + for (String subject : this.getDatasetSubjects()) { + keywords.add(subject); + } + + for (String topic : this.getTopicClassifications()) { + keywords.add(topic); + } + + for (String keyword : this.getKeywords()) { + keywords.add(keyword); + } + + job.add("keywords", keywords); + + /** + * citation: + * (multiple) publicationCitation values, if present: + */ + + List publicationCitations = getPublicationCitationValues(); + if (publicationCitations.size() > 0) { + JsonArrayBuilder citation = Json.createArrayBuilder(); + for (String pubCitation : publicationCitations) { + //citationEntry.add("@type", "Dataset"); + //citationEntry.add("text", pubCitation); + citation.add(pubCitation); + } + job.add("citation", citation); + } + + /** + * temporalCoverage: + * (if available) + */ + + List timePeriodsCovered = this.getTimePeriodsCovered(); + if (timePeriodsCovered.size() > 0) { + JsonArrayBuilder temporalCoverage = Json.createArrayBuilder(); + for (String timePeriod : timePeriodsCovered) { + temporalCoverage.add(timePeriod); + } + job.add("temporalCoverage", temporalCoverage); + } + + /** + * spatialCoverage (if available) + * TODO + * (punted, for now - see #2243) + * + */ + + /** + * funder (if available) + * TODO + * (punted, for now - see #2243) + */ + + job.add("schemaVersion", "https://schema.org/version/3.3"); + + TermsOfUseAndAccess terms = this.getTermsOfUseAndAccess(); + if (terms != null) { + JsonObjectBuilder license = Json.createObjectBuilder().add("@type", "Dataset"); + + if (TermsOfUseAndAccess.License.CC0.equals(terms.getLicense())) { + license.add("text", "CC0").add("url", "https://creativecommons.org/publicdomain/zero/1.0/"); + } else { + String termsOfUse = terms.getTermsOfUse(); + // Terms of use can be null if you create the dataset with JSON. + if (termsOfUse != null) { + license.add("text", termsOfUse); + } + } + + job.add("license",license); + } + + job.add("includedInDataCatalog", Json.createObjectBuilder() + .add("@type", "DataCatalog") + .add("name", this.getRootDataverseNameforCitation()) + .add("url", SystemConfig.getDataverseSiteUrlStatic()) + ); + + job.add("provider", Json.createObjectBuilder() + .add("@type", "Organization") + .add("name", "Dataverse") + ); + jsonLd = job.build().toString(); + return jsonLd; + } + } diff --git a/src/main/java/edu/harvard/iq/dataverse/DataverseHeaderFragment.java b/src/main/java/edu/harvard/iq/dataverse/DataverseHeaderFragment.java index d3607a27093..dfe6e5e70c9 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DataverseHeaderFragment.java +++ b/src/main/java/edu/harvard/iq/dataverse/DataverseHeaderFragment.java @@ -249,6 +249,18 @@ public boolean isSignupAllowed() { return signupAllowed; } + public boolean isRootDataverseThemeDisabled(Dataverse dataverse) { + if (dataverse == null) { + return false; + } + if (dataverse.getOwner() == null) { + // We're operating on the root dataverse. + return settingsWrapper.isRootDataverseThemeDisabled(); + } else { + return false; + } + } + public String getSignupUrl(String loginRedirect) { String nonNullDefaultIfKeyNotFound = ""; String signUpUrl = settingsWrapper.getValueForKey(SettingsServiceBean.Key.SignUpUrl, nonNullDefaultIfKeyNotFound); diff --git a/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java b/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java index 411c72ac8b7..e36f7feaec3 100644 --- a/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java +++ b/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java @@ -182,7 +182,7 @@ public R submit(Command aCommand) throws CommandException { DataverseRequest dvReq = aCommand.getRequest(); Map affectedDvObjects = aCommand.getAffectedDvObjects(); - logRec.setInfo( describe(affectedDvObjects) ); + logRec.setInfo(aCommand.describe()); for (Map.Entry> pair : requiredMap.entrySet()) { String dvName = pair.getKey(); if (!affectedDvObjects.containsKey(dvName)) { @@ -442,16 +442,5 @@ public DataCaptureModuleServiceBean dataCaptureModule() { return ctxt; } - - - private String describe( Map dvObjMap ) { - StringBuilder sb = new StringBuilder(); - for ( Map.Entry ent : dvObjMap.entrySet() ) { - DvObject value = ent.getValue(); - sb.append(ent.getKey()).append(":"); - sb.append( (value!=null) ? value.accept(DvObject.NameIdPrinter) : ""); - sb.append(" "); - } - return sb.toString(); - } + } diff --git a/src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java b/src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java index 75ae1e00b96..0dfa2d67885 100644 --- a/src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java +++ b/src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java @@ -155,5 +155,9 @@ public String getSupportTeamName() { return BrandingUtil.getSupportTeamName(systemAddress, dataverseService.findRootDataverse().getName()); } + public boolean isRootDataverseThemeDisabled() { + return isTrueForKey(Key.DisableRootDataverseTheme, false); + } + } diff --git a/src/main/java/edu/harvard/iq/dataverse/ThemeWidgetFragment.java b/src/main/java/edu/harvard/iq/dataverse/ThemeWidgetFragment.java index 17b59eb27fd..d9cecd71343 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ThemeWidgetFragment.java +++ b/src/main/java/edu/harvard/iq/dataverse/ThemeWidgetFragment.java @@ -44,8 +44,8 @@ @ViewScoped @Named public class ThemeWidgetFragment implements java.io.Serializable { - static final String DEFAULT_LOGO_BACKGROUND_COLOR = "F5F5F5"; - static final String DEFAULT_BACKGROUND_COLOR = "F5F5F5"; + static final String DEFAULT_LOGO_BACKGROUND_COLOR = "FFFFFF"; + static final String DEFAULT_BACKGROUND_COLOR = "FFFFFF"; static final String DEFAULT_LINK_COLOR = "428BCA"; static final String DEFAULT_TEXT_COLOR = "888888"; private static final Logger logger = Logger.getLogger(ThemeWidgetFragment.class.getCanonicalName()); diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java b/src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java index 97f3925b5ec..b75f8ae4f19 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java @@ -97,10 +97,6 @@ public class Dataverses extends AbstractApiBean { @Deprecated private static final Logger LOGGER = Logger.getLogger(Dataverses.class.getName()); private static final Logger logger = Logger.getLogger(Dataverses.class.getCanonicalName()); -// static final String DEFAULT_LOGO_BACKGROUND_COLOR = "F5F5F5"; -// static final String DEFAULT_BACKGROUND_COLOR = "F5F5F5"; -// static final String DEFAULT_LINK_COLOR = "428BCA"; -// static final String DEFAULT_TEXT_COLOR = "888888"; @EJB ExplicitGroupServiceBean explicitGroupSvc; diff --git a/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/impl/DataportenOAuth2AP.java b/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/impl/DataportenOAuth2AP.java index 8837d57410d..24f9853af47 100644 --- a/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/impl/DataportenOAuth2AP.java +++ b/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/impl/DataportenOAuth2AP.java @@ -1,5 +1,7 @@ package edu.harvard.iq.dataverse.authorization.providers.oauth2.impl; +// Dataporten is a part of ScribeJava in the future https://github.com/scribejava/scribejava/pull/805 +// import com.github.scribejava.apis.DataportenApi; //Uncomment and delete DataportenApi.java when ScribeJava is updated in Maven import com.github.scribejava.core.builder.api.BaseApi; import edu.emory.mathcs.backport.java.util.Collections; import edu.harvard.iq.dataverse.authorization.AuthenticatedUserDisplayInfo; @@ -78,7 +80,7 @@ protected ParsedUserResponse parseUserResponse( String responseBody ) { return new ParsedUserResponse( displayInfo, userObject.getString("userid"), //persistentUserId - userObject.getString("email"), //username + username, //username displayInfo.getEmailAddress().length()>0 ? Collections.singletonList(displayInfo.getEmailAddress()) : Collections.emptyList() ); diff --git a/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/impl/OrcidOAuth2AP.java b/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/impl/OrcidOAuth2AP.java index 030680f29c4..dbc4b0ac4e6 100644 --- a/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/impl/OrcidOAuth2AP.java +++ b/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/impl/OrcidOAuth2AP.java @@ -263,7 +263,7 @@ public String getPersistentIdDescription() { @Override public String getPersistentIdUrlPrefix() { - return "http://orcid.org/"; + return "https://orcid.org/"; } @Override diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/AbstractCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/AbstractCommand.java index e4d0593835b..1876d47fc07 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/AbstractCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/AbstractCommand.java @@ -16,7 +16,7 @@ */ public abstract class AbstractCommand implements Command { - private final Map affectedDataverses; + private final Map affectedDvObjects; private final DataverseRequest request; static protected class DvNamePair { @@ -47,21 +47,21 @@ public AbstractCommand(DataverseRequest aRequest, DvObject anAffectedDvObject) { public AbstractCommand(DataverseRequest aRequest, DvNamePair dvp, DvNamePair... more) { request = aRequest; - affectedDataverses = new HashMap<>(); - affectedDataverses.put(dvp.name, dvp.dvObject); + affectedDvObjects = new HashMap<>(); + affectedDvObjects.put(dvp.name, dvp.dvObject); for (DvNamePair p : more) { - affectedDataverses.put(p.name, p.dvObject); + affectedDvObjects.put(p.name, p.dvObject); } } public AbstractCommand(DataverseRequest aRequest, Map someAffectedDvObjects) { request = aRequest; - affectedDataverses = someAffectedDvObjects; + affectedDvObjects = someAffectedDvObjects; } @Override public Map getAffectedDvObjects() { - return affectedDataverses; + return affectedDvObjects; } @Override @@ -81,4 +81,17 @@ public Map> getRequiredPermissions() { protected User getUser() { return getRequest().getUser(); } + + @Override + public String describe() { + StringBuilder sb = new StringBuilder(); + for (Map.Entry ent : affectedDvObjects.entrySet()) { + DvObject value = ent.getValue(); + sb.append(ent.getKey()).append(":"); + sb.append((value != null) ? value.accept(DvObject.NameIdPrinter) : ""); + sb.append(" "); + } + return sb.toString(); + } + } diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/Command.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/Command.java index 32a8a3cb282..c6093432092 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/Command.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/Command.java @@ -41,5 +41,6 @@ public interface Command { * @return A map of the permissions required for this command */ Map> getRequiredPermissions(); - + + public String describe(); } diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AssignRoleCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AssignRoleCommand.java index 767bee92619..34263599ff0 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AssignRoleCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AssignRoleCommand.java @@ -62,4 +62,9 @@ public Map> getRequiredPermissions() { : Collections.singleton(Permission.ManageDatasetPermissions)); } + @Override + public String describe() { + return grantee + " has been given " + role + " on " + defPoint.accept(DvObject.NameIdPrinter); + } + } diff --git a/src/main/java/edu/harvard/iq/dataverse/export/SchemaDotOrgExporter.java b/src/main/java/edu/harvard/iq/dataverse/export/SchemaDotOrgExporter.java new file mode 100644 index 00000000000..e039407fcf2 --- /dev/null +++ b/src/main/java/edu/harvard/iq/dataverse/export/SchemaDotOrgExporter.java @@ -0,0 +1,86 @@ +package edu.harvard.iq.dataverse.export; + +import com.google.auto.service.AutoService; +import edu.harvard.iq.dataverse.DatasetVersion; +import edu.harvard.iq.dataverse.export.spi.Exporter; +import edu.harvard.iq.dataverse.util.BundleUtil; +import java.io.IOException; +import java.io.OutputStream; +import java.io.StringReader; +import java.util.logging.Logger; +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonReader; + +@AutoService(Exporter.class) +public class SchemaDotOrgExporter implements Exporter { + + private static final Logger logger = Logger.getLogger(SchemaDotOrgExporter.class.getCanonicalName()); + + public static final String NAME = "schema.org"; + + @Override + public void exportDataset(DatasetVersion version, JsonObject json, OutputStream outputStream) throws ExportException { + String jsonLdAsString = version.getJsonLd(); + StringReader stringReader = new StringReader(jsonLdAsString); + JsonReader jsonReader = Json.createReader(stringReader); + JsonObject jsonLdJsonObject = jsonReader.readObject(); + try { + outputStream.write(jsonLdJsonObject.toString().getBytes("UTF8")); + } catch (IOException ex) { + logger.info("IOException calling outputStream.write: " + ex); + } + try { + outputStream.flush(); + } catch (IOException ex) { + logger.info("IOException calling outputStream.flush: " + ex); + } + } + + @Override + public String getProviderName() { + return NAME; + } + + @Override + public String getDisplayName() { + return BundleUtil.getStringFromBundle("dataset.exportBtn.itemLabel.schemaDotOrg"); + } + + @Override + public Boolean isXMLFormat() { + return false; + } + + @Override + public Boolean isHarvestable() { + // Defer harvesting because the current effort was estimated as a "2": https://github.com/IQSS/dataverse/issues/3700 + return false; + } + + @Override + public Boolean isAvailableToUsers() { + return true; + } + + @Override + public String getXMLNameSpace() throws ExportException { + throw new ExportException(SchemaDotOrgExporter.class.getSimpleName() + ": not an XML format."); + } + + @Override + public String getXMLSchemaLocation() throws ExportException { + throw new ExportException(SchemaDotOrgExporter.class.getSimpleName() + ": not an XML format."); + } + + @Override + public String getXMLSchemaVersion() throws ExportException { + throw new ExportException(SchemaDotOrgExporter.class.getSimpleName() + ": not an XML format."); + } + + @Override + public void setParam(String name, Object value) { + // this exporter doesn't need/doesn't currently take any parameters + } + +} diff --git a/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java index 94024bf5949..f163bcaea0f 100644 --- a/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java @@ -309,6 +309,12 @@ Whether Harvesting (OAI) service is enabled // Option to override multiple guides with a single url NavbarGuidesUrl, + /** + * The theme for the root dataverse can get in the way when you try make + * use of HeaderCustomizationFile and LogoCustomizationFile so this is a + * way to disable it. + */ + DisableRootDataverseTheme, // Limit on how many guestbook entries to display on the guestbook-responses page: GuestbookResponsesPageDisplayLimit, diff --git a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java index c99d99a4b05..b69631eac12 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java @@ -277,6 +277,10 @@ public static int getMinutesUntilPasswordResetTokenExpires() { * by the Settings Service configuration. */ public String getDataverseSiteUrl() { + return getDataverseSiteUrlStatic(); + } + + public static String getDataverseSiteUrlStatic() { String hostUrl = System.getProperty(SITE_URL); if (hostUrl != null && !"".equals(hostUrl)) { return hostUrl; diff --git a/src/main/webapp/dataset.xhtml b/src/main/webapp/dataset.xhtml index b425fbc8de1..08f3987b51d 100755 --- a/src/main/webapp/dataset.xhtml +++ b/src/main/webapp/dataset.xhtml @@ -24,16 +24,21 @@ - + - + + + + diff --git a/src/main/webapp/dataverse_header.xhtml b/src/main/webapp/dataverse_header.xhtml index 8ec2ced172f..83662e867d0 100644 --- a/src/main/webapp/dataverse_header.xhtml +++ b/src/main/webapp/dataverse_header.xhtml @@ -48,7 +48,7 @@ - @@ -154,11 +154,13 @@ +
+ style="background:##{!empty dataverse.dataverseTheme.backgroundColor ? dataverse.dataverseTheme.backgroundColor : 'FFFFFF'};" + jsf:rendered="#{showDataverseHeader and !widgetWrapper.widgetView and !dataverseHeaderFragment.isRootDataverseThemeDisabled(dataverse)}"> -