Example #1
0
  private OrcidMessage fakeBio() throws DatatypeConfigurationException {
    OrcidMessage orcidMessage = new OrcidMessage();
    OrcidProfile orcidProfile1 = new OrcidProfile();
    OrcidIdentifier orcidIdentifier = new OrcidIdentifier();
    orcidProfile1.setOrcidIdentifier(orcidIdentifier);
    orcidIdentifier.setUri("http://orcid.example.com/000-1337");
    orcidIdentifier.setPath("000-1337");
    OrcidBio bio = new OrcidBio();
    orcidProfile1.setOrcidBio(bio);
    OrcidHistory history = new OrcidHistory();
    XMLGregorianCalendar value =
        dataTypeFactory.newXMLGregorianCalendar(1980, 12, 31, 23, 29, 29, 999, 0);
    history.setCreationMethod(CreationMethod.WEBSITE);
    history.setLastModifiedDate(new LastModifiedDate(value));
    orcidProfile1.setOrcidHistory(history);
    PersonalDetails personal = new PersonalDetails();
    bio.setPersonalDetails(personal);
    personal.setFamilyName(new FamilyName("Doe"));
    personal.setCreditName(new CreditName("John F Doe"));
    personal.setGivenNames(new GivenNames("John"));
    personal.setOtherNames(new OtherNames());
    personal.getOtherNames().addOtherName("Johnny", Visibility.PUBLIC);
    personal.getOtherNames().addOtherName("Mr Doe", Visibility.PUBLIC);

    ResearcherUrls urls = new ResearcherUrls();
    bio.setResearcherUrls(urls);

    ResearcherUrl anonymous =
        new ResearcherUrl(new Url("http://example.com/anon"), Visibility.PUBLIC);
    urls.getResearcherUrl().add(anonymous);

    // "home page" - with strange casing
    ResearcherUrl homePage =
        new ResearcherUrl(
            new Url("http://example.com/myPage"), new UrlName("homePage"), Visibility.PUBLIC);
    urls.getResearcherUrl().add(homePage);

    ResearcherUrl foaf =
        new ResearcherUrl(
            new Url("http://example.com/foaf#me"), new UrlName("FOAF"), Visibility.PUBLIC);
    urls.getResearcherUrl().add(foaf);

    ResearcherUrl webId =
        new ResearcherUrl(
            new Url("http://example.com/webId"), new UrlName("webID"), Visibility.PUBLIC);
    urls.getResearcherUrl().add(webId);

    ResearcherUrl other =
        new ResearcherUrl(
            new Url("http://example.com/other"), new UrlName("other"), Visibility.PUBLIC);
    urls.getResearcherUrl().add(other);

    bio.setContactDetails(new ContactDetails());
    bio.getContactDetails()
        .setEmail(Arrays.asList(new Email("*****@*****.**"), new Email("*****@*****.**")));
    bio.getContactDetails().setAddress(new Address());
    bio.getContactDetails().getAddress().setCountry(new Country(Iso3166Country.GB));
    orcidMessage.setOrcidProfile(orcidProfile1);
    return orcidMessage;
  }
 /** 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());
 }
Example #3
0
 public OrcidProfile getOrcidProfile(String orcid) {
   OrcidProfile orcidProfile = new OrcidProfile();
   orcidProfile.setOrcidIdentifier(orcid);
   OrcidBio orcidBio = new OrcidBio();
   orcidProfile.setOrcidBio(orcidBio);
   Delegation delegation = new Delegation();
   orcidBio.setDelegation(delegation);
   GivenPermissionTo givenPermissionTo = new GivenPermissionTo();
   delegation.setGivenPermissionTo(givenPermissionTo);
   DelegationDetails delegationDetails = new DelegationDetails();
   givenPermissionTo.getDelegationDetails().add(delegationDetails);
   DelegateSummary delegateSummary = new DelegateSummary(new OrcidIdentifier(delegateOrcid));
   delegationDetails.setDelegateSummary(delegateSummary);
   return orcidProfile;
 }