Skip to content

Commit

Permalink
Merge branch 'develop' into 10952-release-notes #10952
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Dec 11, 2024
2 parents a0508d1 + 73cc914 commit b7b0d0f
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 19 deletions.
1 change: 1 addition & 0 deletions doc/release-notes/display_overview_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This bugfix corrects an issue when there are duplicated entries on the metadata page. It is fixed by correcting an IF-clause in metadataFragment.xhtml.
2 changes: 2 additions & 0 deletions doc/sphinx-guides/source/admin/dataverses-datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ Creates a link between a dataset and a Dataverse collection (see the :ref:`datas

curl -H "X-Dataverse-key: $API_TOKEN" -X PUT http://$SERVER/api/datasets/$linked-dataset-id/link/$linking-dataverse-alias

.. _list-collections-linked-from-dataset:

List Collections that are Linked from a Dataset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
8 changes: 6 additions & 2 deletions doc/sphinx-guides/source/api/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
API Changelog (Breaking Changes)
================================

This API changelog is experimental and we would love feedback on its usefulness. Its primary purpose is to inform API developers of any breaking changes. (We try not ship any backward incompatible changes, but it happens.) To see a list of new APIs and backward-compatible changes to existing API, please see each version's release notes at https://github.com/IQSS/dataverse/releases
This API changelog is experimental and we would love feedback on its usefulness. Its primary purpose is to inform API developers of any breaking changes. (We try not to ship any backward incompatible changes, but it happens.) To see a list of new APIs and backward-compatible changes to existing API, please see each version's release notes at https://github.com/IQSS/dataverse/releases

.. contents:: |toctitle|
:local:
:depth: 1

v6.5
----

- **/api/datasets/{identifier}/links**: The response from :ref:`list-collections-linked-from-dataset` has been improved to provide a more structured (but backward-incompatible) JSON response.

v6.4
----

- **/api/datasets/$dataset-id/modifyRegistration**: Changed from GET to POST
- **/api/datasets/modifyRegistrationPIDMetadataAll**: Changed from GET to POST
- **/api/datasets/{identifier}/links**: The GET endpoint returns a list of Dataverses linked to the given Dataset. The format of the response has changes for v6.4 making it backward incompatible.

v6.3
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1407,8 +1407,7 @@ public UploadSessionQuotaLimit getUploadSessionQuotaLimit(DvObjectContainer pare
}

public boolean isInReleasedVersion(Long id) {
Query query = em.createQuery("SELECT fm.id FROM FileMetadata fm, DvObject dvo WHERE fm.datasetVersion.id=(SELECT dv.id FROM DatasetVersion dv WHERE dv.dataset.id=dvo.owner.id and dv.versionState=edu.harvard.iq.dataverse.DatasetVersion.VersionState.RELEASED ORDER BY dv.versionNumber DESC, dv.minorVersionNumber DESC LIMIT 1) AND dvo.id=fm.dataFile.id AND fm.dataFile.id=:fid");
query.setParameter("fid", id);
Query query = em.createNativeQuery("SELECT fm.id FROM filemetadata fm WHERE fm.datasetversion_id=(SELECT dv.id FROM datasetversion dv, dvobject dvo WHERE dv.dataset_id=dvo.owner_id AND dv.versionState='RELEASED' and dvo.id=" + id + " ORDER BY dv.versionNumber DESC, dv.minorVersionNumber DESC LIMIT 1) AND fm.datafile_id=" + id);

try {
query.getSingleResult();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package edu.harvard.iq.dataverse.privateurl;

import edu.harvard.iq.dataverse.Dataset;
import edu.harvard.iq.dataverse.DatasetServiceBean;
import edu.harvard.iq.dataverse.DataverseRequestServiceBean;
import edu.harvard.iq.dataverse.DataverseSession;
import edu.harvard.iq.dataverse.PermissionsWrapper;
import edu.harvard.iq.dataverse.authorization.users.PrivateUrlUser;
import java.io.Serializable;
import java.util.logging.Logger;
Expand All @@ -20,8 +24,14 @@ public class PrivateUrlPage implements Serializable {

@EJB
PrivateUrlServiceBean privateUrlService;
@EJB
DatasetServiceBean datasetServiceBean;
@Inject
DataverseSession session;
@Inject
PermissionsWrapper permissionsWrapper;
@Inject
DataverseRequestServiceBean dvRequestService;

/**
* The unique string used to look up a PrivateUrlUser and the associated
Expand All @@ -34,7 +44,16 @@ public String init() {
PrivateUrlRedirectData privateUrlRedirectData = privateUrlService.getPrivateUrlRedirectDataFromToken(token);
String draftDatasetPageToBeRedirectedTo = privateUrlRedirectData.getDraftDatasetPageToBeRedirectedTo() + "&faces-redirect=true";
PrivateUrlUser privateUrlUser = privateUrlRedirectData.getPrivateUrlUser();
session.setUser(privateUrlUser);
boolean sessionUserCanViewUnpublishedDataset = false;
if (session.getUser().isAuthenticated()){
Long datasetId = privateUrlUser.getDatasetId();
Dataset dataset = datasetServiceBean.find(datasetId);
sessionUserCanViewUnpublishedDataset = permissionsWrapper.canViewUnpublishedDataset(dvRequestService.getDataverseRequest(), dataset);
}
if(!sessionUserCanViewUnpublishedDataset){
//Only Reset if user cannot view this Draft Version
session.setUser(privateUrlUser);
}
logger.info("Redirecting PrivateUrlUser '" + privateUrlUser.getIdentifier() + "' to " + draftDatasetPageToBeRedirectedTo);
return draftDatasetPageToBeRedirectedTo;
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1151,9 +1151,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
logger.fine(solrFieldFacetable + " gets " + vals);
solrInputDocument.addField(solrFieldFacetable, vals);
}
}

if (dsfType.isControlledVocabulary()) {
} else if (dsfType.isControlledVocabulary()) {
/** If the cvv list is empty but the dfv list is not then it is assumed this was harvested
* from an installation that had controlled vocabulary entries that don't exist in our this db
* @see <a href="https://github.com/IQSS/dataverse/issues/9992">Feature Request/Idea: Harvest metadata values that aren't from a list of controlled values #9992</a>
Expand Down Expand Up @@ -1301,7 +1299,6 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
solrInputDocument.addField(SearchFields.DATASET_DEACCESSION_REASON, deaccessionNote);
}
}

docs.add(solrInputDocument);

/**
Expand Down Expand Up @@ -2235,8 +2232,7 @@ public List<String> findPermissionsInSolrOnly() throws SearchException {
String dtype = dvObjectService.getDtype(id);
if (dtype == null) {
permissionInSolrOnly.add(docId);
}
if (dtype.equals(DType.Dataset.getDType())) {
}else if (dtype.equals(DType.Dataset.getDType())) {
List<String> states = datasetService.getVersionStates(id);
if (states != null) {
String latestState = states.get(states.size() - 1);
Expand All @@ -2257,7 +2253,7 @@ public List<String> findPermissionsInSolrOnly() throws SearchException {
} else if (dtype.equals(DType.DataFile.getDType())) {
List<VersionState> states = dataFileService.findVersionStates(id);
Set<String> strings = states.stream().map(VersionState::toString).collect(Collectors.toSet());
logger.fine("States for " + docId + ": " + String.join(", ", strings));
logger.finest("States for " + docId + ": " + String.join(", ", strings));
if (docId.endsWith("draft_permission")) {
if (!states.contains(VersionState.DRAFT)) {
permissionInSolrOnly.add(docId);
Expand All @@ -2271,7 +2267,7 @@ public List<String> findPermissionsInSolrOnly() throws SearchException {
permissionInSolrOnly.add(docId);
} else {
if (!dataFileService.isInReleasedVersion(id)) {
logger.fine("Adding doc " + docId + " to list of permissions in Solr only");
logger.finest("Adding doc " + docId + " to list of permissions in Solr only");
permissionInSolrOnly.add(docId);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@
<p>#{bundle['dataset.privateurl.general.description']}</p>
<p:commandButton styleClass="btn btn-default"
value="#{bundle['dataset.privateurl.general.button.label']}"
action="#{DatasetPage.createPrivateUrl(false)}" update="privateUrlPanel,:messagePanel"
action="#{DatasetPage.createPrivateUrl(false)}" update="privateUrlPanel,:messagePanel,disablePrivateUrlConfirmation"
disabled="#{(!empty(DatasetPage.privateUrl) and DatasetPage.anonymizedPrivateUrl)}"
rendered="#{empty(DatasetPage.privateUrl) or (!empty(DatasetPage.privateUrl) and DatasetPage.anonymizedPrivateUrl) }"/>
<p:fragment rendered="#{!empty(DatasetPage.privateUrl) and !DatasetPage.anonymizedPrivateUrl}">
Expand All @@ -1213,7 +1213,7 @@
<button class="btn btn-default btn-copy" data-clipboard-text="#{DatasetPage.getPrivateUrlLink(DatasetPage.privateUrl)}" jsf:rendered="#{!empty(DatasetPage.privateUrl)}" type="button">
#{bundle['copyClipboard']}
</button>
<p:commandButton styleClass="btn btn-default" value="#{bundle['dataset.privateurl.disableGeneralPreviewUrl']}" action="#{DatasetPage.setPrivateUrlJustCreatedToFalse()}" oncomplete="PF('privateUrlConfirmation').hide();PF('disablePrivateUrlConfirmation').show()" rendered="#{!empty(DatasetPage.privateUrl)}" update="privateUrlPanel,:messagePanel"/>
<p:commandButton styleClass="btn btn-default" value="#{bundle['dataset.privateurl.disableGeneralPreviewUrl']}" action="#{DatasetPage.setPrivateUrlJustCreatedToFalse()}" oncomplete="PF('privateUrlConfirmation').hide();PF('disablePrivateUrlConfirmation').show()" rendered="#{!empty(DatasetPage.privateUrl)}" update="privateUrlPanel,:messagePanel,disablePrivateUrlConfirmation"/>
</div>
</p:fragment>

Expand Down Expand Up @@ -1252,7 +1252,7 @@
<button class="btn btn-default btn-copy" data-clipboard-text="#{DatasetPage.getPrivateUrlLink(DatasetPage.privateUrl)}" jsf:rendered="#{!empty(DatasetPage.privateUrl)}" type="button">
#{bundle['copyClipboard']}
</button>
<p:commandButton styleClass="btn btn-default" value="#{bundle['dataset.privateurl.disableAnonPreviewUrl']}" action="#{DatasetPage.setPrivateUrlJustCreatedToFalse()}" oncomplete="PF('privateUrlConfirmation').hide();PF('disablePrivateUrlConfirmation').show()" rendered="#{!empty(DatasetPage.privateUrl)}" update="privateUrlPanel,:messagePanel"/>
<p:commandButton styleClass="btn btn-default" value="#{bundle['dataset.privateurl.disableAnonPreviewUrl']}" action="#{DatasetPage.setPrivateUrlJustCreatedToFalse()}" oncomplete="PF('privateUrlConfirmation').hide();PF('disablePrivateUrlConfirmation').show()" rendered="#{!empty(DatasetPage.privateUrl)}" update="privateUrlPanel,:messagePanel,disablePrivateUrlConfirmation"/>
</div>
</p:fragment>
<ui:remove>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/metadataFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<ui:repeat value="#{compoundValue.displayValueMap.entrySet().toArray()}" var="cvPart" varStatus="partStatus">
<c:set var="cvocOnCvPart" value="#{cvocConf.containsKey(cvPart.key.datasetFieldType.id)}"/>
<h:outputText value="#{dsf.datasetFieldType.displayFormat} " rendered="${!partStatus.first and !settingsWrapper.isCvocField(cvPart.key.datasetFieldType.id)}"/>
<ui:fragment rendered="#{!cvocOnDsfApplies or !settingsWrapper.isCvocField(cvPart.key.datasetFieldType.id)}">
<ui:fragment rendered="#{!cvocOnCvPart and !cvocOnDsfApplies or !settingsWrapper.isCvocField(cvPart.key.datasetFieldType.id)}">
<ui:fragment rendered="#{compoundValue.isLink(cvPart.key)}">
<h:outputLink value="#{compoundValue.getLink()}" target="_blank">
<h:outputText value="#{cvPart.value}"
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -2275,7 +2275,6 @@ public void testDeleteFile() {
Response v1 = UtilIT.getDatasetVersion(datasetPid, "1.0", apiToken);
v1.prettyPrint();
v1.then().assertThat()
.body("data.files[0].dataFile.filename", equalTo("cc0.png"))
.statusCode(OK.getStatusCode());

Map<String, Object> v1files1 = with(v1.body().asString()).param("fileToFind", "cc0.png")
Expand All @@ -2290,7 +2289,6 @@ public void testDeleteFile() {
Response postv1draft2 = UtilIT.getDatasetVersion(datasetPid, DS_VERSION_DRAFT, apiToken);
postv1draft2.prettyPrint();
postv1draft2.then().assertThat()
.body("data.files[0].dataFile.filename", equalTo("orcid_16x16.png"))
.statusCode(OK.getStatusCode());

Map<String, Object> v1files2 = with(postv1draft2.body().asString()).param("fileToFind", "orcid_16x16.png")
Expand Down

0 comments on commit b7b0d0f

Please sign in to comment.