use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class T2OrcidApiServiceVersionedDelegatorTest method createStubOrcidMessage.
private OrcidMessage createStubOrcidMessage() {
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion("1.2_rc6");
OrcidProfile orcidProfile = new OrcidProfile();
orcidMessage.setOrcidProfile(orcidProfile);
OrcidBio orcidBio = new OrcidBio();
orcidProfile.setOrcidBio(orcidBio);
PersonalDetails personalDetails = new PersonalDetails();
orcidBio.setPersonalDetails(personalDetails);
GivenNames givenNames = new GivenNames("Test given names");
personalDetails.setGivenNames(givenNames);
CreditName creditName = new CreditName("Test credit name");
personalDetails.setCreditName(creditName);
creditName.setVisibility(Visibility.LIMITED);
ContactDetails contactDetails = new ContactDetails();
orcidBio.setContactDetails(contactDetails);
return orcidMessage;
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidProfileManagerImpl method deactivateOrcidProfile.
@Override
@Transactional
@Deprecated
public OrcidProfile deactivateOrcidProfile(OrcidProfile existingOrcidProfile) {
OrcidProfile blankedOrcidProfile = new OrcidProfile();
OrcidBio existingBio = existingOrcidProfile.getOrcidBio();
OrcidBio minimalBio = new OrcidBio();
ContactDetails minimalContactDetails = new ContactDetails();
minimalContactDetails.getEmail().addAll(existingBio.getContactDetails().getEmail());
OrcidInternal minimalOrcidInternal = new OrcidInternal();
minimalOrcidInternal.setSecurityDetails(existingOrcidProfile.getOrcidInternal().getSecurityDetails());
OrcidHistory deactivatedOrcidHistory = existingOrcidProfile.getOrcidHistory();
deactivatedOrcidHistory.setDeactivationDate(new DeactivationDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
blankedOrcidProfile.setOrcidHistory(deactivatedOrcidHistory);
// only names names from bio with a visibility setting
PersonalDetails minimalPersonalDetails = new PersonalDetails();
minimalPersonalDetails.setOtherNames(null);
CreditName creditName = new CreditName();
creditName.setVisibility(Visibility.PUBLIC);
minimalPersonalDetails.setCreditName(creditName);
minimalPersonalDetails.setGivenNames(new GivenNames("Given Names Deactivated"));
minimalPersonalDetails.setFamilyName(new FamilyName("Family Name Deactivated"));
for (Email email : minimalContactDetails.getEmail()) {
setVisibilityToPrivate(email);
}
setVisibilityToPrivate(minimalPersonalDetails.getOtherNames());
if (minimalPersonalDetails.getOtherNames() != null && minimalPersonalDetails.getOtherNames().getOtherName() != null) {
for (OtherName name : minimalPersonalDetails.getOtherNames().getOtherName()) setVisibilityToPrivate(name);
}
minimalBio.setPersonalDetails(minimalPersonalDetails);
minimalBio.setContactDetails(minimalContactDetails);
minimalBio.setBiography(new Biography());
minimalBio.setExternalIdentifiers(new ExternalIdentifiers());
blankedOrcidProfile.setOrcidBio(minimalBio);
blankedOrcidProfile.setOrcidIdentifier(existingOrcidProfile.getOrcidIdentifier().getPath());
OrcidProfile profileToReturn = updateOrcidProfile(blankedOrcidProfile);
userConnectionDao.deleteByOrcid(existingOrcidProfile.getOrcidIdentifier().getPath());
notificationManager.sendAmendEmail(profileToReturn, AmendedSection.UNKNOWN);
return profileToReturn;
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidProfileManagerReadOnlyImpl method createReservedForClaimOrcidProfile.
protected OrcidProfile createReservedForClaimOrcidProfile(String orcid, OrcidDeprecated deprecatedInfo, LastModifiedDate lastModifiedDate) {
OrcidProfile op = new OrcidProfile();
if (jpaJaxbAdapter != null) {
op.setOrcidIdentifier(new OrcidIdentifier(jpaJaxbAdapter.getOrcidIdBase(orcid)));
} else {
op.setOrcidIdentifier(orcid);
}
if (deprecatedInfo != null)
op.setOrcidDeprecated(deprecatedInfo);
OrcidHistory oh = new OrcidHistory();
oh.setClaimed(new Claimed(false));
oh.setLastModifiedDate(lastModifiedDate);
op.setOrcidHistory(oh);
GivenNames gn = new GivenNames();
PersonalDetails pd = new PersonalDetails();
gn.setContent(localeManager.resolveMessage("orcid.reserved_for_claim"));
gn.setVisibility(OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility());
pd.setGivenNames(gn);
OrcidBio ob = new OrcidBio();
ob.setPersonalDetails(pd);
op.setOrcidBio(ob);
return op;
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class RDFWriterTest method fakeBio.
private OrcidMessage fakeBio() throws DatatypeConfigurationException {
OrcidMessage orcidMessage = new OrcidMessage();
OrcidProfile orcidProfile1 = new OrcidProfile();
OrcidIdentifier orcidIdentifier = new OrcidIdentifier();
orcidProfile1.setOrcidIdentifier(orcidIdentifier);
orcidIdentifier.setUri("http://orcid.example.com/000-1337");
orcidIdentifier.setPath("000-1337");
OrcidBio bio = new OrcidBio();
orcidProfile1.setOrcidBio(bio);
OrcidHistory history = new OrcidHistory();
XMLGregorianCalendar value = dataTypeFactory.newXMLGregorianCalendar(1980, 12, 31, 23, 29, 29, 999, 0);
history.setCreationMethod(CreationMethod.WEBSITE);
history.setLastModifiedDate(new LastModifiedDate(value));
orcidProfile1.setOrcidHistory(history);
PersonalDetails personal = new PersonalDetails();
bio.setPersonalDetails(personal);
personal.setFamilyName(new FamilyName("Doe"));
personal.setCreditName(new CreditName("John F Doe"));
personal.setGivenNames(new GivenNames("John"));
personal.setOtherNames(new OtherNames());
personal.getOtherNames().addOtherName("Johnny", Visibility.PUBLIC);
personal.getOtherNames().addOtherName("Mr Doe", Visibility.PUBLIC);
ResearcherUrls urls = new ResearcherUrls();
bio.setResearcherUrls(urls);
ResearcherUrl anonymous = new ResearcherUrl(new Url("http://example.com/anon"), Visibility.PUBLIC);
urls.getResearcherUrl().add(anonymous);
// "home page" - with strange casing
ResearcherUrl homePage = new ResearcherUrl(new Url("http://example.com/myPage"), new UrlName("homePage"), Visibility.PUBLIC);
urls.getResearcherUrl().add(homePage);
ResearcherUrl foaf = new ResearcherUrl(new Url("http://example.com/foaf#me"), new UrlName("FOAF"), Visibility.PUBLIC);
urls.getResearcherUrl().add(foaf);
ResearcherUrl webId = new ResearcherUrl(new Url("http://example.com/webId"), new UrlName("webID"), Visibility.PUBLIC);
urls.getResearcherUrl().add(webId);
ResearcherUrl other = new ResearcherUrl(new Url("http://example.com/other"), new UrlName("other"), Visibility.PUBLIC);
urls.getResearcherUrl().add(other);
bio.setContactDetails(new ContactDetails());
bio.getContactDetails().setEmail(Arrays.asList(new Email("john@example.org"), new Email("doe@example.com")));
bio.getContactDetails().setAddress(new Address());
bio.getContactDetails().getAddress().setCountry(new Country(Iso3166Country.GB));
orcidMessage.setOrcidProfile(orcidProfile1);
return orcidMessage;
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidProfileManagerImplTest method before.
@Before
@Transactional
@Rollback
public void before() throws Exception {
OrcidProfileManagerImpl orcidProfileManagerImpl = getTargetObject(orcidProfileManager, OrcidProfileManagerImpl.class);
orcidProfileManagerImpl.setNotificationManager(notificationManager);
if (profileDao.find(TEST_ORCID) != null) {
profileDao.remove(TEST_ORCID);
}
subjectDao.merge(new SubjectEntity("Computer Science"));
subjectDao.merge(new SubjectEntity("Dance"));
OrcidProfile delegateProfile = new OrcidProfile();
delegateProfile.setOrcidIdentifier(DELEGATE_ORCID);
OrcidBio delegateBio = new OrcidBio();
delegateProfile.setOrcidBio(delegateBio);
PersonalDetails delegatePersonalDetails = new PersonalDetails();
delegateBio.setPersonalDetails(delegatePersonalDetails);
CreditName delegateCreditName = new CreditName("H. Shearer");
delegateCreditName.setVisibility(Visibility.PUBLIC);
delegatePersonalDetails.setCreditName(delegateCreditName);
orcidProfileManager.createOrcidProfile(delegateProfile, false, false);
OrcidProfile applicationProfile = new OrcidProfile();
applicationProfile.setOrcidIdentifier(APPLICATION_ORCID);
OrcidBio applicationBio = new OrcidBio();
applicationProfile.setOrcidBio(applicationBio);
PersonalDetails applicationPersonalDetails = new PersonalDetails();
applicationBio.setPersonalDetails(applicationPersonalDetails);
applicationPersonalDetails.setCreditName(new CreditName("Brown University"));
orcidProfileManager.createOrcidProfile(applicationProfile, false, false);
ClientDetailsEntity clientDetails = new ClientDetailsEntity();
clientDetails.setId(applicationProfile.getOrcidIdentifier().getPath());
ProfileEntity applicationProfileEntity = profileDao.find(applicationProfile.getOrcidIdentifier().getPath());
profileDao.refresh(applicationProfileEntity);
clientDetails.setGroupProfileId(applicationProfileEntity.getId());
clientDetailsManager.merge(clientDetails);
OrcidOauth2TokenDetail token = new OrcidOauth2TokenDetail();
token.setTokenValue("1234");
token.setClientDetailsId(clientDetails.getId());
token.setProfile(profileDao.find(delegateProfile.getOrcidIdentifier().getPath()));
token.setScope(StringUtils.join(new String[] { ScopePathType.ORCID_BIO_READ_LIMITED.value(), ScopePathType.ORCID_BIO_UPDATE.value() }, " "));
SortedSet<OrcidOauth2TokenDetail> tokens = new TreeSet<>();
tokens.add(token);
ProfileEntity delegateProfileEntity = profileDao.find(delegateProfile.getOrcidIdentifier().getPath());
delegateProfileEntity.setTokenDetails(tokens);
profileDao.merge(delegateProfileEntity);
SecurityQuestionEntity existingSecurityQuestionEntity = securityQuestionDao.find(3);
if (existingSecurityQuestionEntity == null) {
SecurityQuestionEntity securityQuestionEntity = new SecurityQuestionEntity();
securityQuestionEntity.setId(3);
securityQuestionEntity.setQuestion("What?");
securityQuestionDao.persist(securityQuestionEntity);
}
orcidProfileManager.setCompareWorksUsingScopusWay(true);
}
Aggregations