Skip to content

11912 edit template api#12159

Open
sekmiller wants to merge 30 commits intodevelopfrom
11912-edit-template-api
Open

11912 edit template api#12159
sekmiller wants to merge 30 commits intodevelopfrom
11912-edit-template-api

Conversation

@sekmiller
Copy link
Contributor

What this PR does / why we need it: Allows user to update the metadata, instructions, license, terms of use or terms of access of a given template

Which issue(s) this PR closes:

Special notes for your reviewer:

Suggestions on how to test this: There are several new api endpoints one of which is used to either update the license or the custom terms of access for a given template (see release notes and updated documentation)

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?: included

Additional documentation: included

@github-actions github-actions bot added Feature: API FY26 Sprint 10 FY26 Sprint 10 (2025-11-05 - 2025-11-19) FY26 Sprint 11 FY26 Sprint 11 (2025-11-20 - 2025-12-03) FY26 Sprint 12 FY26 Sprint 12 (2025-12-03 - 2025-12-17) FY26 Sprint 13 FY26 Sprint 13 (2025-12-17 - 2025-12-31) FY26 Sprint 14 FY26 Sprint 14 (2025-12-31 - 2026-01-14) FY26 Sprint 15 FY26 Sprint 15 (2026-01-14 - 2026-01-28) FY26 Sprint 16 FY26 Sprint 16 (2026-01-28 - 2026-02-11) labels Feb 12, 2026
@github-actions github-actions bot added SPA.Q3.2025.12 Dataset Templates Type: Feature a feature request labels Feb 12, 2026
@sekmiller sekmiller moved this to Ready for Review ⏩ in IQSS Dataverse Project Feb 12, 2026
@sekmiller sekmiller self-assigned this Feb 12, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@coveralls
Copy link

coveralls commented Feb 13, 2026

Coverage Status

coverage: 24.406% (+0.08%) from 24.329%
when pulling 68e82e6 on 11912-edit-template-api
into cf960f2 on develop.

@github-actions

This comment has been minimized.

@sekmiller sekmiller removed their assignment Feb 13, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Member

@qqmyers qqmyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. I made a few suggestions for some clean up.

}

protected Template findTemplateOrDie(Long templateId, Dataverse dataverse) throws WrappedResponse {
protected Template findAllTemplatesOrDie(Long templateId, Dataverse dataverse) throws WrappedResponse {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe findTemplateInDataverseOrDie or similar? - it doesn't return all templates, just one.

*/

String templateName = json.getString("name");
if (!templateName.isEmpty() && !templateName.isBlank()){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isBlank is true if the String isEmpty, so don't need both. (Could it be null?)


return created("/dataverses/template/" + updated.getId(), jsonTemplate(updated));
} catch (JsonParseException ex) {
logger.log(Level.SEVERE, "Semantic error parsing dataset update Json: " + ex.getMessage(), ex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a nit: a json parsing error is syntactic not semantic - maybe just "Error parsing..."

Template template = findTemplateOrDie(templateId);
Dataverse dataverse = template.getDataverse();

if (requestBody.getName() != null && !requestBody.getName().isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isBlank() instead of isEmpty()?


if (requestBody.getName() != null && !requestBody.getName().isEmpty()) {
String licenseName = requestBody.getName();
License license = licenseSvc.getByNameOrUri(licenseName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably out of scope - this method is supposed to allow using a name or URI (which is actually meant as an identifier) but using LicenseUpdateRequest limits this to a name. It's the same for the Datasets method so this PR isn't introducing anything new, but supporting URIs would be a useful addition at some point.

datasetVersionField.setControlledVocabularyValues(new ArrayList<>());
datasetVersionField.setDatasetFieldCompoundValues(new ArrayList<>());
} else {
datasetVersionField.setSingleValue("");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see setSingleValue(null) in the Dataset deleteMetadata call - but this is what's done in the UpdateDatasetFieldsCommand - any reason for the difference? I guess it makes sense to leave it unless you can justify null.

/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete?

/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

@@ -0,0 +1,86 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more

@qqmyers qqmyers moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Feb 20, 2026
@qqmyers qqmyers self-requested a review February 20, 2026 16:04
@qqmyers qqmyers self-assigned this Feb 20, 2026
@github-actions

This comment has been minimized.

@github-actions
Copy link

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:11912-edit-template-api
ghcr.io/gdcc/configbaker:11912-edit-template-api

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature: API FY26 Sprint 9 FY26 Sprint 9 (2025-10-22 - 2025-11-05) FY26 Sprint 10 FY26 Sprint 10 (2025-11-05 - 2025-11-19) FY26 Sprint 11 FY26 Sprint 11 (2025-11-20 - 2025-12-03) FY26 Sprint 12 FY26 Sprint 12 (2025-12-03 - 2025-12-17) FY26 Sprint 13 FY26 Sprint 13 (2025-12-17 - 2025-12-31) FY26 Sprint 14 FY26 Sprint 14 (2025-12-31 - 2026-01-14) FY26 Sprint 15 FY26 Sprint 15 (2026-01-14 - 2026-01-28) FY26 Sprint 16 FY26 Sprint 16 (2026-01-28 - 2026-02-11) FY26 Sprint 17 FY26 Sprint 17 (2026-02-11 - 2026-02-25) GREI Re-arch Issues related to the GREI Dataverse rearchitecture Original size: 20 Size: 20 A percentage of a sprint. 14 hours. SPA.Q3.2025.12 Dataset Templates SPA These changes are required for the Dataverse SPA Type: Feature a feature request

Projects

Status: In Review 🔎

Development

Successfully merging this pull request may close these issues.

Add a new API to edit templates metadata and Terms of Use/Access

3 participants