-
Notifications
You must be signed in to change notification settings - Fork 531
11634 api get available file categories #11668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
| try { | ||
| Dataset ds = findDatasetOrDie(idSupplied); | ||
| categoriesByName = new ArrayList<>(); | ||
| List<String> datasetFileCategories = dataFileCategoryService.mergeDatasetFileCategories(ds.getCategories()); |
There was a problem hiding this comment.
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); }
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
📦 Pushed preview images as 🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |


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