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);
}
}
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);
}
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());
}
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();
}
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;
}
Aggregations