コード例 #1
0
 /** See {@link OrcidApiServiceDelegator}{@link #searchByQuery(Map)} */
 @Override
 @VisibilityControl
 public Response searchByQuery(Map<String, List<String>> 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());
 }
コード例 #2
0
  private Response orcidWithMultipleResults() {

    OrcidMessage orcidMessage = new OrcidMessage();
    OrcidProfile orcidProfile1 = new OrcidProfile();
    OrcidProfile orcidProfile2 = new OrcidProfile();
    OrcidProfile orcidProfile3 = new OrcidProfile();

    OrcidSearchResult orcidSearchResult1 = new OrcidSearchResult();
    OrcidSearchResult orcidSearchResult2 = new OrcidSearchResult();
    OrcidSearchResult orcidSearchResult3 = new OrcidSearchResult();

    orcidSearchResult1.setOrcidProfile(orcidProfile1);
    orcidSearchResult2.setOrcidProfile(orcidProfile2);
    orcidSearchResult3.setOrcidProfile(orcidProfile3);

    List<OrcidSearchResult> searchResults = new ArrayList<OrcidSearchResult>();
    searchResults.add(orcidSearchResult1);
    searchResults.add(orcidSearchResult2);
    searchResults.add(orcidSearchResult3);

    OrcidSearchResults orcidSearchResults = new OrcidSearchResults();
    orcidSearchResults.getOrcidSearchResult().addAll(searchResults);
    orcidMessage.setOrcidSearchResults(orcidSearchResults);
    return Response.ok(orcidMessage).build();
  }