use of org.orcid.jaxb.model.message.FamilyName in project ORCID-Source by ORCID.
the class OrcidProfileManagerBaseTest method createFullOrcidProfile.
protected OrcidProfile createFullOrcidProfile() {
OrcidProfile profile2 = new OrcidProfile();
profile2.setPassword("password");
profile2.setVerificationCode("1234");
profile2.setOrcidIdentifier(TEST_ORCID);
OrcidBio bio = new OrcidBio();
ContactDetails contactDetails = new ContactDetails();
contactDetails.addOrReplacePrimaryEmail(new Email("will@orcid.org"));
bio.setContactDetails(contactDetails);
profile2.setOrcidBio(bio);
PersonalDetails personalDetails = new PersonalDetails();
personalDetails.setGivenNames(new GivenNames("William"));
personalDetails.setFamilyName(new FamilyName("Simpson"));
personalDetails.setCreditName(new CreditName("W. J. R. Simpson"));
bio.setPersonalDetails(personalDetails);
ResearcherUrls researcherUrls = new ResearcherUrls();
researcherUrls.getResearcherUrl().add(new ResearcherUrl(new Url("http://www.wjrs.co.uk"), null));
bio.setResearcherUrls(researcherUrls);
Keywords keywords = new Keywords();
bio.setKeywords(keywords);
keywords.getKeyword().add(new Keyword("Java", null));
bio.setBiography(new Biography("Will is a software developer at Semantico"));
return profile2;
}
use of org.orcid.jaxb.model.message.FamilyName 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.FamilyName 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;
}
Aggregations