Skip to content

Commit aec8451

Browse files
Matus Kasakclaude
andcommitted
Register CLARIN link repositories under plural model names (DSpace 9 contract)
Six CLARIN LinkRestRepository beans are still registered under the singular model name, so all six advertised sub-resources return 404 on the v9 base while they return 200 on 7.6.5. DSpace 7 singularized the URL segment before the bean lookup -- Utils.getLinkResourceRepository() called makeSingular(modelPlural). DSpace 9 removed that step and looks the bean up under the plural segment verbatim, so a link repository must now be registered as <category>.<typePlural>.<rel>. The upstream migration renamed its own 71 link repositories accordingly and added PLURAL_NAME to the REST models, but these six CLARIN ones were missed. Note ClarinLicenseResourceUserAllowanceRestRepository (the MAIN repository) *was* migrated to PLURAL_NAME, which is why GET /core/clarinlruallowances/242 returns 200 while every one of its rels 404s. Migrating a main repository without its link repositories leaves all its sub-resources dead. Why this is easy to misread: a missing bean raises RepositoryNotFoundException, and a missing route resolves BEFORE any authorization check. The one defect therefore surfaces as "404 != 200" for an admin, "404 != 401" for anonymous and "404 != 403" for a non-owner -- it reads like an authorization problem, and the 404 body names the plural type that is not how the bean is registered: {"status":404,"message":"The repository type core.clarinlruallowances was not found"} Meanwhile the allowance JSON keeps advertising all three _links, so the API describes endpoints it cannot serve. Measured, admin token, dev-6.pc:8603 (9.3) vs dev-5.pc:88 (7.6.5): core/clarinlruallowances/242 200 200 core/clarinlruallowances/242/userMetadata *404* 200 core/clarinlruallowances/242/userRegistration *404* 200 core/clarinlruallowances/242/resourceMapping *404* 200 core/clarinuserregistrations/1/userMetadata *404* 200 core/clarinuserregistrations/1/clarinLicenses *404* 200 core/clarinlicenseresourcemappings/1383/clarinLicense *404* 200 Audit backing the "six and only six" claim: of 77 LinkRestRepository implementations on this branch, 71 already use PLURAL_NAME, these 6 used NAME, and none uses a literal bean-name string. Every main (non-link) repository is already plural. So this closes the gap completely. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent ea8b872 commit aec8451

6 files changed

Lines changed: 6 additions & 6 deletions

dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/CLRUAResourceMappingLinkRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/**
2929
* CLRUA = ClarinLicenseResourceUserAllowance
3030
*/
31-
@Component(ClarinLicenseResourceUserAllowanceRest.CATEGORY + "." + ClarinLicenseResourceUserAllowanceRest.NAME +
31+
@Component(ClarinLicenseResourceUserAllowanceRest.CATEGORY + "." + ClarinLicenseResourceUserAllowanceRest.PLURAL_NAME +
3232
"." + ClarinLicenseResourceUserAllowanceRest.RESOURCE_MAPPING)
3333
public class CLRUAResourceMappingLinkRepository extends AbstractDSpaceRestRepository
3434
implements LinkRestRepository {

dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/CLRUAUUserRegistrationLinkRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/**
3030
* CLRUA = ClarinLicenseResourceUserAllowance
3131
*/
32-
@Component(ClarinLicenseResourceUserAllowanceRest.CATEGORY + "." + ClarinLicenseResourceUserAllowanceRest.NAME +
32+
@Component(ClarinLicenseResourceUserAllowanceRest.CATEGORY + "." + ClarinLicenseResourceUserAllowanceRest.PLURAL_NAME +
3333
"." + ClarinLicenseResourceUserAllowanceRest.USER_REGISTRATION)
3434
public class CLRUAUUserRegistrationLinkRepository extends AbstractDSpaceRestRepository
3535
implements LinkRestRepository {

dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/CLRUAUserMetadataLinkRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
/**
3333
* CLRUA = ClarinLicenseResourceUserAllowance
3434
*/
35-
@Component(ClarinLicenseResourceUserAllowanceRest.CATEGORY + "." + ClarinLicenseResourceUserAllowanceRest.NAME +
35+
@Component(ClarinLicenseResourceUserAllowanceRest.CATEGORY + "." + ClarinLicenseResourceUserAllowanceRest.PLURAL_NAME +
3636
"." + ClarinLicenseResourceUserAllowanceRest.USER_METADATA)
3737
public class CLRUAUserMetadataLinkRepository extends AbstractDSpaceRestRepository
3838
implements LinkRestRepository {

dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/CUserRegistrationCLicenseLinkRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
2828
import org.springframework.stereotype.Component;
2929

30-
@Component(ClarinUserRegistrationRest.CATEGORY + "." + ClarinUserRegistrationRest.NAME + "." +
30+
@Component(ClarinUserRegistrationRest.CATEGORY + "." + ClarinUserRegistrationRest.PLURAL_NAME + "." +
3131
ClarinUserRegistrationRest.CLARIN_LICENSES)
3232
public class CUserRegistrationCLicenseLinkRepository extends AbstractDSpaceRestRepository
3333
implements LinkRestRepository {

dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ClarinResourceMappingCLicenseLinkRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
2525
import org.springframework.stereotype.Component;
2626

27-
@Component(ClarinLicenseResourceMappingRest.CATEGORY + "." + ClarinLicenseResourceMappingRest.NAME +
27+
@Component(ClarinLicenseResourceMappingRest.CATEGORY + "." + ClarinLicenseResourceMappingRest.PLURAL_NAME +
2828
"." + ClarinLicenseResourceMappingRest.CLARIN_LICENSE)
2929
public class ClarinResourceMappingCLicenseLinkRepository extends AbstractDSpaceRestRepository
3030
implements LinkRestRepository {

dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ClarinUserRegistrationUserMetadataLinkRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
2626
import org.springframework.stereotype.Component;
2727

28-
@Component(ClarinUserRegistrationRest.CATEGORY + "." + ClarinUserRegistrationRest.NAME + "." +
28+
@Component(ClarinUserRegistrationRest.CATEGORY + "." + ClarinUserRegistrationRest.PLURAL_NAME + "." +
2929
ClarinUserRegistrationRest.USER_METADATA)
3030
public class ClarinUserRegistrationUserMetadataLinkRepository extends AbstractDSpaceRestRepository
3131
implements LinkRestRepository {

0 commit comments

Comments
 (0)