use of org.geotoolkit.sml.xml.v101.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.geotoolkit.sml.xml.v101.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.geotoolkit.sml.xml.v101.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.geotoolkit.sml.xml.v101.Keywords in project ORCID-Source by ORCID.
the class ValidateV2_1SamplesTest method testUnmarshallKeyword.
@Test
public void testUnmarshallKeyword() throws SAXException, URISyntaxException {
Keywords keywords = (Keywords) unmarshallFromPath("/record_2.1/samples/read_samples/keywords-2.1.xml", Keywords.class, "/record_2.1/keyword-2.1.xsd");
assertNotNull(keywords);
assertNotNull(keywords.getKeywords());
assertEquals(2, keywords.getKeywords().size());
for (Keyword keyword : keywords.getKeywords()) {
assertThat(keyword.getContent(), anyOf(is("keyword1"), is("keyword2")));
assertThat(keyword.getPutCode(), anyOf(is(Long.valueOf(1)), is(Long.valueOf(2))));
assertEquals(Visibility.PUBLIC.value(), keyword.getVisibility().value());
assertNotNull(keyword.getCreatedDate());
assertNotNull(keyword.getLastModifiedDate());
assertNotNull(keyword.getSource());
validateSourceInHttps(keyword.getSource());
assertEquals("8888-8888-8888-8880", keyword.getSource().retrieveSourcePath());
}
Keyword keyword = (Keyword) unmarshallFromPath("/record_2.1/samples/read_samples/keyword-2.1.xml", Keyword.class);
assertNotNull(keyword);
assertEquals("keyword1", keyword.getContent());
assertEquals(Long.valueOf(1), keyword.getPutCode());
assertEquals(Visibility.PUBLIC.value(), keyword.getVisibility().value());
assertNotNull(keyword.getCreatedDate());
assertNotNull(keyword.getLastModifiedDate());
assertNotNull(keyword.getSource());
validateSourceInHttps(keyword.getSource());
assertEquals("8888-8888-8888-8880", keyword.getSource().retrieveSourcePath());
}
use of org.geotoolkit.sml.xml.v101.Keywords in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testViewKeywords.
@Test
public void testViewKeywords() {
Response response = serviceDelegator.viewKeywords(ORCID);
assertNotNull(response);
Keywords keywords = (Keywords) response.getEntity();
assertNotNull(keywords);
assertNotNull(keywords.getLastModifiedDate());
assertNotNull(keywords.getLastModifiedDate().getValue());
assertEquals("/0000-0000-0000-0003/keywords", keywords.getPath());
assertEquals(1, keywords.getKeywords().size());
Keyword keyword = keywords.getKeywords().get(0);
assertNotNull(keyword);
assertNotNull(keyword.getLastModifiedDate());
assertNotNull(keyword.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(9), keyword.getPutCode());
assertEquals("PUBLIC", keyword.getContent());
assertEquals(Visibility.PUBLIC.value(), keyword.getVisibility().value());
assertEquals("/0000-0000-0000-0003/keywords/9", keyword.getPath());
assertEquals("APP-5555555555555555", keyword.getSource().retrieveSourcePath());
}
Aggregations