use of org.orcid.jaxb.model.record_rc2.Keywords in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_KeywordsTest method testViewKeywordsReadPublic.
@Test
public void testViewKeywordsReadPublic() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewKeywords(ORCID);
Keywords element = (Keywords) r.getEntity();
assertNotNull(element);
assertEquals("/0000-0000-0000-0003/keywords", element.getPath());
Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
use of org.orcid.jaxb.model.record_rc2.Keywords in project ORCID-Source by ORCID.
the class JpaJaxbKeywordAdapterImpl method toKeywords.
@Override
public Keywords toKeywords(Collection<ProfileKeywordEntity> entities) {
if (entities == null) {
return null;
}
List<Keyword> keywordList = mapperFacade.mapAsList(entities, Keyword.class);
Keywords keywords = new Keywords();
keywords.setKeywords(keywordList);
return keywords;
}
use of org.orcid.jaxb.model.record_rc2.Keywords in project ORCID-Source by ORCID.
the class SourceUtils method setSourceName.
public void setSourceName(Person person) {
if (person == null) {
return;
}
if (person.getAddresses() != null) {
Addresses addresses = person.getAddresses();
setSourceName(addresses);
}
if (person.getEmails() != null) {
Emails emails = person.getEmails();
setSourceName(emails);
}
if (person.getExternalIdentifiers() != null) {
PersonExternalIdentifiers extIds = person.getExternalIdentifiers();
setSourceName(extIds);
}
if (person.getKeywords() != null) {
Keywords keywords = person.getKeywords();
setSourceName(keywords);
}
if (person.getOtherNames() != null) {
OtherNames otherNames = person.getOtherNames();
setSourceName(otherNames);
}
if (person.getResearcherUrls() != null) {
ResearcherUrls researcherUrls = person.getResearcherUrls();
setSourceName(researcherUrls);
}
}
use of org.orcid.jaxb.model.record_rc2.Keywords in project ORCID-Source by ORCID.
the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.
public static Date calculateLatest(Keywords keywords) {
Date latestAct = null;
if (keywords != null && keywords.getKeywords() != null && !keywords.getKeywords().isEmpty()) {
XMLGregorianCalendar latest = keywords.getKeywords().get(0).getLastModifiedDate().getValue();
for (Keyword keyword : keywords.getKeywords()) {
if (latest.compare(keyword.getLastModifiedDate().getValue()) == -1) {
latest = keyword.getLastModifiedDate().getValue();
}
}
latestAct = latest.toGregorianCalendar().getTime();
keywords.setLastModifiedDate(new LastModifiedDate(latest));
}
return latestAct;
}
use of org.orcid.jaxb.model.record_rc2.Keywords in project ORCID-Source by ORCID.
the class ProfileKeywordManagerTest method getAllTest.
@Test
public void getAllTest() {
String orcid = "0000-0000-0000-0003";
Keywords elements = profileKeywordManager.getKeywords(orcid, System.currentTimeMillis());
assertNotNull(elements);
assertNotNull(elements.getKeywords());
assertEquals(5, elements.getKeywords().size());
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
for (Keyword element : elements.getKeywords()) {
if (9 == element.getPutCode()) {
found1 = true;
} else if (10 == element.getPutCode()) {
found2 = true;
} else if (11 == element.getPutCode()) {
found3 = true;
} else if (12 == element.getPutCode()) {
found4 = true;
} else if (13 == element.getPutCode()) {
found5 = true;
} else {
fail("Invalid put code found: " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
assertTrue(found5);
}
Aggregations