use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class PersonValidatorTest method validateExternalIdentifier_invalidTypeTest.
@Test(expected = OrcidValidationException.class)
public void validateExternalIdentifier_invalidTypeTest() {
PersonExternalIdentifier extId = getPersonExternalIdentifier();
extId.setType(null);
PersonValidator.validateExternalIdentifier(extId, getSourceEntity(), true, true, Visibility.PUBLIC, true);
fail();
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class OrcidInfo method groupExternalIdentifiers.
private LinkedHashMap<String, List<PersonExternalIdentifier>> groupExternalIdentifiers(PersonExternalIdentifiers personExternalIdentifiers) {
if (personExternalIdentifiers == null || personExternalIdentifiers.getExternalIdentifiers() == null) {
return null;
}
LinkedHashMap<String, List<PersonExternalIdentifier>> groups = new LinkedHashMap<String, List<PersonExternalIdentifier>>();
for (PersonExternalIdentifier ei : personExternalIdentifiers.getExternalIdentifiers()) {
String pairKey = ei.getType() + ":" + ei.getValue();
if (groups.containsKey(pairKey)) {
groups.get(pairKey).add(ei);
} else {
List<PersonExternalIdentifier> list = new ArrayList<PersonExternalIdentifier>();
list.add(ei);
groups.put(pairKey, list);
}
}
return groups;
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getExternalIdentifierMapperFacade.
public MapperFacade getExternalIdentifierMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<PersonExternalIdentifier, ExternalIdentifierEntity> externalIdentifierClassMap = mapperFactory.classMap(PersonExternalIdentifier.class, ExternalIdentifierEntity.class);
addV3DateFields(externalIdentifierClassMap);
externalIdentifierClassMap.field("putCode", "id");
externalIdentifierClassMap.field("type", "externalIdCommonName");
externalIdentifierClassMap.field("value", "externalIdReference");
externalIdentifierClassMap.field("url.value", "externalIdUrl");
externalIdentifierClassMap.fieldBToA("displayIndex", "displayIndex");
externalIdentifierClassMap.byDefault();
registerSourceConverters(mapperFactory, externalIdentifierClassMap);
// TODO: add relationship to database schema for people.
externalIdentifierClassMap.register();
return mapperFactory.getMapperFacade();
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class JpaJaxbExternalIdentifierAdapterImpl method toExternalIdentifier.
@Override
public PersonExternalIdentifier toExternalIdentifier(ExternalIdentifierEntity entity) {
if (entity == null) {
return null;
}
PersonExternalIdentifier result = mapperFacade.map(entity, PersonExternalIdentifier.class);
result.setRelationship(Relationship.SELF);
return result;
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class OrcidSecurityManager_FullRecordTest method testRecord_When_AllPrivate_NoSource_ReadLimitedToken.
@Test
public void testRecord_When_AllPrivate_NoSource_ReadLimitedToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_LIMITED);
Name name = createName(Visibility.PRIVATE);
Biography bio = createBiography(Visibility.PRIVATE);
Address a1 = createAddress(Visibility.PRIVATE, CLIENT_2);
Address a2 = createAddress(Visibility.PRIVATE, CLIENT_2);
Address a3 = createAddress(Visibility.PRIVATE, CLIENT_2);
Addresses addresses = new Addresses();
addresses.setAddress(new ArrayList<Address>(Arrays.asList(a1, a2, a3)));
Email e1 = createEmail(Visibility.PRIVATE, CLIENT_2);
Email e2 = createEmail(Visibility.PRIVATE, CLIENT_2);
Email e3 = createEmail(Visibility.PRIVATE, CLIENT_2);
Emails emails = new Emails();
emails.setEmails(new ArrayList<Email>(Arrays.asList(e1, e2, e3)));
Keyword k1 = createKeyword(Visibility.PRIVATE, CLIENT_2);
Keyword k2 = createKeyword(Visibility.PRIVATE, CLIENT_2);
Keyword k3 = createKeyword(Visibility.PRIVATE, CLIENT_2);
Keywords keywords = new Keywords();
keywords.setKeywords(new ArrayList<Keyword>(Arrays.asList(k1, k2, k3)));
OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherNames otherNames = new OtherNames();
otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
PersonExternalIdentifier ext1 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
PersonExternalIdentifier ext2 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
PersonExternalIdentifier ext3 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
PersonExternalIdentifiers extIds = new PersonExternalIdentifiers();
extIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(Arrays.asList(ext1, ext2, ext3)));
ResearcherUrl r1 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
ResearcherUrl r2 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
ResearcherUrl r3 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
ResearcherUrls researcherUrls = new ResearcherUrls();
researcherUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(Arrays.asList(r1, r2, r3)));
EducationSummary edu1 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
EducationSummary edu2 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
EducationSummary edu3 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
EmploymentSummary em1 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
EmploymentSummary em2 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
EmploymentSummary em3 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
FundingSummary f1 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_1);
FundingSummary f2 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
FundingSummary f3 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
PeerReviewSummary p1 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_1);
PeerReviewSummary p2 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
PeerReviewSummary p3 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
WorkSummary w1 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_1);
WorkSummary w2 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
WorkSummary w3 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
DistinctionSummary d1 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
DistinctionSummary d2 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
DistinctionSummary d3 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
InvitedPositionSummary i1 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
InvitedPositionSummary i2 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
InvitedPositionSummary i3 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
MembershipSummary m1 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
MembershipSummary m2 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
MembershipSummary m3 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
QualificationSummary q1 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
QualificationSummary q2 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
QualificationSummary q3 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
ServiceSummary s1 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
ServiceSummary s2 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
ServiceSummary s3 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
ActivitiesSummary as = new ActivitiesSummary();
as.setEducations(createEducations(edu1, edu2, edu3));
as.setEmployments(createEmployments(em1, em2, em3));
as.setFundings(createFundings(f1, f2, f3));
as.setPeerReviews(createPeerReviews(p1, p2, p3));
as.setWorks(createWorks(w1, w2, w3));
as.setDistinctions(createDistinctions(d1, d2, d3));
as.setInvitedPositions(createInvitedPositions(i1, i2, i3));
as.setMemberships(createMemberships(m1, m2, m3));
as.setQualifications(createQualifications(q1, q2, q3));
as.setServices(createServices(s1, s2, s3));
Person p = new Person();
p.setBiography(bio);
p.setName(name);
p.setAddresses(addresses);
p.setEmails(emails);
p.setExternalIdentifiers(extIds);
p.setKeywords(keywords);
p.setOtherNames(otherNames);
p.setResearcherUrls(researcherUrls);
Record record = new Record();
record.setActivitiesSummary(as);
record.setPerson(p);
orcidSecurityManager.checkAndFilter(ORCID_1, record);
assertNotNull(record);
// Check person
assertNull(p.getName());
assertNull(p.getBiography());
// Check addresses
assertEquals(0, p.getAddresses().getAddress().size());
// Check emails
assertEquals(0, p.getEmails().getEmails().size());
// Check ext ids
assertEquals(0, p.getExternalIdentifiers().getExternalIdentifiers().size());
// Check keywords
assertEquals(0, p.getKeywords().getKeywords().size());
// Check other names
assertEquals(0, p.getOtherNames().getOtherNames().size());
// Check researcher urls
assertEquals(0, p.getResearcherUrls().getResearcherUrls().size());
// Check activities
assertNotNull(as);
// Check distinctions
assertEquals(0, as.getDistinctions().getSummaries().size());
// Check invited positions
assertEquals(0, as.getInvitedPositions().getSummaries().size());
// Check memberships
assertEquals(0, as.getMemberships().getSummaries().size());
// Check qualifications
assertEquals(0, as.getQualifications().getSummaries().size());
// Check services
assertEquals(0, as.getServices().getSummaries().size());
// Check educations
assertEquals(0, as.getEducations().getSummaries().size());
// Check employments
assertEquals(0, as.getEmployments().getSummaries().size());
// Check fundings
assertEquals(0, as.getFundings().getFundingGroup().size());
// Check peer reviews
assertEquals(0, as.getPeerReviews().getPeerReviewGroup().size());
// Check works
assertEquals(0, as.getWorks().getWorkGroup().size());
}
Aggregations