use of org.orcid.jaxb.model.record_v2.CreditName in project ORCID-Source by ORCID.
the class SetUpClientsAndUsers method createUser.
private void createUser(Map<String, String> params) throws Exception {
// Create it
OrcidProfile orcidProfile = new OrcidProfile();
orcidProfile.setOrcidIdentifier(new OrcidIdentifier(params.get(ORCID)));
orcidProfile.setType(OrcidType.fromValue(params.get(ORCID_TYPE)));
if (params.get(MEMBER_TYPE) != null) {
orcidProfile.setGroupType(MemberType.fromValue(params.get(MEMBER_TYPE)));
}
orcidProfile.setPassword(params.get(PASSWORD));
OrcidInternal internal = new OrcidInternal();
Preferences preferences = new Preferences();
ActivitiesVisibilityDefault visibilityDefaults = new ActivitiesVisibilityDefault();
visibilityDefaults.setValue(Visibility.PUBLIC);
preferences.setActivitiesVisibilityDefault(visibilityDefaults);
internal.setPreferences(preferences);
orcidProfile.setOrcidInternal(internal);
Email email = new Email(params.get(EMAIL));
email.setCurrent(true);
email.setPrimary(true);
email.setVerified(true);
email.setVisibility(Visibility.PUBLIC);
List<Email> emails = new ArrayList<Email>();
emails.add(email);
ContactDetails contactDetails = new ContactDetails();
contactDetails.setEmail(emails);
org.orcid.jaxb.model.message.PersonalDetails personalDetails = new org.orcid.jaxb.model.message.PersonalDetails();
org.orcid.jaxb.model.message.CreditName creditName = new org.orcid.jaxb.model.message.CreditName(params.get(CREDIT_NAME));
creditName.setVisibility(OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility());
personalDetails.setCreditName(creditName);
personalDetails.setFamilyName(new org.orcid.jaxb.model.message.FamilyName(params.get(FAMILY_NAMES)));
personalDetails.setGivenNames(new org.orcid.jaxb.model.message.GivenNames(params.get(GIVEN_NAMES)));
OrcidBio bio = new OrcidBio();
bio.setContactDetails(contactDetails);
bio.setPersonalDetails(personalDetails);
bio.setBiography(new Biography(params.get(BIO), OrcidVisibilityDefaults.BIOGRAPHY_DEFAULT.getVisibility()));
orcidProfile.setOrcidBio(bio);
OrcidHistory history = new OrcidHistory();
history.setClaimed(new Claimed(true));
history.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
history.setCreationMethod(CreationMethod.DIRECT);
orcidProfile.setOrcidHistory(history);
orcidProfileManager.createOrcidProfile(orcidProfile, false, false);
if (params.containsKey(LOCKED)) {
orcidProfileManager.lockProfile(params.get(ORCID), LockReason.SPAM.getLabel(), null);
}
if (params.containsKey(DEVELOPER_TOOLS)) {
profileEntityManager.enableDeveloperTools(params.get(ORCID));
}
}
use of org.orcid.jaxb.model.record_v2.CreditName in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getNameMapperFacade.
public MapperFacade getNameMapperFacade() {
MapperFactory mapperFactory = getNewMapperFactory();
ClassMapBuilder<Name, RecordNameEntity> nameClassMap = mapperFactory.classMap(Name.class, RecordNameEntity.class);
addV2DateFields(nameClassMap);
nameClassMap.field("creditName.content", "creditName");
nameClassMap.field("givenNames.content", "givenNames");
nameClassMap.field("familyName.content", "familyName");
nameClassMap.field("path", "profile.id");
nameClassMap.byDefault();
nameClassMap.register();
return mapperFactory.getMapperFacade();
}
use of org.orcid.jaxb.model.record_v2.CreditName in project ORCID-Source by ORCID.
the class RecordNameManagerTest method testCreateRecordName.
@Test
public void testCreateRecordName() {
Name name = new Name();
long time = System.currentTimeMillis();
name.setCreditName(new CreditName("Credit Name " + time));
name.setFamilyName(new FamilyName("Family Name " + time));
name.setGivenNames(new GivenNames("Given Names " + time));
name.setVisibility(Visibility.PRIVATE);
String orcid = "0000-0000-0000-0005";
recordNameManager.createRecordName(orcid, name);
Name newName = recordNameManager.getRecordName(orcid);
assertNotNull(newName);
assertEquals("Credit Name " + time, newName.getCreditName().getContent());
assertEquals("Family Name " + time, newName.getFamilyName().getContent());
assertEquals("Given Names " + time, newName.getGivenNames().getContent());
assertEquals(Visibility.PRIVATE, newName.getVisibility());
}
use of org.orcid.jaxb.model.record_v2.CreditName in project ORCID-Source by ORCID.
the class RDFWriterTest method fakeBio.
private Record fakeBio() throws DatatypeConfigurationException {
Record r = new Record();
r.setOrcidIdentifier(new OrcidIdentifier());
r.getOrcidIdentifier().setPath("000-1337");
r.getOrcidIdentifier().setUri("http://orcid.example.com/000-1337");
r.setHistory(new History());
r.getHistory().setCreationMethod(CreationMethod.WEBSITE);
XMLGregorianCalendar value = dataTypeFactory.newXMLGregorianCalendar(1980, 12, 31, 23, 29, 29, 999, 0);
r.getHistory().setLastModifiedDate(new LastModifiedDate(value));
r.getHistory().setClaimed(true);
r.setPerson(new Person());
r.getPerson().setBiography(new Biography());
r.getPerson().setName(new Name());
r.getPerson().getName().setFamilyName(new FamilyName("Doe"));
r.getPerson().getName().setCreditName(new CreditName("John F Doe"));
r.getPerson().getName().setGivenNames(new GivenNames("John"));
r.getPerson().setOtherNames(new OtherNames());
r.getPerson().getOtherNames().setOtherNames(new ArrayList<OtherName>());
OtherName n = new OtherName();
n.setContent("Johnny");
n.setVisibility(Visibility.PUBLIC);
OtherName n1 = new OtherName();
n1.setContent("Mr Doe");
n1.setVisibility(Visibility.PUBLIC);
r.getPerson().getOtherNames().getOtherNames().add(n);
r.getPerson().getOtherNames().getOtherNames().add(n1);
r.getPerson().setResearcherUrls(new ResearcherUrls());
r.getPerson().getResearcherUrls().setResearcherUrls(new ArrayList<ResearcherUrl>());
ResearcherUrl anonymous = new ResearcherUrl();
anonymous.setUrl(new Url("http://example.com/anon"));
anonymous.setVisibility(Visibility.PUBLIC);
r.getPerson().getResearcherUrls().getResearcherUrls().add(anonymous);
r.getPerson().getResearcherUrls().getResearcherUrls().add(buildRUrl("http://example.com/myPage", "homePage"));
r.getPerson().getResearcherUrls().getResearcherUrls().add(buildRUrl("http://example.com/foaf#me", "FOAF"));
r.getPerson().getResearcherUrls().getResearcherUrls().add(buildRUrl("http://example.com/webId", "webID"));
r.getPerson().getResearcherUrls().getResearcherUrls().add(buildRUrl("http://example.com/other", "other"));
r.getPerson().setAddresses(new Addresses());
r.getPerson().getAddresses().setAddress(new ArrayList<Address>());
Address a = new Address();
a.setCountry(new Country());
a.getCountry().setValue(Iso3166Country.GB);
r.getPerson().getAddresses().getAddress().add(a);
r.getPerson().setEmails(new Emails());
r.getPerson().getEmails().setEmails(new ArrayList<Email>());
Email e = new Email();
e.setEmail("john@example.org");
e.setCurrent(true);
Email e1 = new Email();
e1.setEmail("doe@example.com");
e1.setCurrent(true);
r.getPerson().getEmails().getEmails().add(e);
r.getPerson().getEmails().getEmails().add(e1);
return r;
}
Aggregations