Skip to content

Commit

Permalink
New endpoint in mapi
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Apr 4, 2024
1 parent 78c6da3 commit e4a2a32
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,5 @@ public interface MemberV3ApiServiceDelegator<DISTINCTION, EDUCATION, EMPLOYMENT,

Response expandedSearchByQuery(Map<String, List<String>> solrParams);

Response getRecordSummary(String orcid);
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -269,6 +269,9 @@ public class MemberV3ApiServiceDelegatorImpl implements
@Resource
private OrcidUrlManager orcidUrlManager;

@Resource
private SummaryManager summaryManager;

public Boolean getFilterVersionOfIdentifiers() {
return filterVersionOfIdentifiers;
}
Expand Down Expand Up @@ -1654,4 +1657,12 @@ private Map<String, String> 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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit e4a2a32

Please sign in to comment.