Search in sources :

Example 46 with ResearcherUrls

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

the class Api2_0_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(ResearcherUrls researcherUrls) {
    if (researcherUrls != null && researcherUrls.getResearcherUrls() != null && !researcherUrls.getResearcherUrls().isEmpty()) {
        LastModifiedDate latest = null;
        for (ResearcherUrl researcherUrl : researcherUrls.getResearcherUrls()) {
            if (researcherUrl.getLastModifiedDate() != null && researcherUrl.getLastModifiedDate().after(latest)) {
                latest = researcherUrl.getLastModifiedDate();
            }
        }
        researcherUrls.setLastModifiedDate(latest);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl)

Example 47 with ResearcherUrls

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

the class JpaJaxbResearcherUrlAdapterTest method getResearcherUrls.

private ResearcherUrls getResearcherUrls() throws JAXBException {
    JAXBContext context = JAXBContext.newInstance(new Class[] { ResearcherUrls.class });
    Unmarshaller unmarshaller = context.createUnmarshaller();
    String name = "/record_2.0/samples/read_samples/researcher-urls-2.0.xml";
    InputStream inputStream = getClass().getResourceAsStream(name);
    return (ResearcherUrls) unmarshaller.unmarshal(inputStream);
}
Also used : InputStream(java.io.InputStream) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller)

Example 48 with ResearcherUrls

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

the class ResearcherUrlManagerTest method getPublicTest.

@Test
public void getPublicTest() {
    String orcid = "0000-0000-0000-0003";
    ResearcherUrls elements = researcherUrlManager.getPublicResearcherUrls(orcid, System.currentTimeMillis());
    assertNotNull(elements);
    assertNotNull(elements.getResearcherUrls());
    assertEquals(1, elements.getResearcherUrls().size());
    assertEquals(Long.valueOf(13), elements.getResearcherUrls().get(0).getPutCode());
}
Also used : ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 49 with ResearcherUrls

use of org.orcid.jaxb.model.record_v2.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 50 with ResearcherUrls

use of org.orcid.jaxb.model.record_v2.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)

Aggregations

ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)56 Test (org.junit.Test)52 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)48 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)37 Addresses (org.orcid.jaxb.model.record_v2.Addresses)35 Biography (org.orcid.jaxb.model.record_v2.Biography)35 Keywords (org.orcid.jaxb.model.record_v2.Keywords)35 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)35 Address (org.orcid.jaxb.model.record_v2.Address)34 Email (org.orcid.jaxb.model.record_v2.Email)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 Keyword (org.orcid.jaxb.model.record_v2.Keyword)33 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)33 OtherName (org.orcid.jaxb.model.record_v2.OtherName)32 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