Search in sources :

Example 6 with GivenNames

use of org.orcid.jaxb.model.message.GivenNames in project ORCID-Source by ORCID.

the class EmailMessageSenderTest method testCreateDigest.

@Test
public void testCreateDigest() throws IOException {
    OrcidProfile orcidProfile = new OrcidProfile();
    OrcidBio orcidBio = new OrcidBio();
    orcidProfile.setOrcidBio(orcidBio);
    PersonalDetails personalDetails = new PersonalDetails();
    orcidBio.setPersonalDetails(personalDetails);
    personalDetails.setGivenNames(new GivenNames("John"));
    personalDetails.setFamilyName(new FamilyName("Watson"));
    OrcidInternal orcidInternal = new OrcidInternal();
    Preferences preferences = new Preferences();
    orcidProfile.setOrcidInternal(orcidInternal);
    orcidInternal.setPreferences(preferences);
    preferences.setSendEmailFrequencyDays("7.0");
    List<Notification> notifications = new ArrayList<>();
    NotificationPermission notification1 = new NotificationPermission();
    notification1.setPutCode(1L);
    Items activities1 = new Items();
    notification1.setItems(activities1);
    activities1.getItems().add(createActivity(ItemType.WORK, "Work 1", "123446/67654"));
    activities1.getItems().add(createActivity(ItemType.WORK, "Work 2", "http://dx.doi.org/123446/67655"));
    notification1.setCreatedDate(DateUtils.convertToXMLGregorianCalendar("2014-07-10T13:39:31"));
    notification1.setAuthorizationUrl(new AuthorizationUrl("https://thirdparty.com/add-to-orcid/12345"));
    Source source1 = new Source();
    source1.setSourceName(new SourceName("Super Institution 1"));
    source1.setSourceClientId(new SourceClientId("APP-5555-5555-5555-5555"));
    notification1.setSource(source1);
    notifications.add(notification1);
    NotificationPermission notification2 = new NotificationPermission();
    notification2.setPutCode(2L);
    Items activities2 = new Items();
    notification2.setItems(activities2);
    activities2.getItems().add(createActivity(ItemType.EMPLOYMENT, "Employment 1 ", "12345/abc"));
    notification2.setCreatedDate(DateUtils.convertToXMLGregorianCalendar("2014-08-17T10:22:15"));
    notification2.setAuthorizationUrl(new AuthorizationUrl("https://thirdparty.com/add-to-orcid/abc"));
    Source source2 = new Source();
    source2.setSourceName(new SourceName("Super Institution 1"));
    source2.setSourceClientId(new SourceClientId("APP-5555-5555-5555-5555"));
    notification2.setSource(source2);
    notifications.add(notification2);
    NotificationPermission notification3 = new NotificationPermission();
    notification3.setPutCode(3L);
    Items activities3 = new Items();
    notification3.setItems(activities3);
    activities3.getItems().add(createActivity(ItemType.WORK, "Work 3", "12345/def"));
    activities3.getItems().add(createActivity(ItemType.WORK, "Work 4", "12345/ghi"));
    notification3.setCreatedDate(DateUtils.convertToXMLGregorianCalendar("2014-07-10T08:53:56"));
    notification3.setAuthorizationUrl(new AuthorizationUrl("https://thirdparty.com/add-to-orcid/def"));
    Source source3 = new Source();
    source3.setSourceName(new SourceName("Lovely Publisher 1"));
    notification3.setSource(source3);
    source3.setSourceClientId(new SourceClientId("APP-ABCD-ABCD-ABCD-ABCD"));
    notifications.add(notification3);
    NotificationCustom notification4 = new NotificationCustom();
    notification4.setPutCode(4L);
    notification4.setSubject("We have release a new messaging feature");
    notification4.setCreatedDate(DateUtils.convertToXMLGregorianCalendar("2014-07-10T08:53:56"));
    notifications.add(notification4);
    NotificationCustom notification5 = new NotificationCustom();
    notification5.setPutCode(5L);
    notification5.setSubject("The ORCID registry is now available in Orc");
    notification5.setCreatedDate(DateUtils.convertToXMLGregorianCalendar("2014-07-11T06:42:18"));
    notifications.add(notification5);
    NotificationAmended notification6 = new NotificationAmended();
    notification6.setPutCode(6L);
    notification6.setSubject("Amended by member");
    notification6.setAmendedSection(AmendedSection.FUNDING);
    notification6.setCreatedDate(DateUtils.convertToXMLGregorianCalendar("2014-07-12T18:44:36"));
    notification6.setSource(source3);
    notifications.add(notification6);
    EmailMessage emailMessage = emailMessageSender.createDigest(orcidProfile, notifications, Locale.ENGLISH);
    assertNotNull(emailMessage);
    String expectedBodyText = IOUtils.toString(getClass().getResourceAsStream("example_digest_email_body.txt"));
    String expectedBodyHtml = IOUtils.toString(getClass().getResourceAsStream("example_digest_email_body.html"));
    assertTrue(expectedBodyText.contains("Lovely Publisher 1 has updated recent funding on your ORCID record."));
    assertTrue(expectedBodyHtml.contains("Lovely Publisher 1 has updated recent funding on your ORCID record."));
    assertTrue(expectedBodyText.contains("Super Institution 1: Request to add items"));
    assertTrue(expectedBodyHtml.contains("Super Institution 1: Request to add items"));
    assertTrue(expectedBodyText.contains("/action"));
    assertTrue(expectedBodyHtml.contains("/action"));
    assertEquals("[ORCID] John Watson you have 6 new notifications", emailMessage.getSubject());
}
Also used : OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) SourceClientId(org.orcid.jaxb.model.common_v2.SourceClientId) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) ArrayList(java.util.ArrayList) SourceName(org.orcid.jaxb.model.common_v2.SourceName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Notification(org.orcid.jaxb.model.notification_v2.Notification) Source(org.orcid.jaxb.model.common_v2.Source) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) AuthorizationUrl(org.orcid.jaxb.model.notification.permission_v2.AuthorizationUrl) NotificationCustom(org.orcid.jaxb.model.notification.custom_v2.NotificationCustom) GivenNames(org.orcid.jaxb.model.message.GivenNames) NotificationPermission(org.orcid.jaxb.model.notification.permission_v2.NotificationPermission) Items(org.orcid.jaxb.model.notification.permission_v2.Items) Preferences(org.orcid.jaxb.model.message.Preferences) NotificationAmended(org.orcid.jaxb.model.notification.amended_v2.NotificationAmended) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 7 with GivenNames

use of org.orcid.jaxb.model.message.GivenNames in project ORCID-Source by ORCID.

the class OrcidSearchManagerImplTest method getOrcidProfileAllIndexFieldsPopulated.

private OrcidProfile getOrcidProfileAllIndexFieldsPopulated() {
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier("5678");
    OrcidBio orcidBio = new OrcidBio();
    PersonalDetails personalDetails = new PersonalDetails();
    personalDetails.setFamilyName(new FamilyName("Logan"));
    personalDetails.setGivenNames(new GivenNames("Donald Edward"));
    personalDetails.setCreditName(new CreditName("Stanley Higgins"));
    OtherNames otherNames = new OtherNames();
    otherNames.getOtherName().add(new OtherName("Edward Bass", null));
    otherNames.getOtherName().add(new OtherName("Gareth Dove", null));
    personalDetails.setOtherNames(otherNames);
    orcidBio.setPersonalDetails(personalDetails);
    orcidProfile.setOrcidBio(orcidBio);
    OrcidActivities orcidActivities = new OrcidActivities();
    orcidProfile.setOrcidActivities(orcidActivities);
    Affiliations affiliations = new Affiliations();
    orcidActivities.setAffiliations(affiliations);
    OrcidWorks orcidWorks = new OrcidWorks();
    orcidProfile.setOrcidWorks(orcidWorks);
    OrcidWork orcidWork1 = new OrcidWork();
    OrcidWork orcidWork2 = new OrcidWork();
    assignWorkIdentifers(orcidWork1, orcidWork2);
    orcidWorks.getOrcidWork().add(orcidWork1);
    orcidWorks.getOrcidWork().add(orcidWork2);
    orcidProfile.setOrcidWorks(orcidWorks);
    FundingList orcidFundings = new FundingList();
    orcidProfile.setFundings(orcidFundings);
    Funding funding1 = new Funding();
    funding1.setVisibility(Visibility.PUBLIC);
    FundingTitle title = new FundingTitle();
    title.setTitle(new Title("grant1"));
    funding1.setTitle(title);
    funding1.setDescription("Grant 1 - a short description");
    funding1.setPutCode("grant 1 - put-code");
    Funding funding2 = new Funding();
    funding2.setVisibility(Visibility.PUBLIC);
    FundingTitle title2 = new FundingTitle();
    title2.setTitle(new Title("grant2"));
    funding2.setTitle(title2);
    funding2.setDescription("Grant 2 - a short description");
    funding2.setPutCode("grant 2 - put-code");
    orcidFundings.getFundings().add(funding1);
    orcidFundings.getFundings().add(funding2);
    return orcidProfile;
}
Also used : OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) Funding(org.orcid.jaxb.model.message.Funding) CreditName(org.orcid.jaxb.model.message.CreditName) OtherName(org.orcid.jaxb.model.message.OtherName) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) Title(org.orcid.jaxb.model.message.Title) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) FundingList(org.orcid.jaxb.model.message.FundingList) Affiliations(org.orcid.jaxb.model.message.Affiliations) GivenNames(org.orcid.jaxb.model.message.GivenNames) FundingTitle(org.orcid.jaxb.model.message.FundingTitle)

Example 8 with GivenNames

use of org.orcid.jaxb.model.message.GivenNames in project ORCID-Source by ORCID.

the class OrcidSearchManagerImplTest method getOrcidProfile6789MandatoryOnly.

private OrcidProfile getOrcidProfile6789MandatoryOnly() {
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier("6789");
    OrcidBio orcidBio = new OrcidBio();
    orcidProfile.setOrcidBio(orcidBio);
    ContactDetails contactDetails = new ContactDetails();
    contactDetails.addOrReplacePrimaryEmail(new Email("don@semantico.com"));
    orcidBio.setContactDetails(contactDetails);
    PersonalDetails personalDetails = new PersonalDetails();
    orcidBio.setPersonalDetails(personalDetails);
    personalDetails.setFamilyName(new FamilyName("Thomson"));
    personalDetails.setGivenNames(new GivenNames("Homer J"));
    OrcidActivities orcidActivities = new OrcidActivities();
    orcidProfile.setOrcidActivities(orcidActivities);
    Affiliations affiliations = new Affiliations();
    orcidActivities.setAffiliations(affiliations);
    return orcidProfile;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Email(org.orcid.jaxb.model.message.Email) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) FamilyName(org.orcid.jaxb.model.message.FamilyName) Affiliations(org.orcid.jaxb.model.message.Affiliations) GivenNames(org.orcid.jaxb.model.message.GivenNames) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities)

Example 9 with GivenNames

use of org.orcid.jaxb.model.message.GivenNames in project ORCID-Source by ORCID.

the class OrcidProfileManagerImplTest method setBio.

private void setBio(OrcidProfile profile, Visibility defaultVisibility) {
    OrcidBio bio = new OrcidBio();
    Biography biography = new Biography("This is my biography");
    if (defaultVisibility != null) {
        biography.setVisibility(defaultVisibility);
    }
    bio.setBiography(biography);
    ContactDetails contactDetails = new ContactDetails();
    Address address = new Address();
    address.setCountry(new Country(Iso3166Country.US));
    if (defaultVisibility != null) {
        address.getCountry().setVisibility(defaultVisibility);
    }
    contactDetails.setAddress(address);
    List<Email> emails = new ArrayList<Email>();
    Email email = new Email();
    email.setPrimary(true);
    email.setValue(System.currentTimeMillis() + "@test.orcid.org");
    emails.add(email);
    contactDetails.setEmail(emails);
    bio.setContactDetails(contactDetails);
    ExternalIdentifiers extIds = new ExternalIdentifiers();
    ExternalIdentifier extId = new ExternalIdentifier();
    extId.setExternalIdCommonName(new ExternalIdCommonName("common-name"));
    extId.setExternalIdReference(new ExternalIdReference("ext-id-reference"));
    extId.setExternalIdUrl(new ExternalIdUrl("http://orcid.org/ext-id"));
    extIds.getExternalIdentifier().add(extId);
    if (defaultVisibility != null) {
        extIds.setVisibility(defaultVisibility);
    }
    bio.setExternalIdentifiers(extIds);
    Keywords keywords = new Keywords();
    Keyword keyword = new Keyword();
    keyword.setContent("k1");
    keywords.getKeyword().add(keyword);
    if (defaultVisibility != null) {
        keywords.setVisibility(defaultVisibility);
    }
    bio.setKeywords(keywords);
    PersonalDetails personalDetails = new PersonalDetails();
    personalDetails.setCreditName(new CreditName("credit-name"));
    personalDetails.setGivenNames(new GivenNames("given-names"));
    personalDetails.setFamilyName(new FamilyName("family-name"));
    OtherNames otherNames = new OtherNames();
    OtherName otherName = new OtherName();
    otherName.setContent("o1");
    otherNames.getOtherName().add(otherName);
    if (defaultVisibility != null) {
        otherNames.setVisibility(defaultVisibility);
    }
    personalDetails.setOtherNames(otherNames);
    bio.setPersonalDetails(personalDetails);
    ResearcherUrls researcherUrls = new ResearcherUrls();
    ResearcherUrl researcherUrl = new ResearcherUrl();
    researcherUrl.setUrl(new Url("http://orcid.org/researcher-url-1"));
    researcherUrl.setUrlName(new UrlName("url-name-1"));
    researcherUrls.getResearcherUrl().add(researcherUrl);
    if (defaultVisibility != null) {
        researcherUrls.setVisibility(defaultVisibility);
    }
    bio.setResearcherUrls(researcherUrls);
    profile.setOrcidBio(bio);
}
Also used : Email(org.orcid.jaxb.model.message.Email) Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Address(org.orcid.jaxb.model.message.Address) OrganizationAddress(org.orcid.jaxb.model.message.OrganizationAddress) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) ArrayList(java.util.ArrayList) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.jaxb.model.message.GivenNames) Biography(org.orcid.jaxb.model.message.Biography) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) FundingExternalIdentifiers(org.orcid.jaxb.model.message.FundingExternalIdentifiers) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) Keyword(org.orcid.jaxb.model.message.Keyword) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) FundingExternalIdentifier(org.orcid.jaxb.model.message.FundingExternalIdentifier) CreditName(org.orcid.jaxb.model.message.CreditName) OtherName(org.orcid.jaxb.model.message.OtherName) UrlName(org.orcid.jaxb.model.message.UrlName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Country(org.orcid.jaxb.model.message.Country) Iso3166Country(org.orcid.jaxb.model.message.Iso3166Country)

Example 10 with GivenNames

use of org.orcid.jaxb.model.message.GivenNames in project ORCID-Source by ORCID.

the class RegistrationManagerImplTest method createBasicProfile.

private OrcidProfile createBasicProfile(String email, boolean claimed, String sourceId) {
    OrcidProfile profile = new OrcidProfile();
    profile.setPassword("password");
    profile.setVerificationCode("1234");
    OrcidBio bio = new OrcidBio();
    ContactDetails contactDetails = new ContactDetails();
    contactDetails.addOrReplacePrimaryEmail(new Email(email));
    bio.setContactDetails(contactDetails);
    profile.setOrcidBio(bio);
    PersonalDetails personalDetails = new PersonalDetails();
    bio.setPersonalDetails(personalDetails);
    personalDetails.setGivenNames(new GivenNames("New"));
    personalDetails.setFamilyName(new FamilyName("User"));
    OrcidHistory orcidHistory = new OrcidHistory();
    orcidHistory.setClaimed(new Claimed(claimed));
    orcidHistory.setCreationMethod(CreationMethod.DIRECT);
    orcidHistory.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
    profile.setOrcidHistory(orcidHistory);
    //Set the source
    profile.getOrcidHistory().setSource(new Source(sourceId));
    return profile;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Email(org.orcid.jaxb.model.message.Email) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) FamilyName(org.orcid.jaxb.model.message.FamilyName) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Claimed(org.orcid.jaxb.model.message.Claimed) Date(java.util.Date) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Source(org.orcid.jaxb.model.message.Source)

Aggregations

GivenNames (org.orcid.jaxb.model.message.GivenNames)23 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)20 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)20 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)18 FamilyName (org.orcid.jaxb.model.message.FamilyName)16 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)13 Email (org.orcid.jaxb.model.message.Email)12 CreditName (org.orcid.jaxb.model.message.CreditName)11 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)8 OtherNames (org.orcid.jaxb.model.message.OtherNames)7 ResearcherUrls (org.orcid.jaxb.model.message.ResearcherUrls)7 ResearcherUrl (org.orcid.jaxb.model.message.ResearcherUrl)6 Url (org.orcid.jaxb.model.message.Url)6 Test (org.junit.Test)5 Biography (org.orcid.jaxb.model.message.Biography)5 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)5 Keywords (org.orcid.jaxb.model.message.Keywords)5 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)5 Affiliations (org.orcid.jaxb.model.message.Affiliations)4 Keyword (org.orcid.jaxb.model.message.Keyword)4