[Backport dtq-dev] Issue 1360: allow to change license in workflow item, in PATCH operation (ufal#1365)#1327
Conversation
…ion (ufal#1365) * Issue 1360: allow to change license in workflow item, in PATCH operation * improve fix + Integration test * resolve Copilot comments * resolve more MR comments * return 404 in case PATCH request references non existing license * improve error message for task claimed by other user * resolve second round of Copilot comments * small code refactoring * fixed failing test (cherry picked from commit 40672c3)
|
Warning Review limit reached
More reviews will be available in 49 minutes and 38 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Backport of ufal#1365 to
dtq-dev. The automated port-pr cherry-pick of40672c3241failed; resolved manually, and adapted to dtq-dev's existing license architecture (see below).What ufal#1365 does
Lets a reviewer/editor change the CLARIN license of an item from a workflow item via
PATCH /api/workflow/workflowitems/{id}withreplace /license. It also tightens the edit-allowed gate (checkIfEditMetadataAllowedInCurrentStep) so it distinguishes "not claimed by anyone" (422) from "claimed by another user" (403, viaAuthorizeException).Adaptation vs the literal upstream change
ufal#1365 introduced a new helper
ClarinLicenseUtils.updateLicenseForItem(...)and rerouted both the workspace/licensepath and the new workflow path through it. dtq-dev already has its own consolidated helperClarinLicenseSubmissionUtils.applyLicense(context, item, name)(used by both the legacy/licensepath and the/sections/clarin-license/selectpath). To avoid two parallel license helpers on dtq-dev, this backport:ClarinLicenseUtilsclass entirely.WorkspaceItemRestRepositoryunchanged (dtq-dev already applies the license viamaintainLicensesForItem→applyLicense).WorkflowItemRestRepository, routes the/licensePATCH through the existingClarinLicenseSubmissionUtils.applyLicense(context, source.getItem(), extractLicenseName(op)). BecauseapplyLicenseresolves its services via factories, the two@Autowiredservice fields Issue 1360: allow to change license in workflow item, in PATCH operation ufal/clarin-dspace#1365 added are not needed and were omitted.List<ClaimedTask>gate change and thesource == nullguard verbatim.Status codes preserved (per the IT tests)
extractLicenseNamedeliberately mirrors ufal#1365's strict value validation (not dtq-dev's lenient section-step extractor), so the IT expectations hold:replaceop or malformed value ({},["..."]) → 400ClarinLicenseNotFoundException, which is@ResponseStatus(NOT_FOUND); intentionally not wrapped as 422){value: "..."}) → 200Net change: 3 files (
WorkflowItemRestRepository,ClarinWorkflowItemRestRepositoryITnew tests,TaskRestRepositoriesITone 422→403 expectation).Head branch is on my fork (
kosarko/DSpace) since I don't have push access todataquest-dev. No local Maven in this env — manually audited import order/usage/braces/exception mapping; CI compiles and runs the ITs.