Skip to content

Conversation

@sekmiller
Copy link
Contributor

@sekmiller sekmiller commented Jul 22, 2025

What this PR does / why we need it: Adds an api that returns the available file categories for a given dataset. Needed for the SPA for edit tags/files.

Which issue(s) this PR closes:

Special notes for your reviewer: no permissions added. didn't seem necessary - there's no mischief that can be made with the knowledge. perms required for actually updating a file's tags. (inadvertently ran a "source format" on all of Datasets.java instead of just the part I added. review with whitespace off recommended.)

Suggestions on how to test this: add a custom tag to a dataset file confirm that the api returns that custom tag along with the built-in tags.

curl "http://localhost:8080/api/datasets/:persistentId/availableFileCategories?persistentId=doi:10.5072/FK2/4ZOOF9"

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: added to native api doc

@github-actions github-actions bot added FY26 Sprint 2 FY26 Sprint 2 (2025-07-16 - 2025-07-30) GREI Re-arch Issues related to the GREI Dataverse rearchitecture Original size: 10 Size: 10 A percentage of a sprint. 7 hours. SPA These changes are required for the Dataverse SPA SPA.Q3.2025.5 File Page: Edit File Tags Type: Feature a feature request labels Jul 22, 2025
@sekmiller sekmiller moved this to Ready for Review ⏩ in IQSS Dataverse Project Jul 22, 2025
@github-actions

This comment has been minimized.

@coveralls
Copy link

coveralls commented Jul 23, 2025

Coverage Status

coverage: 23.215% (-0.002%) from 23.217%
when pulling 9d00ef3 on 11634-api-get-available-file-categories
into d27d4c7 on develop.

@stevenwinship stevenwinship self-assigned this Jul 23, 2025
@stevenwinship stevenwinship moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Jul 23, 2025
try {
Dataset ds = findDatasetOrDie(idSupplied);
categoriesByName = new ArrayList<>();
List<String> datasetFileCategories = dataFileCategoryService.mergeDatasetFileCategories(ds.getCategories());
Copy link
Contributor

@stevenwinship stevenwinship Jul 23, 2025

Choose a reason for hiding this comment

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

This looks like you're looping through a list twice. Once to build a list of names and another to add the names to the JsonArrayBuilder. I would suggest doing this in a single loop
ie. for (String fieldName : dataFileCategoryService.mergeDatasetFileCategories(ds.getCategories()) { fileCategoriesArrayBuilder.add(fieldName); }

Copy link
Member

Choose a reason for hiding this comment

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

categoriesByName isn't ever used is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch - categoriesByName was copied over from DatasetPage - goes into the jsf popup - not needed for the json return.

@github-actions

This comment has been minimized.

@github-project-automation github-project-automation bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Jul 23, 2025
@stevenwinship stevenwinship removed their assignment Jul 23, 2025
@github-actions

This comment has been minimized.

@github-actions
Copy link

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:11634-api-get-available-file-categories
ghcr.io/gdcc/configbaker:11634-api-get-available-file-categories

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

@ofahimIQSS ofahimIQSS self-assigned this Jul 24, 2025
@ofahimIQSS ofahimIQSS moved this from Ready for QA ⏩ to QA ✅ in IQSS Dataverse Project Jul 24, 2025
@ofahimIQSS
Copy link
Contributor

image image

Looks good to me - merging

@ofahimIQSS ofahimIQSS merged commit 1c1eb30 into develop Jul 24, 2025
23 checks passed
@github-project-automation github-project-automation bot moved this from QA ✅ to Merged 🚀 in IQSS Dataverse Project Jul 24, 2025
@ofahimIQSS ofahimIQSS deleted the 11634-api-get-available-file-categories branch July 24, 2025 16:11
@ofahimIQSS ofahimIQSS removed their assignment Jul 24, 2025
@pdurbin pdurbin added this to the 6.8 milestone Jul 24, 2025
@scolapasta scolapasta moved this from Merged 🚀 to Done 🧹 in IQSS Dataverse Project Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 2 FY26 Sprint 2 (2025-07-16 - 2025-07-30) GREI Re-arch Issues related to the GREI Dataverse rearchitecture Original size: 10 Size: 10 A percentage of a sprint. 7 hours. SPA.Q3.2025.5 File Page: Edit File Tags SPA These changes are required for the Dataverse SPA Type: Feature a feature request

Projects

Status: Done 🧹

Development

Successfully merging this pull request may close these issues.

API: Get Available Dataset File Categories

7 participants