Skip to content

Commit f980511

Browse files
committed
Merge branch 'develop' into 11900-improved-cvoc-value-validation2
2 parents 1528236 + 718b114 commit f980511

26 files changed

Lines changed: 1480 additions & 61 deletions
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## New Endpoint: PUT `/dataverses/{templateId}/metadata`
2+
3+
A new endpoint has been implemented to edit the metadata and field instructions for a given template.
4+
5+
### Functionality
6+
- Updates the metadata and field instructions for a template based on a json file provided.
7+
- You must have edit dataverse permission in the collection in order to use this endpoint.
8+
9+
## New Endpoint: PUT `/dataverses/{templateId}/licenseTerms`
10+
11+
A new endpoint has been implemented to edit the license or custom terms of use for a given template.
12+
13+
### Functionality
14+
- Updates the license or custom terms of use for a template based on a json file provided.
15+
- You must have edit dataverse permission in the collection in order to use this endpoint.
16+
17+
## New Endpoint: PUT `/dataverses/{templateId}/access`
18+
19+
A new endpoint has been implemented to edit the terms of access for a given template.
20+
21+
### Functionality
22+
- Updates the terms of access for a template based on a json file provided.
23+
- You must have edit dataverse permission in the collection in order to use this endpoint.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
All API endpoints that return information about role assignments (such as `/api/dataverses/$ID/assignments`) now include additional fields in their JSON responses: `assigneeName`, `roleDescription`, `definitionPointName`, `definitionPointType`, and `definitionPointGlobalId` (if available).
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## BUG
2+
Timing issue fixed where user only had a few seconds instead of a minute to call the File download API after POSTing the guestbook response
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"customTermsOfAccess": {
3+
"fileAccessRequest": false,
4+
"termsOfAccess": "Here are the terms...",
5+
"dataAccessPlace": "dataAccessPlace",
6+
"originalArchive": "originalArchive",
7+
"availabilityStatus": "availabilityStatus",
8+
"contactForAccess": "contactForAccess",
9+
"sizeOfCollection": "sizeOfCollection",
10+
"studyCompletion": "studyCompletion",
11+
"confidentialityDeclaration": "confidentialityDeclaration"
12+
}
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "name": "CC BY 4.0" }
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "Dataverse template - edited",
3+
"fields": [
4+
{
5+
"typeName": "author",
6+
"value": [
7+
{
8+
"authorName": {
9+
"typeName": "authorName",
10+
"value": "Brady, Tom"
11+
},
12+
"authorAffiliation": {
13+
"typeName": "authorIdentifierScheme",
14+
"value": "ORCID"
15+
}
16+
}
17+
]
18+
}
19+
],
20+
"instructions": [
21+
{
22+
"instructionField": "author",
23+
"instructionText": "The author data, edited"
24+
},
25+
{
26+
"instructionField": "subtitle",
27+
"instructionText": "Instructions for subtitle"
28+
}
29+
]
30+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"customTerms": {
3+
"termsOfUse": "testTermsOfUse",
4+
"confidentialityDeclaration": "testConfidentialityDeclaration",
5+
"specialPermissions": "testSpecialPermissions",
6+
"restrictions": "testRestrictions",
7+
"citationRequirements": "testCitationRequirements",
8+
"depositorRequirements": "testDepositorRequirements",
9+
"conditions": "testConditions",
10+
"disclaimer": "testDisclaimer"
11+
}
12+
}

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

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,6 +1755,69 @@ The fully expanded example above (without environment variables) looks like this
17551755
17561756
curl -H "X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X POST "https://demo.dataverse.org/api/dataverses/1/templates" --upload-file dataverse-template.json
17571757
1758+
Update the Metadata and Instructions of a Template
1759+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1760+
1761+
Updates the metadata and instructions of a template with a given ``id``.
1762+
1763+
To update the template, you must send a JSON file. Your JSON file might look like :download:`template-update-metadata.json <../_static/api/template-update-metadata.json>` which you would send to the Dataverse installation like this:
1764+
1765+
.. code-block:: bash
1766+
1767+
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
1768+
export SERVER_URL=https://demo.dataverse.org
1769+
export ID=1
1770+
1771+
curl -H "X-Dataverse-key: $API_TOKEN" -X PUT "$SERVER_URL/api/dataverses/{ID}/metadata" --upload-file template-update-metadata.json
1772+
1773+
The fully expanded example above (without environment variables) looks like this:
1774+
1775+
.. code-block:: bash
1776+
1777+
curl -H "X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT "https://demo.dataverse.org/api/dataverses/1/metadata" --upload-file template-update-metadata.json
1778+
1779+
Update the License or Terms Of Use of a Template
1780+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1781+
1782+
Updates the license or custom terms of use of a template with a given ``id``.
1783+
1784+
To update the template, you must send a JSON file containing either the name of an active license or custom terms of use. Your JSON file might look like :download:`template-update-license.json <../_static/api/template-update-license.json>` or :download:`template-update-terms.json <../_static/api/template-update-terms.json>` which you would send to the Dataverse installation like this:
1785+
1786+
.. code-block:: bash
1787+
1788+
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
1789+
export SERVER_URL=https://demo.dataverse.org
1790+
export ID=1
1791+
1792+
curl -H "X-Dataverse-key: $API_TOKEN" -X PUT "$SERVER_URL/api/dataverses/{ID}/licenseTerms" --upload-file template-update-license.json
1793+
1794+
The fully expanded example above (without environment variables) looks like this:
1795+
1796+
.. code-block:: bash
1797+
1798+
curl -H "X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT "https://demo.dataverse.org/api/dataverses/1/licenseTerms" --upload-file template-update-license.json
1799+
1800+
Update the Terms Of Access of a Template
1801+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1802+
1803+
Updates the terms of access of a template with a given ``id``.
1804+
1805+
To update the template, you must send a JSON file containing either the name of an active license or custom terms of use. Your JSON file might look like :download:`template-update-access.json <../_static/api/template-update-access.json>` which you would send to the Dataverse installation like this:
1806+
1807+
.. code-block:: bash
1808+
1809+
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
1810+
export SERVER_URL=https://demo.dataverse.org
1811+
export ID=1
1812+
1813+
curl -H "X-Dataverse-key: $API_TOKEN" -X PUT "$SERVER_URL/api/dataverses/{ID}/access" --upload-file template-update-access.json
1814+
1815+
The fully expanded example above (without environment variables) looks like this:
1816+
1817+
.. code-block:: bash
1818+
1819+
curl -H "X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT "https://demo.dataverse.org/api/dataverses/1/access" --upload-file template-update-access.json
1820+
17581821
Set a Default Template for a Collection
17591822
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17601823

src/main/java/edu/harvard/iq/dataverse/DvObject.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ public String visit(DataFile df) {
140140

141141
@Column(insertable = false, updatable = false) private String dtype;
142142

143+
public String getDtype() {
144+
return dtype;
145+
}
146+
143147
@OneToMany(mappedBy="dvobject",fetch = FetchType.LAZY,cascade={CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
144148
private List<DataverseFeaturedItem> dataverseFeaturedItems;
145149

src/main/java/edu/harvard/iq/dataverse/api/AbstractApiBean.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ String getWrappedMessageWhenJson() {
242242

243243
@EJB
244244
GuestbookResponseServiceBean gbRespSvc;
245+
246+
@EJB
247+
TemplateServiceBean templateSvc;
245248

246249
@Inject
247250
FailedPIDResolutionLoggingServiceBean fprLogService;
@@ -370,8 +373,18 @@ protected Dataverse findDataverseOrDie( String dvIdtf ) throws WrappedResponse {
370373
}
371374
return dv;
372375
}
376+
377+
protected Template findTemplateOrDie(Long templateId) throws WrappedResponse {
378+
379+
Template template = templateSvc.find(templateId);
380+
if (template == null) {
381+
throw new WrappedResponse(
382+
error(Response.Status.NOT_FOUND, "Can't find template with identifier='" + templateId + "'"));
383+
}
384+
return template;
385+
}
373386

374-
protected Template findTemplateOrDie(Long templateId, Dataverse dataverse) throws WrappedResponse {
387+
protected Template findTemplateInDataverseOrParentsOrDie(Long templateId, Dataverse dataverse) throws WrappedResponse {
375388

376389
List<Template> templates = new ArrayList<>();
377390

0 commit comments

Comments
 (0)