use of org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method getPersonExternalIdentifiersElement.
private PersonExternalIdentifiers getPersonExternalIdentifiersElement(Visibility... vs) {
PersonExternalIdentifiers elements = new PersonExternalIdentifiers();
for (Visibility v : vs) {
PersonExternalIdentifier element = new PersonExternalIdentifier();
element.setVisibility(v);
if (elements.getExternalIdentifiers() == null) {
elements.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>());
}
elements.getExternalIdentifiers().add(element);
}
return elements;
}
use of org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_ExternalIdentifiersTest method testViewExternalIdentifiers.
@Test
public void testViewExternalIdentifiers() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4442", ScopePathType.PERSON_READ_LIMITED);
Response response = serviceDelegator.viewExternalIdentifiers("4444-4444-4444-4442");
assertNotNull(response);
PersonExternalIdentifiers extIds = (PersonExternalIdentifiers) response.getEntity();
assertNotNull(extIds);
assertEquals("/4444-4444-4444-4442/external-identifiers", extIds.getPath());
Utils.verifyLastModified(extIds.getLastModifiedDate());
List<PersonExternalIdentifier> extIdsList = extIds.getExternalIdentifiers();
assertNotNull(extIdsList);
assertEquals(3, extIdsList.size());
for (PersonExternalIdentifier extId : extIdsList) {
Utils.verifyLastModified(extId.getLastModifiedDate());
assertThat(extId.getPutCode(), anyOf(is(2L), is(3L), is(5L)));
assertThat(extId.getValue(), anyOf(is("abc123"), is("abc456"), is("abc012")));
assertNotNull(extId.getUrl());
assertThat(extId.getUrl().getValue(), anyOf(is("http://www.facebook.com/abc123"), is("http://www.facebook.com/abc456"), is("http://www.facebook.com/abc012")));
assertEquals("Facebook", extId.getType());
assertNotNull(extId.getSource());
if (extId.getPutCode().equals(2L)) {
assertEquals(Visibility.PUBLIC, extId.getVisibility());
assertEquals("APP-5555555555555555", extId.getSource().retrieveSourcePath());
} else if (extId.getPutCode().equals(3L)) {
assertEquals(Visibility.LIMITED, extId.getVisibility());
assertEquals("4444-4444-4444-4442", extId.getSource().retrieveSourcePath());
} else {
assertEquals(Visibility.PRIVATE, extId.getVisibility());
assertEquals("APP-5555555555555555", extId.getSource().retrieveSourcePath());
}
}
}
use of org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_ExternalIdentifiersTest method testViewExternalIdentifiersReadPublic.
@Test
public void testViewExternalIdentifiersReadPublic() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewExternalIdentifiers(ORCID);
PersonExternalIdentifiers element = (PersonExternalIdentifiers) r.getEntity();
assertNotNull(element);
assertEquals("/0000-0000-0000-0003/external-identifiers", element.getPath());
Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
use of org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers 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_rc3.PersonExternalIdentifiers in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method getPublicTest.
@Test
public void getPublicTest() {
String orcid = "0000-0000-0000-0003";
PersonExternalIdentifiers elements = externalIdentifierManager.getPublicExternalIdentifiers(orcid, System.currentTimeMillis());
assertNotNull(elements);
assertNotNull(elements.getExternalIdentifiers());
assertEquals(1, elements.getExternalIdentifiers().size());
assertEquals(Long.valueOf(13), elements.getExternalIdentifiers().get(0).getPutCode());
}
Aggregations