use of org.orcid.persistence.jpa.entities.ProfileFundingEntity in project ORCID-Source by ORCID.
the class JpaJaxbFundingAdapterTest method getProfileFundingEntity.
private ProfileFundingEntity getProfileFundingEntity() {
ProfileFundingEntity result = new ProfileFundingEntity();
result.setContributorsJson("{\"contributor\":[{\"contributorOrcid\":{\"value\":null,\"valueAsString\":null,\"uri\":\"http://orcid.org/8888-8888-8888-8880\",\"path\":\"8888-8888-8888-8880\",\"host\":\"orcid.org\"},\"creditName\":{\"content\":\"funding:creditName\"},\"contributorEmail\":{\"value\":\"funding@contributorEmail.com\"},\"contributorAttributes\":{\"contributorRole\":\"LEAD\"}}]}");
result.setDescription("funding:description");
result.setEndDate(new EndDateEntity(2020, 1, 1));
result.setStartDate(new StartDateEntity(2000, 1, 1));
result.setExternalIdentifiersJson("{\"fundingExternalIdentifier\":[{\"type\":\"GRANT_NUMBER\",\"value\":\"12345\",\"url\":{\"value\":\"http://tempuri.org\"}},{\"type\":\"GRANT_NUMBER\",\"value\":\"67890\",\"url\":{\"value\":\"http://tempuri.org/2\"}}]}");
result.setId(12345L);
result.setNumericAmount(new BigDecimal(123456));
result.setCurrencyCode("CRC");
result.setTitle("funding:title");
result.setTranslatedTitle("funding:translatedTitle");
result.setTranslatedTitleLanguageCode("ES");
result.setType(FundingType.SALARY_AWARD);
result.setVisibility(Visibility.PRIVATE);
return result;
}
use of org.orcid.persistence.jpa.entities.ProfileFundingEntity in project ORCID-Source by ORCID.
the class JpaJaxbEntityAdapterToProfileEntityTest method testToProfileEntity.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Rollback(true)
public void testToProfileEntity() throws JAXBException {
OrcidMessage orcidMessage = getOrcidMessage(ORCID_PROTECTED_FULL_XML);
ProfileEntity profileEntity = adapter.toProfileEntity(orcidMessage.getOrcidProfile());
assertNotNull(profileEntity);
profileDao.persist(profileEntity);
ProfileEntity retrievedProfileEntity = profileDao.find(orcidMessage.getOrcidProfile().getOrcidIdentifier().getPath());
assertNotNull(retrievedProfileEntity);
assertEquals("Josiah", retrievedProfileEntity.getRecordNameEntity().getGivenNames());
// Check all email visibility and values
Set<EmailEntity> emails = profileEntity.getEmails();
assertNotNull(emails);
assertEquals(2, emails.size());
Map<String, EmailEntity> emailMap = EmailEntity.mapById(emails);
EmailEntity primaryEmail = emailMap.get("josiah_carberry@brown.edu");
assertNotNull(primaryEmail);
assertEquals(org.orcid.jaxb.model.common_v2.Visibility.LIMITED, primaryEmail.getVisibility());
assertTrue(primaryEmail.getPrimary());
assertTrue(primaryEmail.getCurrent());
assertTrue(primaryEmail.getVerified());
assertEquals("4444-4444-4444-4446", primaryEmail.getElementSourceId());
EmailEntity nonPrimaryEmail1 = emailMap.get("josiah_carberry_1@brown.edu");
assertNotNull(nonPrimaryEmail1);
assertEquals(org.orcid.jaxb.model.common_v2.Visibility.LIMITED, nonPrimaryEmail1.getVisibility());
assertFalse(nonPrimaryEmail1.getPrimary());
assertTrue(nonPrimaryEmail1.getCurrent());
assertFalse(nonPrimaryEmail1.getVerified());
assertEquals("4444-4444-4444-4446", nonPrimaryEmail1.getElementSourceId());
Set<WorkEntity> workEntities = profileEntity.getWorks();
assertEquals(3, workEntities.size());
for (WorkEntity workEntity : workEntities) {
String contributorsJson = workEntity.getContributorsJson();
if ("Work title 1".equals(workEntity.getTitle())) {
assertEquals("Journal Title # 1", workEntity.getJournalTitle());
assertNotNull(contributorsJson);
assertTrue(contributorsJson.startsWith("{\"contributor\":[{\""));
Map<String, Object> mappedJson = JsonUtils.<HashMap>readObjectFromJsonString(contributorsJson, HashMap.class);
List<Map<String, Object>> contributorsList = (List<Map<String, Object>>) mappedJson.get("contributor");
Map<String, Object> contributor0 = contributorsList.get(0);
assertEquals(4, contributor0.keySet().size());
Map<String, Object> contributorOrcid0 = (Map<String, Object>) contributor0.get("contributorOrcid");
assertEquals("http://orcid.org/4444-4444-4444-4446", contributorOrcid0.get("uri"));
assertEquals("4444-4444-4444-4446", contributorOrcid0.get("path"));
assertEquals("orcid.org", contributorOrcid0.get("host"));
assertTrue(contributorOrcid0.containsKey("value"));
assertNull(contributorOrcid0.get("value"));
assertTrue(contributorOrcid0.containsKey("valueAsString"));
assertNull(contributorOrcid0.get("valueAsString"));
assertTrue(contributor0.containsKey("creditName"));
assertNull(contributor0.get("creditName"));
assertTrue(contributor0.containsKey("contributorEmail"));
assertNull(contributor0.get("contributorEmail"));
Map<String, Object> contributorAttributes0 = (Map<String, Object>) contributor0.get("contributorAttributes");
assertNotNull(contributorAttributes0);
assertEquals("FIRST", contributorAttributes0.get("contributorSequence"));
assertEquals("AUTHOR", contributorAttributes0.get("contributorRole"));
Map<String, Object> contributor1 = contributorsList.get(1);
assertEquals(4, contributor1.keySet().size());
assertTrue(contributor1.containsKey("contributorOrcid"));
assertNull(contributor1.get("contributorOrcid"));
assertEquals("John W. Spaeth", ((Map<String, Object>) contributor1.get("creditName")).get("content"));
assertEquals("PUBLIC", ((Map<String, Object>) contributor1.get("creditName")).get("visibility"));
assertTrue(contributor1.containsKey("contributorEmail"));
assertNull(contributor1.get("contributorEmail"));
assertTrue(contributor1.containsKey("contributorAttributes"));
assertNull(contributor1.get("contributorAttributes"));
} else if (workEntity.getTitle().equals("Work title 2")) {
assertNull(contributorsJson);
assertEquals("Journal Title # 2", workEntity.getJournalTitle());
} else {
assertNull(contributorsJson);
assertNull(workEntity.getJournalTitle());
}
}
assertEquals(2, profileEntity.getProfileFunding().size());
for (ProfileFundingEntity profileGrantEntity : profileEntity.getProfileFunding()) {
assertNotNull(profileGrantEntity.getContributorsJson());
}
assertNull(profileEntity.getGivenPermissionBy());
}
use of org.orcid.persistence.jpa.entities.ProfileFundingEntity in project ORCID-Source by ORCID.
the class JpaJaxbFundingAdapterTest method fromFundingEntityTest.
@Test
public void fromFundingEntityTest() throws JAXBException {
ProfileFundingEntity entity = getProfileFundingEntity();
assertNotNull(entity);
assertEquals("123456", entity.getNumericAmount().toString());
Funding funding = jpaJaxbFundingAdapter.toFunding(entity);
assertNotNull(funding);
assertEquals(Long.valueOf(12345), funding.getPutCode());
assertNotNull(funding.getAmount());
assertEquals("123456", funding.getAmount().getContent());
assertEquals("CRC", funding.getAmount().getCurrencyCode());
assertNotNull(funding.getContributors());
assertNotNull(funding.getContributors().getContributor());
assertEquals(1, funding.getContributors().getContributor().size());
assertEquals("8888-8888-8888-8880", funding.getContributors().getContributor().get(0).getContributorOrcid().getPath());
assertEquals("orcid.org", funding.getContributors().getContributor().get(0).getContributorOrcid().getHost());
assertEquals("http://orcid.org/8888-8888-8888-8880", funding.getContributors().getContributor().get(0).getContributorOrcid().getUri());
assertEquals("funding:creditName", funding.getContributors().getContributor().get(0).getCreditName().getContent());
assertEquals("funding:description", funding.getDescription());
assertNotNull(funding.getStartDate());
assertEquals("01", funding.getStartDate().getDay().getValue());
assertEquals("01", funding.getStartDate().getMonth().getValue());
assertEquals("2000", funding.getStartDate().getYear().getValue());
assertNotNull(funding.getEndDate());
assertEquals("01", funding.getEndDate().getDay().getValue());
assertEquals("01", funding.getEndDate().getMonth().getValue());
assertEquals("2020", funding.getEndDate().getYear().getValue());
assertEquals("funding:title", funding.getTitle().getTitle().getContent());
assertEquals("funding:translatedTitle", funding.getTitle().getTranslatedTitle().getContent());
assertEquals("ES", funding.getTitle().getTranslatedTitle().getLanguageCode());
assertEquals(FundingType.SALARY_AWARD, funding.getType());
assertEquals(Visibility.PRIVATE, funding.getVisibility());
}
use of org.orcid.persistence.jpa.entities.ProfileFundingEntity in project ORCID-Source by ORCID.
the class SetUpClientsAndUsers method clearRegistry.
private boolean clearRegistry(OrcidProfile existingProfile, Map<String, String> params) {
if (existingProfile != null) {
String orcid = params.get(ORCID);
String email = params.get(EMAIL);
// exception
if (existingProfile.getOrcidBio() == null || existingProfile.getOrcidBio().getContactDetails() == null || existingProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail() == null || !email.equals(existingProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue())) {
throw new ApplicationException("User with email " + params.get(EMAIL) + " must have orcid id '" + orcid + "' but it is '" + existingProfile.getOrcidId() + "'");
}
// Check if the profile have the same password, if not, update the
// password
String encryptedPassword = encryptionManager.hashForInternalUse(params.get(PASSWORD));
if (!encryptedPassword.equals(existingProfile.getPassword())) {
existingProfile.setPassword(params.get(PASSWORD));
orcidProfileManager.updatePasswordInformation(existingProfile);
}
// Set default names
Name name = new Name();
name.setCreditName(new CreditName(params.get(CREDIT_NAME)));
name.setGivenNames(new GivenNames(params.get(GIVEN_NAMES)));
name.setFamilyName(new FamilyName(params.get(FAMILY_NAMES)));
name.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility().value()));
if (recordNameManager.exists(orcid)) {
recordNameManager.updateRecordName(orcid, name);
} else {
recordNameManager.createRecordName(orcid, name);
}
profileDao.updatePreferences(orcid, true, true, true, true, org.orcid.jaxb.model.common_v2.Visibility.PUBLIC, true, 1f);
// Set default bio
org.orcid.jaxb.model.record_v2.Biography bio = biographyManager.getBiography(orcid, 0L);
if (bio == null || bio.getContent() == null) {
bio = new org.orcid.jaxb.model.record_v2.Biography(params.get(BIO));
bio.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.BIOGRAPHY_DEFAULT.getVisibility().value()));
biographyManager.createBiography(orcid, bio);
} else {
bio.setContent(params.get(BIO));
bio.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.BIOGRAPHY_DEFAULT.getVisibility().value()));
biographyManager.updateBiography(orcid, bio);
}
// Remove other names
List<OtherNameEntity> otherNames = otherNameDao.getOtherNames(orcid, 0L);
if (otherNames != null && !otherNames.isEmpty()) {
for (OtherNameEntity otherName : otherNames) {
otherNameDao.deleteOtherName(otherName);
}
}
// Remove keywords
List<ProfileKeywordEntity> keywords = profileKeywordDao.getProfileKeywors(orcid, 0L);
if (keywords != null && !keywords.isEmpty()) {
for (ProfileKeywordEntity keyword : keywords) {
profileKeywordDao.deleteProfileKeyword(keyword);
}
}
//Remove researcher urls
List<ResearcherUrlEntity> rUrls = researcherUrlDao.getResearcherUrls(orcid, 0L);
if (rUrls != null && !rUrls.isEmpty()) {
for (ResearcherUrlEntity rUrl : rUrls) {
researcherUrlDao.deleteResearcherUrl(orcid, rUrl.getId());
}
}
// Remove external ids
List<ExternalIdentifierEntity> extIds = externalIdentifierDao.getExternalIdentifiers(orcid, System.currentTimeMillis());
if (extIds != null && !extIds.isEmpty()) {
for (ExternalIdentifierEntity extId : extIds) {
externalIdentifierDao.removeExternalIdentifier(orcid, extId.getId());
}
}
// Remove addresses
List<AddressEntity> addresses = addressDao.getAddresses(orcid, 0L);
if (addresses != null && !addresses.isEmpty()) {
for (AddressEntity address : addresses) {
addressDao.deleteAddress(orcid, address.getId());
}
}
// Remove emails
List<EmailEntity> emails = emailDao.findByOrcid(orcid);
if (emails != null && !emails.isEmpty()) {
for (EmailEntity rc2Email : emails) {
if (!params.get(EMAIL).equals(rc2Email.getId())) {
emailDao.removeEmail(orcid, rc2Email.getId());
}
}
}
// Remove notifications
List<NotificationEntity> notifications = notificationDao.findByOrcid(orcid, true, 0, 10000);
if (notifications != null && !notifications.isEmpty()) {
for (NotificationEntity notification : notifications) {
notificationDao.deleteNotificationItemByNotificationId(notification.getId());
notificationDao.deleteNotificationWorkByNotificationId(notification.getId());
notificationDao.deleteNotificationById(notification.getId());
}
}
// Remove works
List<MinimizedWorkEntity> works = workDao.findWorks(orcid, 0L);
if (works != null && !works.isEmpty()) {
for (MinimizedWorkEntity work : works) {
workDao.removeWork(orcid, work.getId());
}
}
// Remove affiliations
List<OrgAffiliationRelationEntity> affiliations = orgAffiliationRelationDao.getByUser(orcid);
if (affiliations != null && !affiliations.isEmpty()) {
for (OrgAffiliationRelationEntity affiliation : affiliations) {
orgAffiliationRelationDao.remove(affiliation.getId());
}
}
// Remove fundings
List<ProfileFundingEntity> fundings = profileFundingDao.getByUser(orcid);
if (fundings != null && !fundings.isEmpty()) {
for (ProfileFundingEntity funding : fundings) {
profileFundingDao.removeProfileFunding(orcid, funding.getId());
}
}
// Remove peer reviews
List<PeerReviewEntity> peerReviews = peerReviewDao.getByUser(orcid);
if (peerReviews != null && !peerReviews.isEmpty()) {
for (PeerReviewEntity peerReview : peerReviews) {
peerReviewDao.removePeerReview(orcid, peerReview.getId());
}
}
// Remove 3d party links
List<OrcidOauth2TokenDetail> tokenDetails = orcidOauth2TokenDetailDao.findByUserName(orcid);
if (tokenDetails != null && !tokenDetails.isEmpty()) {
for (OrcidOauth2TokenDetail token : tokenDetails) {
orcidOauth2TokenDetailDao.remove(token.getId());
}
}
//Unlock just in case it is locked
profileDao.unlockProfile(orcid);
return true;
}
return false;
}
use of org.orcid.persistence.jpa.entities.ProfileFundingEntity in project ORCID-Source by ORCID.
the class Jpa2JaxbAdapterTest method testProfileEntityToOrcidMessage.
@Test
public void testProfileEntityToOrcidMessage() {
String userOrcid = "0000-0000-0000-1234";
String clientId = "APP-5555555555555555";
ProfileEntity profile = new ProfileEntity(userOrcid);
// Set default visibility
profile.setActivitiesVisibilityDefault(org.orcid.jaxb.model.common_v2.Visibility.LIMITED);
// Set name
RecordNameEntity name = new RecordNameEntity();
name.setCreditName("My credit name");
name.setFamilyName("My family name");
name.setGivenNames("My given names");
name.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
profile.setRecordNameEntity(name);
// Set biography
BiographyEntity bio = new BiographyEntity();
bio.setBiography("This is my biography");
bio.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
profile.setBiographyEntity(bio);
// Set other names
TreeSet<OtherNameEntity> otherNames = new TreeSet<OtherNameEntity>();
OtherNameEntity otherName = new OtherNameEntity();
otherName.setDisplayName("My other name");
otherName.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
otherName.setDisplayIndex(20000L);
otherName.setClientSourceId(clientId);
otherName.setId(24816L);
otherNames.add(otherName);
profile.setOtherNames(otherNames);
// Set address
Set<AddressEntity> addresses = new HashSet<AddressEntity>();
AddressEntity address = new AddressEntity();
address.setIso2Country(Iso3166Country.US);
address.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
address.setDisplayIndex(20000L);
address.setClientSourceId(clientId);
address.setId(24816L);
addresses.add(address);
profile.setAddresses(addresses);
// Set keywords
TreeSet<ProfileKeywordEntity> keywords = new TreeSet<ProfileKeywordEntity>();
ProfileKeywordEntity keyword = new ProfileKeywordEntity();
keyword.setKeywordName("My keyword");
keyword.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
keyword.setDisplayIndex(20000L);
keyword.setClientSourceId(clientId);
keyword.setId(24816L);
keywords.add(keyword);
profile.setKeywords(keywords);
// Set researcher urls
TreeSet<ResearcherUrlEntity> rUrls = new TreeSet<ResearcherUrlEntity>();
ResearcherUrlEntity rUrl = new ResearcherUrlEntity();
rUrl.setUrl("http://orcid.org");
rUrl.setUrlName("My rUrl");
rUrl.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
rUrl.setDisplayIndex(20000L);
rUrl.setClientSourceId(clientId);
rUrl.setId(24816L);
rUrls.add(rUrl);
profile.setResearcherUrls(rUrls);
// Set external identifiers
Set<ExternalIdentifierEntity> extIds = new HashSet<ExternalIdentifierEntity>();
ExternalIdentifierEntity extId = new ExternalIdentifierEntity();
extId.setExternalIdCommonName("My common name");
extId.setExternalIdReference("My refrence");
extId.setExternalIdUrl("http://orcid.org");
extId.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
extId.setDisplayIndex(20000L);
extId.setClientSourceId(clientId);
extId.setId(24816L);
extIds.add(extId);
profile.setExternalIdentifiers(extIds);
// Set works
TreeSet<WorkEntity> works = new TreeSet<WorkEntity>();
WorkEntity work = new WorkEntity();
work.setWorkType(WorkType.OTHER);
work.setTitle("My work title");
work.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
work.setDisplayIndex(20000L);
work.setClientSourceId(clientId);
work.setId(24816L);
works.add(work);
profile.setWorks(works);
when(mockWorkEntityCacheManager.retrieveFullWorks(userOrcid, 0)).thenReturn(new ArrayList<>(works));
// Existing org
OrgEntity newOrg = new OrgEntity();
newOrg.setId(1234L);
newOrg.setCity("San Jose");
newOrg.setCountry(org.orcid.jaxb.model.message.Iso3166Country.CR);
newOrg.setName("My org name");
// Set funding
TreeSet<ProfileFundingEntity> fundings = new TreeSet<ProfileFundingEntity>();
ProfileFundingEntity funding = new ProfileFundingEntity();
funding.setOrg(newOrg);
funding.setTitle("My funding title");
funding.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
funding.setDisplayIndex(20000L);
funding.setClientSourceId(clientId);
funding.setId(24816L);
fundings.add(funding);
profile.setProfileFunding(fundings);
// Set affiliations
TreeSet<OrgAffiliationRelationEntity> affiliations = new TreeSet<OrgAffiliationRelationEntity>();
OrgAffiliationRelationEntity affiliation = new OrgAffiliationRelationEntity();
affiliation.setAffiliationType(org.orcid.jaxb.model.record_v2.AffiliationType.EDUCATION);
affiliation.setOrg(newOrg);
affiliation.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
affiliation.setClientSourceId(clientId);
affiliation.setId(24816L);
affiliations.add(affiliation);
profile.setOrgAffiliationRelations(affiliations);
OrcidProfile orcidProfile = adapter.toOrcidProfile(profile);
// Check profile
assertNotNull(orcidProfile);
assertNotNull(orcidProfile.getOrcidIdentifier());
assertEquals("http://orcid.org/" + userOrcid, orcidProfile.getOrcidIdentifier().getUri());
assertEquals("orcid.org", orcidProfile.getOrcidIdentifier().getHost());
assertEquals(userOrcid, orcidProfile.getOrcidIdentifier().getPath());
// Check activities
assertNotNull(orcidProfile.getOrcidActivities());
// Check works
assertNotNull(orcidProfile.getOrcidActivities().getOrcidWorks());
assertNotNull(orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork());
assertEquals(1, orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork().size());
assertEquals("My work title", orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork().get(0).getWorkTitle().getTitle().getContent());
assertEquals("24816", orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork().get(0).getPutCode());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork().get(0).getVisibility());
checkSource(orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork().get(0).getSource(), clientId);
// Check fundings
assertNotNull(orcidProfile.getOrcidActivities().getFundings());
assertNotNull(orcidProfile.getOrcidActivities().getFundings().getFundings());
assertEquals(1, orcidProfile.getOrcidActivities().getFundings().getFundings().size());
assertEquals("My funding title", orcidProfile.getOrcidActivities().getFundings().getFundings().get(0).getTitle().getTitle().getContent());
assertEquals("24816", orcidProfile.getOrcidActivities().getFundings().getFundings().get(0).getPutCode());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidActivities().getFundings().getFundings().get(0).getVisibility());
checkSource(orcidProfile.getOrcidActivities().getFundings().getFundings().get(0).getSource(), clientId);
// Check affiliations
assertNotNull(orcidProfile.getOrcidActivities().getAffiliations());
assertNotNull(orcidProfile.getOrcidActivities().getAffiliations().getAffiliation());
assertEquals(1, orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().size());
assertEquals(AffiliationType.EDUCATION, orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getType());
assertEquals("My org name", orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getOrganization().getName());
assertEquals("San Jose", orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getOrganization().getAddress().getCity());
assertEquals(org.orcid.jaxb.model.message.Iso3166Country.CR, orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getOrganization().getAddress().getCountry());
assertEquals("24816", orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getPutCode());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getVisibility());
checkSource(orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getSource(), clientId);
// Check biography
assertNotNull(orcidProfile.getOrcidBio());
// Check name
assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails());
assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails().getCreditName());
assertEquals("My credit name", orcidProfile.getOrcidBio().getPersonalDetails().getCreditName().getContent());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getPersonalDetails().getCreditName().getVisibility());
assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails().getGivenNames());
assertEquals("My given names", orcidProfile.getOrcidBio().getPersonalDetails().getGivenNames().getContent());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getPersonalDetails().getGivenNames().getVisibility());
assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails().getFamilyName());
assertEquals("My family name", orcidProfile.getOrcidBio().getPersonalDetails().getFamilyName().getContent());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getPersonalDetails().getFamilyName().getVisibility());
// Check other names
assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames());
assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility());
assertEquals(1, orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().size());
// Check biography
assertNotNull(orcidProfile.getOrcidBio().getBiography());
assertEquals("This is my biography", orcidProfile.getOrcidBio().getBiography().getContent());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getBiography().getVisibility());
// Check address
assertNotNull(orcidProfile.getOrcidBio().getContactDetails());
assertNotNull(orcidProfile.getOrcidBio().getContactDetails().getAddress());
assertNotNull(orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry());
assertEquals(org.orcid.jaxb.model.message.Iso3166Country.US, orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry().getValue());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry().getVisibility());
// Check keywords
assertNotNull(orcidProfile.getOrcidBio().getKeywords());
assertNotNull(orcidProfile.getOrcidBio().getKeywords().getKeyword());
assertEquals(1, orcidProfile.getOrcidBio().getKeywords().getKeyword().size());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getKeywords().getVisibility());
assertEquals("My keyword", orcidProfile.getOrcidBio().getKeywords().getKeyword().get(0).getContent());
// Check researcher urls
assertNotNull(orcidProfile.getOrcidBio().getResearcherUrls());
assertNotNull(orcidProfile.getOrcidBio().getResearcherUrls().getResearcherUrl());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getResearcherUrls().getVisibility());
assertEquals(1, orcidProfile.getOrcidBio().getResearcherUrls().getResearcherUrl().size());
assertEquals("My rUrl", orcidProfile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrlName().getContent());
assertEquals("http://orcid.org", orcidProfile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrl().getValue());
// Check external identifiers
assertNotNull(orcidProfile.getOrcidBio().getExternalIdentifiers());
assertNotNull(orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier());
assertEquals(1, orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("My common name", orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
assertEquals("My refrence", orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdReference().getContent());
assertEquals("http://orcid.org", orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdUrl().getValue());
assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getVisibility());
checkSource(orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getSource(), clientId);
}
Aggregations