Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QDR/6886 external status labels #7967

Merged
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
c9750a0
initial external status label impl
qqmyers Jun 22, 2021
19dcce1
typos, update errors, change regexp
qqmyers Jun 22, 2021
c5b215a
typo missing )
qqmyers Jun 22, 2021
d0d996c
fix regexp, use new error msgs
qqmyers Jun 22, 2021
044cbbc
allow delete, clear upon publication
qqmyers Jun 22, 2021
149baa3
typo
qqmyers Jun 22, 2021
21efbb8
don't say null in email
qqmyers Jun 22, 2021
dac5389
fix: get the datasetversion
qqmyers Jun 24, 2021
346af0d
require publish permission, add label list setting
qqmyers Jun 28, 2021
017254d
add status label in search results
qqmyers Jul 20, 2021
cda78c2
make external status searchable/fix display in search
qqmyers Jul 20, 2021
62166f2
add to dataset card
qqmyers Jul 21, 2021
7ceef90
add curation status menu
qqmyers Jul 21, 2021
2c5ae21
handle nulls
qqmyers Jul 21, 2021
6dbc26a
fix update
qqmyers Jul 21, 2021
b3a224f
add remove status
qqmyers Jul 21, 2021
1648080
typo getting bundled string
qqmyers Jul 21, 2021
b3a20c3
bundle typo, move remove outside repeat
qqmyers Jul 21, 2021
74e3622
update dataset after status change
qqmyers Jul 21, 2021
25dbdc1
debug publish button
qqmyers Jul 21, 2021
839bc34
show menu when enabled
qqmyers Jul 21, 2021
250cb2c
fix carat
qqmyers Jul 21, 2021
f7c61d0
handle empty and null status
qqmyers Jul 21, 2021
0c91b18
handle trailing space(s), update messaging
qqmyers Jul 21, 2021
6551af4
add status flyway
qqmyers Jul 22, 2021
c37ad7c
bad script name
qqmyers Jul 22, 2021
5d7eaea
change to label-info to adjust color
qqmyers Jul 22, 2021
a7a8f80
Merge remote-tracking branch 'IQSS/develop' into
qqmyers Jul 22, 2021
4763762
restrict ext status label visibility to those who can publish
qqmyers Jul 26, 2021
2bf2686
handle string conversion
qqmyers Jul 26, 2021
25cfbac
use entityId directly
qqmyers Jul 26, 2021
46b10e3
Merge remote-tracking branch 'IQSS/develop' into QDR/6886-external_st…
qqmyers Jul 29, 2021
448e212
update flyway
qqmyers Jul 29, 2021
11e45a2
update workingVersion after status change
qqmyers Jul 30, 2021
d4b2d8d
missing </div> and spacing
qqmyers Jul 30, 2021
b135cdc
don't create list if empty
qqmyers Jul 30, 2021
cb876cb
fix menu/button logic
qqmyers Jul 30, 2021
64b8b90
Merge remote-tracking branch 'IQSS/develop' into QDR/6886-external_st…
qqmyers Aug 4, 2021
9368f55
update flyway numbering
qqmyers Aug 4, 2021
58dac87
Merge remote-tracking branch 'IQSS/develop' into
qqmyers Aug 12, 2021
c304f09
docs
qqmyers Aug 12, 2021
039d239
fix error on submit for review
qqmyers Aug 18, 2021
effe3bf
add a curation status report api call
qqmyers Aug 19, 2021
702df0e
allow config of curation labels per collection
qqmyers Sep 20, 2021
b24e775
failed refactor fix
qqmyers Sep 20, 2021
db4e136
sql script update
qqmyers Sep 20, 2021
c6c5604
more debug info
qqmyers Sep 21, 2021
a45b2e7
change loop
qqmyers Sep 21, 2021
fa4a671
fix default, update label setting menu and command
qqmyers Sep 21, 2021
20cf1af
debug/ handle null
qqmyers Sep 21, 2021
df3fac7
fix no parent logic
qqmyers Sep 21, 2021
117f022
Merge remote-tracking branch 'IQSS/develop' into
qqmyers Sep 21, 2021
eade006
add apis and docs
qqmyers Sep 21, 2021
10996d6
cleanup
qqmyers Sep 21, 2021
d266bb3
make role reporting generic
qqmyers Sep 21, 2021
56fd065
style fixes
qqmyers Sep 21, 2021
20e31e5
Merge remote-tracking branch 'IQSS/develop' into
qqmyers Sep 27, 2021
bc066f7
merge issue
qqmyers Sep 27, 2021
8f8531a
Revert "style fixes"
qqmyers Sep 27, 2021
20cf55d
cleanup
qqmyers Sep 27, 2021
b196807
Merge remote-tracking branch 'IQSS/develop' into QDR/6886-external_st…
qqmyers Sep 28, 2021
38b8baa
addressing review feedback
qqmyers Sep 29, 2021
24d4a57
Apply suggestions from code review
qqmyers Sep 29, 2021
1ce9680
add doc to index
qqmyers Sep 29, 2021
0521035
Merge branch 'QDR/6886-external_status_labels' of https://github.com/…
qqmyers Sep 29, 2021
b888b41
Update dataverse example to match dataset one
qqmyers Sep 29, 2021
86fee63
removing external
djbrooke Sep 30, 2021
8a8f51e
adding solr schema update notes
djbrooke Sep 30, 2021
cc58237
Test fix
qqmyers Sep 30, 2021
d83c92a
Apply suggestions from code review
qqmyers Sep 30, 2021
3e86dcf
Merge branch 'QDR/6886-external_status_labels' of https://github.com/…
qqmyers Sep 30, 2021
5e0a43e
doc text/structure updates
qqmyers Sep 30, 2021
5402636
remove word
qqmyers Sep 30, 2021
ae61cbe
adding more information about what labels do
djbrooke Oct 1, 2021
3a846ca
Merge branch 'develop' into QDR/6886-external_status_labels #6886
pdurbin Oct 1, 2021
a23d506
get guides to build (`make html` was failing) #6886
pdurbin Oct 1, 2021
fa4f8cc
updating release note
djbrooke Oct 1, 2021
a79ce03
Fix PUT curationSetLabel and test
qqmyers Oct 4, 2021
b78da86
Merge branch 'QDR/6886-external_status_labels' of https://github.com/…
qqmyers Oct 4, 2021
589cf64
refactor issue
qqmyers Oct 6, 2021
6d5c2e0
updating release notes with instructions for custom metadata blocks
djbrooke Oct 6, 2021
b4e2488
missing 's'
qqmyers Oct 6, 2021
8f670d8
Merge branch 'QDR/6886-external_status_labels' of https://github.com/…
qqmyers Oct 6, 2021
fe77072
add api key for getting the current set
qqmyers Oct 6, 2021
cca90e5
fix api docs name param
qqmyers Oct 6, 2021
c72c57a
merge needed for put/delete
qqmyers Oct 6, 2021
cc8e146
don't need to be super to get allowed curation labels in set
qqmyers Oct 7, 2021
0b617f6
add permission check
qqmyers Oct 7, 2021
10e8bc4
fix concatenation
qqmyers Oct 7, 2021
0b68121
fix null for no label
qqmyers Oct 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conf/solr/8.8.1/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
<field name="dvSubject" type="string" stored="true" indexed="true" multiValued="true"/>

<field name="publicationStatus" type="string" stored="true" indexed="true" multiValued="true"/>
<field name="externalStatus" type="string" stored="true" indexed="true" multiValued="false"/>
djbrooke marked this conversation as resolved.
Show resolved Hide resolved

<field name="subtreePaths" type="string" stored="true" indexed="true" multiValued="true"/>

Expand Down
19 changes: 19 additions & 0 deletions doc/release-notes/7967-curation-labels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Curation Status Labels

A new :AllowedCurationLabels setting allows a sysadmins to define one or more sets of labels that can be applied to a draft Dataset version via the user interface or API to indicate the status of the dataset with respect to a defined curation process.

Labels are completely customizable (alphanumeric or spaces, up to 32 characters, e.g. "Author contacted", "Privacy Review", "Awaiting paper publication"). Superusers can select a specific set of labels, or disable this functionality per collection. Anyone who can publish a draft dataset (e.g. curators) can set/change/remove labels (from the set specified for the collection containing the dataset) via the user interface or via an API. The API also would allow external tools to search for, read and set labels on Datasets, providing an integration mechanism. Labels are visible on the Dataset page and in Dataverse collection listings/search results. Internally, the labels have no effect, and at publication, any existing label will be removed. A reporting API call allows admins to get a list of datasets and their curation statuses.

The Solr schema must be updated as part of installing the release of Dataverse containing this feature for it to work.

## Additional Release Steps

1\. Replace Solr schema.xml to allow Curation Labels to be used

-stop solr instance (usually service solr stop, depending on solr installation/OS, see the [Installation Guide](https://guides.dataverse.org/en/5.7/installation/prerequisites.html#solr-init-script)

-replace schema.xml

cp /tmp/dvinstall/schema.xml /usr/local/solr/solr-8.8.1/server/solr/collection1/conf

-start solr instance (usually service solr start, depending on solr/OS)
63 changes: 61 additions & 2 deletions doc/sphinx-guides/source/admin/dataverses-datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Recursively assigns the users and groups having a role(s),that are in the set co

curl -H "X-Dataverse-key: $API_TOKEN" http://$SERVER/api/admin/dataverse/$dataverse-alias/addRoleAssignmentsToChildren

Configure a Dataverse Collection to store all new files in a specific file store
Configure a Dataverse Collection to Store All New Files in a Specific File Store
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To direct new files (uploaded when datasets are created or edited) for all datasets in a given Dataverse collection, the store can be specified via the API as shown below, or by editing the 'General Information' for a Dataverse collection on the Dataverse collection page. Only accessible to superusers. ::
Expand All @@ -61,6 +61,36 @@ The available drivers can be listed with::

(Individual datasets can be configured to use specific file stores as well. See the "Datasets" section below.)

Configure a Dataverse Collection to Allow Use of a Given Curation Label Set
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Datasets within a given Dataverse collection can be annotated with a Curation Label to indicate the status of the dataset with respect to a defined curation process. Labels are completely customizable (alphanumeric or spaces, up to 32 characters, e.g. "Author contacted", "Privacy Review", "Awaiting paper publication").

The label is applied to a draft Dataset version via the user interface or API and the available label sets are defined by :ref:`:AllowedCurationLabels <:AllowedCurationLabels>`. Internally, the labels have no effect, and at publication, any existing label will be removed. A reporting API call allows admins to get a list of datasets and their curation statuses.

The label set used for a collection can be specified via the API as shown below, or by editing the 'General Information' for a Dataverse collection on the Dataverse collection page. Only accessible to superusers.

The curationLabelSet to use within a given collection can be set by specifying its name using::

djbrooke marked this conversation as resolved.
Show resolved Hide resolved
curl -H "X-Dataverse-key: $API_TOKEN" -X PUT -d $curationLabelSetName http://$SERVER/api/admin/dataverse/$dataverse-alias/curationLabelSet

The reserved word "DISABLED" can be used to disable this feature within a given Dataverse collection.

The name of the current curationLabelSet can be seen using::

curl -H "X-Dataverse-key: $API_TOKEN" http://$SERVER/api/admin/dataverse/$dataverse-alias/curationLabelSet

and can be reset to the default (inherited from the parent collection or DISABLED for the root collection) with::

curl -H "X-Dataverse-key: $API_TOKEN" -X DELETE http://$SERVER/api/admin/dataverse/$dataverse-alias/curationLabelSet

The available curation label sets can be listed with::

curl -H "X-Dataverse-key: $API_TOKEN" http://$SERVER/api/admin/dataverse/curationLabelSet

If the :AllowedCurationLabels setting has a value, one of the available choices will always be "DISABLED" which allows curation labels to be turned off for a given collection/dataset.

Individual datasets can be configured to use specific curationLabelSets as well. See the "Datasets" section below.

Datasets
--------
Expand Down Expand Up @@ -134,7 +164,7 @@ Diagnose Constraint Violations Issues in Datasets

To identify 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 installation for constraint violations, see :ref:`Dataset Validation <dataset-validation-api>` in the :doc:`/api/native-api` section of the User Guide.

Configure a Dataset to store all new files in a specific file store
Configure a Dataset to Store All New Files in a Specific File Store
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Configure a dataset to use a specific file store (this API can only be used by a superuser) ::
Expand All @@ -153,4 +183,33 @@ The available drivers can be listed with::

curl -H "X-Dataverse-key: $API_TOKEN" http://$SERVER/api/admin/dataverse/storageDrivers

Configure a Dataset to Allow Use of a Curation Label Set
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A dataset can be annotated with a Curation Label to indicate the status of the dataset with respect to a defined curation process. Labels are completely customizable (alphanumeric or spaces, up to 32 characters, e.g. "Author contacted", "Privacy Review", "Awaiting paper publication").

The label is applied to a draft Dataset version via the user interface or API and the available label sets are defined by :ref:`:AllowedCurationLabels <:AllowedCurationLabels>`. Internally, the labels have no effect, and at publication, any existing label will be removed. A reporting API call allows admins to get a list of datasets and their curation statuses.

The label set used for a dataset can be specified via the API as shown below. Only accessible to superusers.

The curationLabelSet to use within a given dataset can be set by specifying its name using::

curl -H "X-Dataverse-key: $API_TOKEN" -X PUT -d $curationLabelSetName http://$SERVER/api/datasets/$dataset-id/curationLabelSet

The reserved word "DISABLED" can be used to disable this feature within a given Dataverse collection.

The name of the current curationLabelSet can be seen using::

curl http://$SERVER/api/datasets/$dataset-id/curationLabelSet

and can be reset to the default (inherited from the parent collection) with (only a superuser can do this) ::

curl -H "X-Dataverse-key: $API_TOKEN" -X DELETE http://$SERVER/api/datasets/$dataset-id/curationLabelSet

The available curationLabelSets can be listed with::

curl -H "X-Dataverse-key: $API_TOKEN" http://$SERVER/api/admin/dataverse/curationLabelSets

If the :AllowedCurationLabels setting has a value, one of the available choices will always be "DISABLED" which allows curation labels to be turned off for a given collection/dataset.

Collections can be configured to use specific curationLabelSets as well. See the "Dataverse Collections" section above.
95 changes: 95 additions & 0 deletions doc/sphinx-guides/source/api/curation-labels.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
Dataset Curation Label API
==========================

When the :ref:`:AllowedCurationLabels <:AllowedCurationLabels>` setting has been used to define Curation Labels, this API can be used to set these labels on draft datasets.
Superusers can define which set of labels are allowed for a given datasets in a collection/an individual dataset using the api described in the :doc:`/admin/dataverses-datasets` section.
The API here can be used by curators/those who have permission to publish the dataset to get/set/change/delete the label currently assigned to a draft dataset.

This functionality is intended as a mechanism to integrate the Dataverse software with an external curation process/application: it is a way to make the state of a draft dataset,
as defined in the external process, visible within Dataverse. These labels have no other effect in Dataverse and are only visible to curators/those with permission to publish the dataset.
Any curation label assigned to a draft dataset will be removed upon publication.

Get a Draft Dataset's Curation Label
------------------------------------

.. code-block:: bash

export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export DATASET_ID='12345'
export DATASET_PID='doi:10.5072/FK2A1B2C3'
export SERVER_URL=https://demo.dataverse.org

Example 1: Get the label using the DATASET ID

curl -H X-Dataverse-key:$API_TOKEN "$SERVER_URL/api/datasets/$DATASET_ID/curationStatus"

Example 2: Get the label using the DATASET PID

curl -H X-Dataverse-key:$API_TOKEN "$SERVER_URL/api/datasets/:persistentId/curationStatus?persistentId=$DATASET_PID"

You should expect a 200 ("OK") response and the draft dataset's curation status label contained in a JSON 'data' object.


Set a Draft Dataset's Curation Label
------------------------------------

To add a curation label for a draft Dataset, specify the Dataset ID (DATASET_ID) or Persistent identifier (DATASET_PID) and the label desired.

.. code-block:: bash

export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export DATASET_ID='12345'
export DATASET_PID='doi:10.5072/FK2A1B2C3'
export LABEL='Author contacted'
export SERVER_URL=https://demo.dataverse.org

Example: Add the label using the DATASET ID

curl -X PUT -H X-Dataverse-key:$API_TOKEN "$SERVER_URL/api/datasets/$DATASET_ID/curationStatus?label=$LABEL"

Example 2: Add a description using the DATASET PID

curl -X PUT -H X-Dataverse-key:$API_TOKEN "$SERVER_URL/api/datasets/:persistentId/curationStatus?label=$LABEL&persistentId=$DATASET_PID"

You should expect a 200 ("OK") response indicating that the label has been set. 403/Forbidden and 400/Bad Request responses are also possible, i.e. if you don't have permission to make this change or are trying to add a label that isn't in the allowed set or to add a label to a dataset with no draft version.


Delete a Draft Dataset's Curation Label
---------------------------------------

To delete the curation label on a draft Dataset, specify the Dataset ID (DATASET_ID) or Persistent identifier (DATASET_PID).

.. code-block:: bash

export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export DATASET_PID='doi:10.5072/FK2A1B2C3'
export SERVER_URL=https://demo.dataverse.org

Example: Delete the label using the DATASET PID

curl -X DELETE -H X-Dataverse-key:$API_TOKEN "$SERVER_URL/api/datasets/:persistentId/curationStatus?persistentId=$DATASET_PID"

You should expect a 200 ("OK") response indicating the label has been removed.


Get the Set of Allowed Labels for a Dataset
-------------------------------------------

To get the list of allowed curation labels allowed for a given Dataset

.. code-block:: bash

export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export DATASET_ID='12345'
export DATASET_PID='doi:10.5072/FK2A1B2C3'
export SERVER_URL=https://demo.dataverse.org

Example 1: Get the label using the DATASET ID

curl -H X-Dataverse-key:$API_TOKEN "$SERVER_URL/api/datasets/$DATASET_ID/allowedCurationLabels"

Example 2: Get the label using the DATASET PID

curl -H X-Dataverse-key:$API_TOKEN "$SERVER_URL/api/datasets/:persistentId/allowedCurationLabels?persistentId=$DATASET_PID"

You should expect a 200 ("OK") response with a comma-separated list of allowed labels contained in a JSON 'data' object.
1 change: 1 addition & 0 deletions doc/sphinx-guides/source/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ API Guide
sword
client-libraries
external-tools
curation-labels
apps
faq
1 change: 1 addition & 0 deletions doc/sphinx-guides/source/developers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ Developer Guide
dataset-migration-api
workflows
fontcustom

13 changes: 13 additions & 0 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2385,4 +2385,17 @@ Scripts that implement this association for specific service protocols are maint

``curl -X PUT --upload-file cvoc-conf.json http://localhost:8080/api/admin/settings/:CVocConf``

.. _:AllowedCurationLabels:

:AllowedCurationLabels
djbrooke marked this conversation as resolved.
Show resolved Hide resolved
++++++++++++++++++++++

A JSON Object containing lists of allowed labels (up to 32 characters, spaces allowed) that can be set, via API or UI by users with the permission to publish a dataset. The set of labels allowed
for datasets can be selected by a superuser - via the Dataverse collection page (Edit/General Info) or set via API call.
The labels in a set should correspond to the states in an organization's curation process and are intended to help users/curators track the progress of a dataset through a defined curation process.
A dataset may only have one label at a time and if a label is set, it will be removed at publication time.
This functionality is disabled when this setting is empty/not set.
Each set of labels is identified by a curationLabelSet name and a JSON Array of the labels allowed in that set.

``curl -X PUT -d '{"Standard Process":["Author contacted", "Privacy Review", "Awaiting paper publication", "Final Approval"], "Alternate Process":["State 1","State 2","State 3"]}' http://localhost:8080/api/admin/settings/:AllowedCurationLabels``
djbrooke marked this conversation as resolved.
Show resolved Hide resolved

22 changes: 22 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
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.SetCurationStatusCommand;
import edu.harvard.iq.dataverse.engine.command.impl.SubmitDatasetForReviewCommand;
import edu.harvard.iq.dataverse.externaltools.ExternalTool;
import edu.harvard.iq.dataverse.externaltools.ExternalToolServiceBean;
Expand Down Expand Up @@ -5546,4 +5547,25 @@ public List<String> getVocabScripts() {
public String getFieldLanguage(String languages) {
return fieldService.getFieldLanguage(languages,session.getLocaleCode());
}

public void setExternalStatus(String status) {
try {
dataset = commandEngine.submit(new SetCurationStatusCommand(dvRequestService.getDataverseRequest(), dataset, status));
workingVersion=dataset.getLatestVersion();
if (status == null || status.isEmpty()) {
JsfHelper.addInfoMessage(BundleUtil.getStringFromBundle("dataset.externalstatus.removed"));
} else {
JH.addMessage(FacesMessage.SEVERITY_INFO, BundleUtil.getStringFromBundle("dataset.externalstatus.header"), BundleUtil.getStringFromBundle("dataset.externalstatus.info", Arrays.asList(status)));
}

} catch (CommandException ex) {
String msg = BundleUtil.getStringFromBundle("dataset.externalstatus.cantchange");
logger.warning("Unable to change external status to " + status + " for dataset id " + dataset.getId() + ". Message to user: " + msg + " Exception: " + ex);
JsfHelper.addErrorMessage(msg);
}
}

public List<String> getAllowedExternalStatuses() {
return settingsWrapper.getAllowedExternalStatuses(dataset);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ public List<Long> findAllUnindexed() {
return em.createQuery("SELECT o.id FROM Dataset o WHERE o.indexTime IS null ORDER BY o.id DESC", Long.class).getResultList();
}

//Used in datasets listcurationstatus API
public List<Dataset> findAllUnpublished() {
djbrooke marked this conversation as resolved.
Show resolved Hide resolved
return em.createQuery("SELECT object(o) FROM Dataset o, DvObject d WHERE d.id=o.id and d.publicationDate IS null ORDER BY o.id ASC", Dataset.class).getResultList();
}

/**
* For docs, see the equivalent method on the DataverseServiceBean.
* @param numPartitions
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ public enum License {
@OneToMany(mappedBy = "datasetVersion", cascade={CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST})
private List<WorkflowComment> workflowComments;

@Column(nullable=true)
private String externalStatusLabel;

public Long getId() {
return this.id;
Expand Down Expand Up @@ -1961,4 +1963,12 @@ public String getLocaleLastUpdateTime() {
return DateUtil.formatDate(new Timestamp(lastUpdateTime.getTime()));
}

public String getExternalStatusLabel() {
return externalStatusLabel;
}

public void setExternalStatusLabel(String externalStatusLabel) {
this.externalStatusLabel = externalStatusLabel;
}

}
46 changes: 46 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/DataversePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
Expand Down Expand Up @@ -1210,4 +1211,49 @@ public Set<Entry<String, String>> getMetadataLanguages() {
return settingsWrapper.getMetadataLanguages(this.dataverse).entrySet();
}

public Set<Entry<String, String>> getCurationLabelSetOptions() {
djbrooke marked this conversation as resolved.
Show resolved Hide resolved
HashMap<String, String> setNames = new HashMap<String, String>();
Set<String> allowedSetNames = systemConfig.getCurationLabels().keySet();
if (allowedSetNames.size() > 0) {
// Add an entry for the default (inherited from an ancestor or the system
// default)
String inheritedLabelSet = getCurationLabelSetNameLabel();
if (!StringUtils.isBlank(inheritedLabelSet)) {
setNames.put(inheritedLabelSet,SystemConfig.DEFAULTCURATIONLABELSET);
}
// Add an entry for disabled
setNames.put(BundleUtil.getStringFromBundle("dataverse.curationLabels.disabled"), SystemConfig.CURATIONLABELSDISABLED);
allowedSetNames.forEach(name -> {
setNames.put(name, name);
});
}
return setNames.entrySet();
}

public String getCurationLabelSetNameLabel() {
Dataverse parent = dataverse.getOwner();
String setName = null;
boolean fromAncestor = false;
if (parent != null) {
setName = parent.getEffectiveCurationLabelSetName();
// recurse dataverse chain to root and if any have a curation label set name set,
// fromAncestor is true
while (parent != null) {
if (!parent.getCurationLabelSetName().equals(SystemConfig.DEFAULTCURATIONLABELSET)) {
fromAncestor = true;
break;
}
parent = parent.getOwner();
}
}
if (setName != null) {
if (fromAncestor) {
setName = setName + " " + BundleUtil.getStringFromBundle("dataverse.inherited");
} else {
setName = setName + " " + BundleUtil.getStringFromBundle("dataverse.default");
}
}
return setName;
}

}
Loading