From e4a2a327ac5fc401e020709ec13b436ced619c95 Mon Sep 17 00:00:00 2001 From: amontenegro Date: Thu, 4 Apr 2024 13:35:20 -0600 Subject: [PATCH] New endpoint in mapi --- .../server/MemberV3ApiServiceImplV3_0.java | 8 ++++++++ .../delegator/MemberV3ApiServiceDelegator.java | 1 + .../impl/MemberV3ApiServiceDelegatorImpl.java | 15 +++++++++++++-- .../org/orcid/core/api/OrcidApiConstants.java | 2 ++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/MemberV3ApiServiceImplV3_0.java b/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/MemberV3ApiServiceImplV3_0.java index 7f0058de4e7..69b1958e314 100644 --- a/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/MemberV3ApiServiceImplV3_0.java +++ b/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/MemberV3ApiServiceImplV3_0.java @@ -60,6 +60,7 @@ import static org.orcid.core.api.OrcidApiConstants.WORK; import static org.orcid.core.api.OrcidApiConstants.WORKS; import static org.orcid.core.api.OrcidApiConstants.WORK_SUMMARY; +import static org.orcid.core.api.OrcidApiConstants.RECORD_SUMMARY; import java.util.HashMap; import java.util.List; @@ -1043,4 +1044,11 @@ public Response updateResearchResource(@PathParam("orcid") String orcid, @PathPa public Response deleteResearchResource(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { return serviceDelegator.deleteResearchResource(orcid, getPutCode(putCode)); } + + @GET + @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) + @Path(RECORD_SUMMARY) + public Response getRecordSummary(@PathParam("orcid") String orcid) { + return serviceDelegator.getRecordSummary(orcid); + } } \ No newline at end of file diff --git a/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator.java b/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator.java index a737daddc44..779a60c4cd2 100644 --- a/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator.java +++ b/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator.java @@ -221,4 +221,5 @@ public interface MemberV3ApiServiceDelegator> solrParams); + Response getRecordSummary(String orcid); } diff --git a/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/impl/MemberV3ApiServiceDelegatorImpl.java b/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/impl/MemberV3ApiServiceDelegatorImpl.java index a3fb41eb9a5..3c6551e86c4 100644 --- a/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/impl/MemberV3ApiServiceDelegatorImpl.java +++ b/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/impl/MemberV3ApiServiceDelegatorImpl.java @@ -1,7 +1,5 @@ package org.orcid.api.memberV3.server.delegator.impl; -import static org.orcid.core.api.OrcidApiConstants.STATUS_OK_MESSAGE; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -18,6 +16,7 @@ import org.orcid.api.common.util.v3.ActivityUtils; import org.orcid.api.common.util.v3.ElementUtils; import org.orcid.api.memberV3.server.delegator.MemberV3ApiServiceDelegator; +import org.orcid.core.common.manager.SummaryManager; import org.orcid.core.exception.DeactivatedException; import org.orcid.core.exception.DuplicatedGroupIdRecordException; import org.orcid.core.exception.MismatchedPutCodeException; @@ -128,6 +127,7 @@ import org.orcid.jaxb.model.v3.release.record.summary.Works; import org.orcid.jaxb.model.v3.release.search.Search; import org.orcid.jaxb.model.v3.release.search.expanded.ExpandedSearch; +import org.orcid.pojo.summary.RecordSummary; import org.springframework.context.MessageSource; import org.springframework.stereotype.Component; @@ -269,6 +269,9 @@ public class MemberV3ApiServiceDelegatorImpl implements @Resource private OrcidUrlManager orcidUrlManager; + @Resource + private SummaryManager summaryManager; + public Boolean getFilterVersionOfIdentifiers() { return filterVersionOfIdentifiers; } @@ -1654,4 +1657,12 @@ private Map addParmsMismatchedPutCode(Long urlPutCode, Long body return params; } + @Override + public Response getRecordSummary(String orcid) { + orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.READ_PUBLIC); + checkProfileStatus(orcid, false); + RecordSummary summary = summaryManager.getRecordSummary(orcid); + return Response.ok(summary).build(); + } + } diff --git a/orcid-core/src/main/java/org/orcid/core/api/OrcidApiConstants.java b/orcid-core/src/main/java/org/orcid/core/api/OrcidApiConstants.java index 0d3c6c64c53..f57155e1593 100644 --- a/orcid-core/src/main/java/org/orcid/core/api/OrcidApiConstants.java +++ b/orcid-core/src/main/java/org/orcid/core/api/OrcidApiConstants.java @@ -117,5 +117,7 @@ public class OrcidApiConstants { public static final String ADDRESS = "/{orcid}/address"; public static final String PERSON = "/{orcid}/person"; + public static final String RECORD_SUMMARY = "/{orcid}/summary"; + public static final int MAX_NOTIFICATIONS_AVAILABLE = 1000; }