v2 API & UI cleanup: preview/download split, fixed downloads (Files and DIPFiles), toolbar updates #3545
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixed broken downloads and filled missing v2 API endpoints by cleanly separating preview vs download for Files and DIPFiles. It updated controllers/services, aligned UI helpers with the new endpoints, and introduced a dynamic toolbar in order to assign the correct actions. Fixes #3516
RodaConstants
added API_REST_V2_DIPFILES constant for the new DIPFiles endpoints.
DIPController
fixed /api/v2/dips/{uuid}/download to use requestContext.getIndexService() (correct index access) and streamed the response.
DIPFileController and DIPFileService
added v2 endpoints:
roda-roles.properties
added new roda-roles properties permissions for DIPFileController endpoint methods previewBinary and downloadBinary (aip.read)
FilesService
fixed representation file download by building the full path from IndexedFile metadata and using it to resolve (stream file vs export directory if folder)
BrowseDIP
replaced @UIField BrowseDIPActionsToolbar with provided ActionsToolbar for dynamic toolbar
created a new BrowseDIPFileActionsToolbar.java class specific for download, uses DisseminationFileActions.java
updated BrowseDIP.ui.xml with ActionsToolbar binding
BrowseDIPTabs
fixed view tab for dissemination preview
RestUtils
Files (representation files):
DIPFiles:
DipFilePreview
switched preview source to /api/v2/dip-files/{uuid}/preview via RestUtils.createDipFilePreviewUri (was using download).
removed unused constructor and minor cleanup.
IndexedFilePreview
Use RestUtils.createRepresentationFilePreviewUri instead of download helper.