Skip to content

Commit 57a392d

Browse files
authored
Merge pull request #5832 from IQSS/develop
v4.14
2 parents a68b59d + 07c05b4 commit 57a392d

112 files changed

Lines changed: 171869 additions & 834 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ nb-configuration.xml
22
target
33
infer-out
44
nbactions.xml
5+
.settings
6+
.classpath
7+
.project
58
michael-local
69
GPATH
710
GTAGS
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
<!-- Global site tag (gtag.js) - Google Analytics -->
2+
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=YOUR ACCOUNT CODE"></script>
3+
<script>
4+
window.dataLayer = window.dataLayer || [];
5+
function gtag(){dataLayer.push(arguments);}
6+
gtag('js', new Date()); gtag('config', 'YOUR ACCOUNT CODE');
7+
</script>
8+
<script>
9+
window.addEventListener("load", enableAnalyticsEventCapture, false);
10+
11+
function enableAnalyticsEventCapture() {
12+
// Download button
13+
$(document).on("click", ".btn-download", function() {
14+
var category = $(this).text();
15+
var label = getFileId($(this));
16+
gtag('event', 'Download',{'event_category' : category,
17+
'event_label' : label});
18+
});
19+
20+
// Request Access button
21+
$(document).on("click", ".btn-request", function() {
22+
var category = $(this).text();
23+
var label = getFileId($(this));
24+
gtag('event', 'Request Access', {'event_category' : category,
25+
'event_label' : label});
26+
});
27+
28+
// Explore button
29+
$(document).on("click", ".btn-explore + ul.dropdown-menu li a", function() {
30+
var category = $(this).text();
31+
var label = getFileId($(this));
32+
gtag('event', 'Explore', {'event_category' : category,
33+
'event_label' : label});
34+
});
35+
36+
// Compute button
37+
$(document).on("click", ".btn-compute", function() {
38+
var category = $(this).text();
39+
var label = getFileId($(this));
40+
gtag('event', 'Compute', {'event_category' : category,
41+
'event_label' : label});
42+
});
43+
44+
// Preview button
45+
$(document).on("click", ".btn-preview", function() {
46+
var category = $(this).text();
47+
var label = getFileId($(this));
48+
gtag('event', 'Preview', {'event_category' : category,
49+
'event_label' : label});
50+
});
51+
52+
// Cite button
53+
$(document).on("click", ".downloadCitation + ul.dropdown-menu li a", function() {
54+
var category = $(this).text();
55+
var label = 'Unknown';
56+
if($('#fileForm').length > 0) {
57+
label = stripId($('#fileForm').attr('action'));
58+
} else if($('#datasetForm').length > 0) {
59+
label = stripId($('#datasetForm').attr('action'));
60+
}
61+
gtag('event', 'Download Citation', {'event_category' : category,
62+
'event_label' : label});
63+
});
64+
65+
// Export Metadata button
66+
$(document).on("click", ".btn-export + ul.dropdown-menu li a", function() {
67+
var category = $(this).text();
68+
var label = 'Unknown';
69+
if($('#fileForm').length > 0) {
70+
label = stripId($('#fileForm').attr('action'));
71+
} else if($('#datasetForm').length > 0) {
72+
label = stripId($('#datasetForm').attr('action'));
73+
}
74+
gtag('event', 'Export Metadata', {'event_category' : category,
75+
'event_label' : label});
76+
});
77+
78+
// Contact button
79+
$(document).on("click", ".btn-contact", function() {
80+
var category = $(this).text();
81+
var label = 'Unknown';
82+
if($('#fileForm').length > 0) {
83+
label = stripId($('#fileForm').attr('action'));
84+
} else if($('#datasetForm').length > 0) {
85+
label = stripId($('#datasetForm').attr('action'));
86+
} else if($('#dataverseForm').length > 0) {
87+
label = stripAlias($('#dataverseForm').attr('action'));
88+
}
89+
gtag('event', 'Contact', {'event_category' : category,
90+
'event_label' : label});
91+
});
92+
93+
// Share button
94+
$(document).on("click", 'div[id$="shareDialog"] a[class^="sharrre"]', function() {
95+
var sharrreVal = $(this).attr('class');
96+
var category = sharrreVal.substring(sharrreVal.indexOf('-') + 1) ;
97+
var label = 'Unknown';
98+
if($('#fileForm').length > 0) {
99+
label = stripId($('#fileForm').attr('action'));
100+
} else if($('#datasetForm').length > 0) {
101+
label = stripId($('#datasetForm').attr('action'));
102+
} else if($('#dataverseForm').length > 0) {
103+
label = stripAlias($('#dataverseForm').attr('action'));
104+
}
105+
gtag('event', 'Share', {'event_category' : category,
106+
'event_label' : label});
107+
});
108+
109+
}
110+
111+
function getFileId(target) {
112+
var label = 'Unknown';
113+
if(target.parents('th').length>0) {
114+
//Special case - the Download button that downloads all selected files in the dataset
115+
label = 'file(s) from ' + stripId($('#datasetForm').attr('action'));
116+
} else {
117+
var row = target.parents('tr')[0];
118+
if(row != null) {
119+
//finds the file id/DOI in the Dataset page
120+
label = $(row).find('td.col-file-metadata > a').attr('href');
121+
} else {
122+
//finds the file id/DOI in the file page
123+
label = $('#fileForm').attr('action');
124+
}
125+
label = stripId(label);
126+
}
127+
return label;
128+
}
129+
130+
131+
function stripId(label) {
132+
var index = label.indexOf('&');
133+
if(index == -1) index = label.length;
134+
if(label.indexOf('persistentId=') >= 0) {
135+
label = label.substring(label.indexOf('persistentId=') + 13, index);
136+
}
137+
if(label.indexOf('fileId=') >= 0) {
138+
label = label.substring(label.indexOf('fileId=') + 7, index);
139+
}
140+
return(label);
141+
}
142+
143+
function stripAlias(label) {
144+
var index = label.length;
145+
label = label.substring(label.indexOf('/dataverse/') + 11, index).split(/[?#]/)[0];
146+
return(label);
147+
}
148+
</script>

doc/sphinx-guides/source/admin/dashboard.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@ Users
2929

3030
This dashboard tool allows you to search a list of all users of your Dataverse installation. You can remove roles from user accounts and assign or remove superuser status. See the :doc:`user-administration` section for more details.
3131

32+
Move Data
33+
---------
34+
35+
This tool allows you to move datasets. To move dataverses, see the :doc:`dataverses-datasets` section.

doc/sphinx-guides/source/admin/dataverses-datasets.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ Datasets
4646
Move a Dataset
4747
^^^^^^^^^^^^^^
4848

49-
Moves a dataset whose id is passed to a dataverse whose alias is passed. If the moved dataset has a guestbook or a dataverse link that is not compatible with the destination dataverse, you will be informed and given the option to force the move and remove the guestbook or link. Only accessible to users with permission to publish the dataset in the original and destination dataverse. ::
49+
Superusers can move datasets using the dashboard. See also :doc:`dashboard`.
50+
51+
Moves a dataset whose id is passed to a dataverse whose alias is passed. If the moved dataset has a guestbook or a dataverse link that is not compatible with the destination dataverse, you will be informed and given the option to force the move (with ``forceMove=true`` as a query parameter) and remove the guestbook or link (or both). Only accessible to users with permission to publish the dataset in the original and destination dataverse. ::
5052

5153
curl -H "X-Dataverse-key: $API_TOKEN" -X POST http://$SERVER/api/datasets/$id/move/$alias
5254

@@ -82,3 +84,9 @@ Make Metadata Updates Without Changing Dataset Version
8284
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8385

8486
As a superuser, click "Update Current Version" when publishing. (This option is only available when a 'Minor' update would be allowed.)
87+
88+
Diagnose Constraint Violations Issues in Datasets
89+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90+
91+
To identifiy invalid data values in specific datasets (if, for example, an attempt to edit a dataset results in a ConstraintViolationException in the server log), or to check all the datasets in the Dataverse for constraint violations, see :ref:`Dataset Validation <dataset-validation-api>` in the :doc:`/api/native-api` section of the User Guide.
92+

doc/sphinx-guides/source/admin/metadatacustomization.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ Reloading a Metadata Block
606606

607607
As mentioned above, changes to metadata blocks that ship with Dataverse will be made over time to improve them and release notes will sometimes instruct you to reload an existing metadata block. The syntax for reloading is the same as reloading. Here's an example with the "citation" metadata block:
608608

609-
``curl http://localhost:8080/api/admin/datasetfield/load -H "Content-type: text/tab-separated-values" -X POST --upload-file --upload-file citation.tsv``
609+
``curl http://localhost:8080/api/admin/datasetfield/load -H "Content-type: text/tab-separated-values" -X POST --upload-file citation.tsv``
610610

611611
Great care must be taken when reloading a metadata block. Matching is done on field names (or identifiers and then names in the case of controlled vocabulary values) so it's easy to accidentally create duplicate fields.
612612

doc/sphinx-guides/source/admin/metadataexport.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@ Metadata Export
77
Automatic Exports
88
-----------------
99

10-
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:
11-
12-
- Dublin Core
13-
- Data Documentation Initiative (DDI)
14-
- DataCite 4
15-
- native JSON (Dataverse-specific)
16-
- OAI_ORE
17-
- Schema.org JSON-LD
10+
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 listed under :ref:`Supported Metadata Export Formats <metadata-export-formats>` in the :doc:`/user/dataset-management` section of the User Guide.
1811

1912
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)
2013

doc/sphinx-guides/source/admin/troubleshooting.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,16 @@ followed by an Exception stack trace with these lines in it:
5858
Make sure you install the correct version of the driver. For example, if you are running the version 9.3 of PostgreSQL, make sure you have the driver postgresql-9.3-1104.jdbc4.jar in your :fixedwidthplain:`<GLASSFISH FOLDER>/glassfish/lib` directory. Go `here <https://jdbc.postgresql.org/download.html>`_
5959
to download the correct version of the driver. If you have an older driver in glassfish/lib, make sure to remove it, replace it with the new version and restart Glassfish. (You may need to remove the entire contents of :fixedwidthplain:`<GLASSFISH FOLDER>/glassfish/domains/domain1/generated` before you start Glassfish).
6060

61+
62+
Constraint Violations Issues
63+
----------------------------
64+
65+
In real life production use, it may be possible to end up in a situation where some values associated with the datasets in your database are no longer valid under the constraints enforced by the latest version of Dataverse. This is not very likely to happen, but if it does, the symptomps will be as follows: Some datasets can no longer be edited, long exception stack traces logged in the Glassfish server log, caused by::
66+
67+
javax.validation.ConstraintViolationException:
68+
Bean Validation constraint(s) violated while executing Automatic Bean Validation on callback event:'preUpdate'.
69+
Please refer to embedded ConstraintViolations for details.
70+
71+
(contrary to what the message suggests, there are no specific "details" anywhere in the stack trace that would explain what values violate which constraints)
72+
73+
To identifiy the specific invalid values in the affected datasets, or to check all the datasets in the Dataverse for constraint violations, see :ref:`Dataset Validation <dataset-validation-api>` in the :doc:`/api/native-api` section of the User Guide.

doc/sphinx-guides/source/api/native-api.rst

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ Export Metadata of a Dataset in Various Formats
291291

292292
GET http://$SERVER/api/datasets/export?exporter=ddi&persistentId=$persistentId
293293

294-
.. note:: Supported exporters (export formats) are ``ddi``, ``oai_ddi``, ``dcterms``, ``oai_dc``, ``schema.org`` , ``OAI_ORE`` , ``Datacite`` and ``dataverse_json``.
294+
.. note:: Supported exporters (export formats) are ``ddi``, ``oai_ddi``, ``dcterms``, ``oai_dc``, ``schema.org`` , ``OAI_ORE`` , ``Datacite``, ``oai_datacite`` and ``dataverse_json``.
295295

296296
Schema.org JSON-LD
297297
^^^^^^^^^^^^^^^^^^
@@ -1325,6 +1325,43 @@ Recalculate the UNF value of a dataset version, if it's missing, by supplying th
13251325

13261326
POST http://$SERVER/api/admin/datasets/integrity/{datasetVersionId}/fixmissingunf
13271327

1328+
.. _dataset-validation-api:
1329+
1330+
Dataset Validation
1331+
~~~~~~~~~~~~~~~~~~
1332+
1333+
Validate the dataset and its components (DatasetVersion, FileMetadatas, etc.) for constraint violations::
1334+
1335+
curl $SERVER_URL/api/admin/validate/dataset/{datasetId}
1336+
1337+
if validation fails, will report the specific database entity and the offending value. For example::
1338+
1339+
{"status":"OK","data":{"entityClassDatabaseTableRowId":"[DatasetVersion id:73]","field":"archiveNote","invalidValue":"random text, not a url"}}
1340+
1341+
1342+
Validate all the datasets in the Dataverse, report any constraint violations found::
1343+
1344+
curl $SERVER_URL/api/admin/validate/datasets
1345+
1346+
This API streams its output in real time, i.e. it will start producing the output immediately and will be reporting on the progress as it validates one dataset at a time. For example::
1347+
1348+
{"datasets": [
1349+
{"datasetId":27,"status":"valid"},
1350+
{"datasetId":29,"status":"valid"},
1351+
{"datasetId":31,"status":"valid"},
1352+
{"datasetId":33,"status":"valid"},
1353+
{"datasetId":35,"status":"valid"},
1354+
{"datasetId":41,"status":"invalid","entityClassDatabaseTableRowId":"[DatasetVersion id:73]","field":"archiveNote","invalidValue":"random text, not a url"},
1355+
{"datasetId":57,"status":"valid"}
1356+
]
1357+
}
1358+
1359+
Note that if you are attempting to validate a very large number of datasets in your Dataverse, this API may time out - subject to the timeout limit set in your Glassfish configuration. If this is a production Dataverse instance serving large amounts of data, you most likely have that timeout set to some high value already. But if you need to increase it, it can be done with the asadmin command. For example::
1360+
1361+
asadmin set server-config.network-config.protocols.protocol.http-listener-1.http.request-timeout-seconds=3600
1362+
1363+
1364+
13281365
Workflows
13291366
~~~~~~~~~
13301367

doc/sphinx-guides/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
# built documents.
6666
#
6767
# The short X.Y version.
68-
version = '4.13'
68+
version = '4.14'
6969
# The full version, including alpha/beta/rc tags.
70-
release = '4.13'
70+
release = '4.14'
7171

7272
# The language for content autogenerated by Sphinx. Refer to documentation
7373
# for a list of supported languages.

doc/sphinx-guides/source/developers/coding-style.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,18 @@ Generally speaking you should use ``fine`` for everything that you don't want to
8989

9090
When adding logging, do not simply add ``System.out.println()`` lines because the logging level cannot be controlled.
9191

92-
Avoid Hard-Coding Strings
93-
~~~~~~~~~~~~~~~~~~~~~~~~~
92+
Avoid Hard-Coding Strings (Use Constants)
93+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9494

9595
Special strings should be defined as public constants. For example, ``DatasetFieldConstant.java`` contains a field for "title" and it's used in many places in the code (try "Find Usages" in Netbeans). This is better than writing the string "title" in all those places.
9696

97+
Avoid Hard-Coding User-Facing Messaging in English
98+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99+
100+
There is an ongoing effort to translate Dataverse into various languages. Look for "lang" or "languages" in the :doc:`/installation/config` section of the Installation Guide for details if you'd like to help or play around with this feature.
101+
102+
The translation effort is hampered if you hard code user-facing messages in English in the Java code. Put English strings in ``Bundle.properties`` and use ``BundleUtil`` to pull them out. This is especially important for messages that appear in the UI. We are aware that the API has many, many hard coded English strings in it. If you touch a method in the API and notice English strings, you are strongly encouraged to used that opportunity to move the English to ``Bundle.properties``.
103+
97104
Type Safety
98105
~~~~~~~~~~~
99106

0 commit comments

Comments
 (0)