use of org.orcid.core.security.visibility.aop.VisibilityControl in project ORCID-Source by ORCID.
the class OrcidApiServiceDelegatorImpl method searchByQuery.
/**
* See {@link OrcidApiServiceDelegator}{@link #searchByQuery(Map)}
*/
@Override
@VisibilityControl
public Response searchByQuery(Map<String, List<String>> queryMap) {
validateSearchParams(queryMap);
OrcidMessage orcidMessage = orcidSearchManager.findOrcidsByQuery(queryMap);
List<OrcidSearchResult> searchResults = orcidMessage.getOrcidSearchResults() != null ? orcidMessage.getOrcidSearchResults().getOrcidSearchResult() : null;
List<OrcidSearchResult> filteredResults = new ArrayList<OrcidSearchResult>();
OrcidSearchResults orcidSearchResults = new OrcidSearchResults();
if (searchResults != null) {
orcidSearchResults.setNumFound(orcidMessage.getOrcidSearchResults().getNumFound());
if (searchResults.size() > 0) {
for (OrcidSearchResult searchResult : searchResults) {
OrcidSearchResult filteredSearchResult = new OrcidSearchResult();
OrcidProfile filteredProfile = new OrcidProfile();
filteredSearchResult.setRelevancyScore(searchResult.getRelevancyScore());
filteredProfile.setOrcid(searchResult.getOrcidProfile().getOrcid());
filteredProfile.setOrcidId(searchResult.getOrcidProfile().getOrcidId());
filteredProfile.setOrcidIdentifier(searchResult.getOrcidProfile().getOrcidIdentifier());
filteredProfile.setOrcidBio(searchResult.getOrcidProfile().getOrcidBio());
filteredSearchResult.setOrcidProfile(filteredProfile);
filteredResults.add(filteredSearchResult);
}
}
}
orcidSearchResults.getOrcidSearchResult().addAll(filteredResults);
return getOrcidSearchResultsResponse(orcidSearchResults, queryMap.toString());
}
Aggregations