Skip to content

Commit 1768925

Browse files
authored
add path to mapi works endpoint (#7267)
1 parent c067eff commit 1768925

File tree

6 files changed

+15
-1
lines changed

6 files changed

+15
-1
lines changed

orcid-api-web/src/main/java/org/orcid/api/memberV2/server/delegator/impl/MemberV2ApiServiceDelegatorImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,7 @@ public Response viewBulkWorks(String orcid, String putCodes) {
10881088
orcidSecurityManager.checkAndFilter(orcid, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
10891089
contributorUtils.filterContributorPrivateData(workBulk);
10901090
ActivityUtils.cleanEmptyFields(workBulk);
1091+
ActivityUtils.setPathToBulk(workBulk, orcid);
10911092
sourceUtils.setSourceName(workBulk);
10921093
return Response.ok(workBulk).build();
10931094
}

orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/impl/MemberV3ApiServiceDelegatorImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,7 @@ public Response viewBulkWorks(String orcid, String putCodes) {
12021202
orcidSecurityManager.checkAndFilter(orcid, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
12031203
contributorUtils.filterContributorPrivateData(workBulk);
12041204
ActivityUtils.cleanEmptyFields(workBulk);
1205+
ActivityUtils.setPathToBulk(workBulk, orcid);
12051206
sourceUtils.setSourceName(workBulk);
12061207
return Response.ok(workBulk).build();
12071208
}

orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_WorksTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,9 @@ public void testViewBulkWorks() {
727727
assertTrue(workBulk.getBulk().get(1) instanceof Work);
728728
assertTrue(workBulk.getBulk().get(2) instanceof Work); // private work but matching source
729729
assertTrue(workBulk.getBulk().get(3) instanceof OrcidError); // private work not matching source
730+
assertEquals("/0000-0000-0000-0003/work/11", ((Work) workBulk.getBulk().get(0)).getPath());
731+
assertEquals("/0000-0000-0000-0003/work/12", ((Work) workBulk.getBulk().get(1)).getPath());
732+
assertEquals("/0000-0000-0000-0003/work/13", ((Work) workBulk.getBulk().get(2)).getPath());
730733
}
731734

732735
@Test

orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceVersionedDelegatorTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1558,8 +1558,11 @@ public void testViewBulkWorks() {
15581558
assertTrue(workBulk.getBulk().get(1) instanceof Work);
15591559
assertTrue(workBulk.getBulk().get(2) instanceof Work); // private work but matching source
15601560
assertTrue(workBulk.getBulk().get(3) instanceof OrcidError); // private work not matching source
1561+
assertEquals("/0000-0000-0000-0003/work/11", ((Work) workBulk.getBulk().get(0)).getPath());
1562+
assertEquals("/0000-0000-0000-0003/work/12", ((Work) workBulk.getBulk().get(1)).getPath());
1563+
assertEquals("/0000-0000-0000-0003/work/13", ((Work) workBulk.getBulk().get(2)).getPath());
15611564
}
1562-
1565+
15631566
@Test
15641567
public void testViewBulkWorksWithBadPutCode() {
15651568
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0003", ScopePathType.READ_LIMITED);

orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegatorErrorsTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,9 @@ public void testViewBulkWorks() {
16541654
// work not
16551655
// matching
16561656
// source
1657+
assertEquals("/0000-0000-0000-0003/work/11", ((Work) workBulk.getBulk().get(0)).getPath());
1658+
assertEquals("/0000-0000-0000-0003/work/12", ((Work) workBulk.getBulk().get(1)).getPath());
1659+
assertEquals("/0000-0000-0000-0003/work/13", ((Work) workBulk.getBulk().get(2)).getPath());
16571660
}
16581661

16591662
@Test

orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_WorksTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,9 @@ public void testViewBulkWorks() {
734734
assertTrue(workBulk.getBulk().get(1) instanceof Work);
735735
assertTrue(workBulk.getBulk().get(2) instanceof Work); // private work but matching source
736736
assertTrue(workBulk.getBulk().get(3) instanceof OrcidError); // private work not matching source
737+
assertEquals("/0000-0000-0000-0003/work/11", ((Work) workBulk.getBulk().get(0)).getPath());
738+
assertEquals("/0000-0000-0000-0003/work/12", ((Work) workBulk.getBulk().get(1)).getPath());
739+
assertEquals("/0000-0000-0000-0003/work/13", ((Work) workBulk.getBulk().get(2)).getPath());
737740
}
738741

739742
@Test

0 commit comments

Comments
 (0)