Search in sources :

Example 46 with ResearcherUrls

use of org.orcid.jaxb.model.record_rc2.ResearcherUrls in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method viewResearcherUrls.

/**
     * BIOGRAPHY ELEMENTS
     */
@Override
public Response viewResearcherUrls(String orcid) {
    ResearcherUrls researcherUrls = researcherUrlManagerReadOnly.getResearcherUrls(orcid, getLastModifiedTime(orcid));
    // Lets copy the list so we don't modify the cached collection
    if (researcherUrls.getResearcherUrls() != null) {
        List<ResearcherUrl> filteredList = new ArrayList<ResearcherUrl>(researcherUrls.getResearcherUrls());
        researcherUrls = new ResearcherUrls();
        researcherUrls.setResearcherUrls(filteredList);
    }
    orcidSecurityManager.checkAndFilter(orcid, researcherUrls.getResearcherUrls(), ScopePathType.ORCID_BIO_READ_LIMITED);
    ElementUtils.setPathToResearcherUrls(researcherUrls, orcid);
    Api2_0_LastModifiedDatesHelper.calculateLastModified(researcherUrls);
    sourceUtils.setSourceName(researcherUrls);
    return Response.ok(researcherUrls).build();
}
Also used : ArrayList(java.util.ArrayList) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl)

Example 47 with ResearcherUrls

use of org.orcid.jaxb.model.record_rc2.ResearcherUrls in project ORCID-Source by ORCID.

the class WebsitesForm method toResearcherUrls.

public ResearcherUrls toResearcherUrls() {
    ResearcherUrls researcherUrls = new ResearcherUrls();
    List<ResearcherUrl> ruList = new ArrayList<ResearcherUrl>();
    for (WebsiteForm website : websites) {
        ruList.add(website.toResearcherUrl());
    }
    researcherUrls.setResearcherUrls(ruList);
    return researcherUrls;
}
Also used : ArrayList(java.util.ArrayList) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl)

Example 48 with ResearcherUrls

use of org.orcid.jaxb.model.record_rc2.ResearcherUrls in project ORCID-Source by ORCID.

the class ValidateV2RC2SamplesTest method testUnmarshallResearcherUrl.

@Test
public void testUnmarshallResearcherUrl() throws SAXException, URISyntaxException {
    ResearcherUrls rUrls = (ResearcherUrls) unmarshallFromPath("/record_2.0_rc2/samples/researcher-urls-2.0_rc2.xml", ResearcherUrls.class, "/record_2.0_rc2/researcher-url-2.0_rc2.xsd");
    assertNotNull(rUrls);
    assertNotNull(rUrls.getResearcherUrls());
    assertEquals(1, rUrls.getResearcherUrls().size());
    assertNotNull(rUrls.getResearcherUrls().get(0).getCreatedDate());
    assertNotNull(rUrls.getResearcherUrls().get(0).getLastModifiedDate());
    assertEquals("Site # 1", rUrls.getResearcherUrls().get(0).getUrlName());
    assertEquals("http://site1.com/", rUrls.getResearcherUrls().get(0).getUrl().getValue());
    assertEquals(Long.valueOf(1248), rUrls.getResearcherUrls().get(0).getPutCode());
    assertEquals(Visibility.PUBLIC.value(), rUrls.getResearcherUrls().get(0).getVisibility().value());
    assertNotNull(rUrls.getResearcherUrls().get(0).getSource());
    assertEquals("http://www.orcid.org/8888-8888-8888-8880", rUrls.getResearcherUrls().get(0).getSource().retriveSourceUri());
    assertEquals("8888-8888-8888-8880", rUrls.getResearcherUrls().get(0).getSource().retrieveSourcePath());
    ResearcherUrl rUrl = (ResearcherUrl) unmarshallFromPath("/record_2.0_rc2/samples/researcher-url-2.0_rc2.xml", ResearcherUrl.class);
    assertNotNull(rUrl);
    assertEquals("Site # 1", rUrl.getUrlName());
    assertNotNull(rUrl.getUrl());
    assertEquals("http://site1.com/", rUrl.getUrl().getValue());
    assertNotNull(rUrl.getCreatedDate());
    assertNotNull(rUrl.getLastModifiedDate());
    assertNotNull(rUrl.getSource());
    assertEquals("8888-8888-8888-8880", rUrl.getSource().retrieveSourcePath());
}
Also used : ResearcherUrls(org.orcid.jaxb.model.record_rc2.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.record_rc2.ResearcherUrl) Test(org.junit.Test)

Example 49 with ResearcherUrls

use of org.orcid.jaxb.model.record_rc2.ResearcherUrls in project ORCID-Source by ORCID.

the class ValidateV2RC2SamplesTest method testMarshallResearcherUrl.

@Test
public void testMarshallResearcherUrl() throws JAXBException, SAXException, URISyntaxException {
    ResearcherUrls object = (ResearcherUrls) unmarshallFromPath("/record_2.0_rc2/samples/researcher-urls-2.0_rc2.xml", ResearcherUrls.class);
    marshall(object, "/record_2.0_rc2/researcher-url-2.0_rc2.xsd");
}
Also used : ResearcherUrls(org.orcid.jaxb.model.record_rc2.ResearcherUrls) Test(org.junit.Test)

Example 50 with ResearcherUrls

use of org.orcid.jaxb.model.record_rc2.ResearcherUrls in project ORCID-Source by ORCID.

the class PersonDetailsManagerReadOnlyImpl method getPublicPersonDetails.

@Override
public Person getPublicPersonDetails(String orcid) {
    long lastModifiedTime = getLastModified(orcid);
    Person person = new Person();
    Name name = recordNameManager.getRecordName(orcid, lastModifiedTime);
    if (Visibility.PUBLIC.equals(name.getVisibility())) {
        person.setName(name);
    }
    Biography bio = biographyManager.getPublicBiography(orcid, lastModifiedTime);
    if (bio != null) {
        person.setBiography(bio);
    }
    Addresses addresses = addressManager.getPublicAddresses(orcid, lastModifiedTime);
    if (addresses.getAddress() != null) {
        Addresses filteredAddresses = new Addresses();
        filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
        person.setAddresses(filteredAddresses);
    }
    PersonExternalIdentifiers extIds = externalIdentifierManager.getPublicExternalIdentifiers(orcid, lastModifiedTime);
    if (extIds.getExternalIdentifiers() != null) {
        PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
        filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
        person.setExternalIdentifiers(filteredExtIds);
    }
    Keywords keywords = profileKeywordManager.getPublicKeywords(orcid, lastModifiedTime);
    if (keywords.getKeywords() != null) {
        Keywords filteredKeywords = new Keywords();
        filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
        person.setKeywords(filteredKeywords);
    }
    OtherNames otherNames = otherNameManager.getPublicOtherNames(orcid, lastModifiedTime);
    if (otherNames.getOtherNames() != null) {
        OtherNames filteredOtherNames = new OtherNames();
        filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
        person.setOtherNames(filteredOtherNames);
    }
    ResearcherUrls rUrls = researcherUrlManager.getPublicResearcherUrls(orcid, lastModifiedTime);
    if (rUrls.getResearcherUrls() != null) {
        ResearcherUrls filteredRUrls = new ResearcherUrls();
        filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
        person.setResearcherUrls(filteredRUrls);
    }
    Emails emails = emailManager.getPublicEmails(orcid, lastModifiedTime);
    if (emails.getEmails() != null) {
        Emails filteredEmails = new Emails();
        filteredEmails.setEmails(new ArrayList<Email>(emails.getEmails()));
        person.setEmails(filteredEmails);
    }
    return person;
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Email(org.orcid.jaxb.model.record_v2.Email) Address(org.orcid.jaxb.model.record_v2.Address) Keyword(org.orcid.jaxb.model.record_v2.Keyword) OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Addresses(org.orcid.jaxb.model.record_v2.Addresses) PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) Biography(org.orcid.jaxb.model.record_v2.Biography) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Emails(org.orcid.jaxb.model.record_v2.Emails) Person(org.orcid.jaxb.model.record_v2.Person)

Aggregations

ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)56 Test (org.junit.Test)52 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)43 Addresses (org.orcid.jaxb.model.record_v2.Addresses)35 Keywords (org.orcid.jaxb.model.record_v2.Keywords)35 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)35 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)35 Biography (org.orcid.jaxb.model.record_v2.Biography)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 Address (org.orcid.jaxb.model.record_v2.Address)32 OtherName (org.orcid.jaxb.model.record_v2.OtherName)32 Email (org.orcid.jaxb.model.record_v2.Email)31 Keyword (org.orcid.jaxb.model.record_v2.Keyword)31 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)31 Name (org.orcid.jaxb.model.record_v2.Name)28 Person (org.orcid.jaxb.model.record_v2.Person)25 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)15 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)15 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)15 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)15