Search in sources :

Example 1 with VisibilityControl

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());
}
Also used : OrcidSearchResult(org.orcid.jaxb.model.message.OrcidSearchResult) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSearchResults(org.orcid.jaxb.model.message.OrcidSearchResults) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ArrayList(java.util.ArrayList) VisibilityControl(org.orcid.core.security.visibility.aop.VisibilityControl)

Aggregations

ArrayList (java.util.ArrayList)1 VisibilityControl (org.orcid.core.security.visibility.aop.VisibilityControl)1 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)1 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)1 OrcidSearchResult (org.orcid.jaxb.model.message.OrcidSearchResult)1 OrcidSearchResults (org.orcid.jaxb.model.message.OrcidSearchResults)1