Skip to content

Commit

Permalink
Merge branch 'develop' into 8763-5.11-release-notes
Browse files Browse the repository at this point in the history
  • Loading branch information
sekmiller committed Jun 10, 2022
2 parents 03448a5 + a324b51 commit b2f55bb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 8 deletions.
5 changes: 5 additions & 0 deletions doc/release-notes/8599-legacy-templates
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Some older legacy templates did not have an associated termsofuseandaccess linked to them. When custom licenses were added, dataverses that these legacy templates as default would not allow the creation of a new dataset (500 error).

In this release, we run a script that creates a default empty termsofuseandaccess for each of these templates and links them.

Note the termsofuseandaccess that are created this way default to using the license with id=1 (cc0) and the fileaccessrequest to false.
7 changes: 7 additions & 0 deletions doc/sphinx-guides/source/api/apps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ Docker image from a code repository that follows the [reproducible executable en

https://github.com/jupyter/repo2docker/blob/master/repo2docker/contentproviders/dataverse.py

dataverse-migration-scripts
~~~~~~~~~~~~~~~~~~~~~~~~~~~

This series of Python scripts offers a starting point for migrating datasets from one Dataverse installation to another. Multiple parts of the process are handled in these scripts, including adding users, collections, and multiple versions of datasets. These scripts were developed to migrate data from version 4.20 to 5.1, but may provide a helpful starting point for other software versions. The :doc:`migration APIs </developers/dataset-migration-api>` added in version 5.6 are not used. You can find more details in the repository, as well as `this Google group thread <https://groups.google.com/g/dataverse-community/c/4yy3U5RtUAs/m/OLogk12NBgAJ>`_.

https://github.com/scholarsportal/dataverse-migration-scripts

Java
----

Expand Down
16 changes: 9 additions & 7 deletions src/main/java/edu/harvard/iq/dataverse/DatasetVersionUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import static java.util.stream.Collectors.toList;
import javax.ejb.EJB;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
Expand All @@ -39,22 +41,22 @@ public class DatasetVersionUI implements Serializable {
public DatasetVersionUI() {
}

private Map<MetadataBlock, List<DatasetField>> metadataBlocksForView = new HashMap<>();
private Map<MetadataBlock, List<DatasetField>> metadataBlocksForEdit = new HashMap<>();
private TreeMap<MetadataBlock, List<DatasetField>> metadataBlocksForView = new TreeMap<>();
private TreeMap<MetadataBlock, List<DatasetField>> metadataBlocksForEdit = new TreeMap<>();

public Map<MetadataBlock, List<DatasetField>> getMetadataBlocksForView() {
public TreeMap<MetadataBlock, List<DatasetField>> getMetadataBlocksForView() {
return metadataBlocksForView;
}

public void setMetadataBlocksForView(Map<MetadataBlock, List<DatasetField>> metadataBlocksForView) {
public void setMetadataBlocksForView(TreeMap<MetadataBlock, List<DatasetField>> metadataBlocksForView) {
this.metadataBlocksForView = metadataBlocksForView;
}

public Map<MetadataBlock, List<DatasetField>> getMetadataBlocksForEdit() {
public TreeMap<MetadataBlock, List<DatasetField>> getMetadataBlocksForEdit() {
return metadataBlocksForEdit;
}

public void setMetadataBlocksForEdit(Map<MetadataBlock, List<DatasetField>> metadataBlocksForEdit) {
public void setMetadataBlocksForEdit(TreeMap<MetadataBlock, List<DatasetField>> metadataBlocksForEdit) {
this.metadataBlocksForEdit = metadataBlocksForEdit;
}

Expand Down Expand Up @@ -417,7 +419,7 @@ public void setMetadataValueBlocks(DatasetVersion datasetVersion) {
actualMDB.add(mdbTest);
}
}
}
}

for (MetadataBlock mdb : actualMDB) {
mdb.setEmpty(true);
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/MetadataBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@NamedQuery( name="MetadataBlock.findByName", query = "SELECT mdb FROM MetadataBlock mdb WHERE mdb.name=:name")
})
@Entity
public class MetadataBlock implements Serializable {
public class MetadataBlock implements Serializable, Comparable {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -210,4 +210,12 @@ public String getLocaleDisplayName()
return displayName;
}
}

@Override
public int compareTo(Object arg0) {
//guaranteeing that citation will be shown first with custom blocks in order of creation
MetadataBlock other = (MetadataBlock) arg0;
Long t = "citation".equals(name) ? -1 : this.getId();
return t.compareTo("citation".equals(other.name) ? -1 : other.getId());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- this script finds legacy templates that do not hava an associated termsofuseandaccess
-- and creates / links a termsofuseandaccess to them
with _update as
(
update template set termsofuseandaccess_id = nextval('termsofuseandaccess_id_seq' )
where termsofuseandaccess_id is null
returning termsofuseandaccess_id
)
insert into termsofuseandaccess (id, fileaccessrequest, license_id) (select termsofuseandaccess_id, false, 1 from _update)

Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,11 @@ public void setUp() {
mbA = new MetadataBlock();
mbA.setOwner(root);
mbA.setId(1l);
mbA.setName("mbA");
mbB = new MetadataBlock();
mbB.setOwner(childE);
mbB.setId(2l);
mbB.setName("mbB");
mbsE.add(mbB);
mbsEE.add(mbA);
mbsEE.add(mbB);
Expand Down

0 comments on commit b2f55bb

Please sign in to comment.