Search in sources :

Example 21 with OrcidProfile

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

the class OrcidMessageVersionConverterImplV1_2_rc3ToV1_2_rc4 method upgradeMessage.

@Override
public OrcidMessage upgradeMessage(OrcidMessage orcidMessage) {
    if (orcidMessage == null) {
        return null;
    }
    orcidMessage.setMessageVersion(TO_VERSION);
    OrcidProfile orcidProfile = orcidMessage.getOrcidProfile();
    upgradeProfile(orcidProfile);
    return orcidMessage;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile)

Example 22 with OrcidProfile

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

the class OrcidProfileManagerImplTest method testUpdatePreferences.

@Test
@Transactional
@Rollback(true)
public void testUpdatePreferences() {
    OrcidProfile profile1 = createBasicProfile();
    profile1 = orcidProfileManager.createOrcidProfile(profile1, false, false);
    assertEquals(Visibility.PRIVATE, profile1.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault().getValue());
    OrcidProfile profile2 = new OrcidProfile();
    profile2.setOrcidIdentifier(TEST_ORCID);
    OrcidInternal internal = new OrcidInternal();
    profile2.setOrcidInternal(internal);
    Preferences preferences = new Preferences();
    internal.setPreferences(preferences);
    preferences.setSendChangeNotifications(new SendChangeNotifications(false));
    preferences.setSendOrcidNews(new SendOrcidNews(true));
    preferences.setDeveloperToolsEnabled(new DeveloperToolsEnabled(true));
    preferences.setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(Visibility.PUBLIC));
    orcidProfileManager.updatePreferences(profile2.getOrcidIdentifier().getPath(), profile2.getOrcidInternal().getPreferences());
    OrcidProfile retrievedProfile = orcidProfileManager.retrieveOrcidProfile(TEST_ORCID);
    assertEquals(false, retrievedProfile.getOrcidInternal().getPreferences().getSendChangeNotifications().isValue());
    assertEquals(true, retrievedProfile.getOrcidInternal().getPreferences().getSendOrcidNews().isValue());
    assertEquals(true, retrievedProfile.getOrcidInternal().getPreferences().getDeveloperToolsEnabled().isValue());
    assertEquals(Visibility.PUBLIC, retrievedProfile.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault().getValue());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) SendOrcidNews(org.orcid.jaxb.model.message.SendOrcidNews) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) ActivitiesVisibilityDefault(org.orcid.jaxb.model.message.ActivitiesVisibilityDefault) Preferences(org.orcid.jaxb.model.message.Preferences) DefaultPreferences(org.orcid.core.constants.DefaultPreferences) SendChangeNotifications(org.orcid.jaxb.model.message.SendChangeNotifications) DeveloperToolsEnabled(org.orcid.jaxb.model.message.DeveloperToolsEnabled) Test(org.junit.Test) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Example 23 with OrcidProfile

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

the class OrcidIndexManagerImplTest method getOrcidWithSubtitledWork.

private OrcidProfile getOrcidWithSubtitledWork() {
    OrcidProfile orcidProfile = getStandardOrcid();
    OrcidWork orcidWork1 = orcidProfile.retrieveOrcidWorks().getOrcidWork().get(0);
    OrcidWork orcidWork2 = orcidProfile.retrieveOrcidWorks().getOrcidWork().get(1);
    OrcidWork orcidWork3 = orcidProfile.retrieveOrcidWorks().getOrcidWork().get(2);
    WorkTitle workTitle1 = new WorkTitle();
    Subtitle subTitle1 = new Subtitle("Subtitle 1");
    workTitle1.setSubtitle(subTitle1);
    workTitle1.setTitle(new Title("Work title 1"));
    orcidWork1.setWorkTitle(workTitle1);
    WorkTitle workTitle2 = orcidWork2.getWorkTitle();
    Subtitle subTitle2 = new Subtitle("Subtitle 2");
    workTitle2.setSubtitle(subTitle2);
    workTitle2.setTitle(new Title("Work title 2"));
    orcidWork2.setWorkTitle(workTitle2);
    WorkTitle workTitle3 = orcidWork3.getWorkTitle();
    Subtitle subTitle3 = new Subtitle("Subtitle 3");
    workTitle3.setSubtitle(subTitle3);
    workTitle3.setTitle(new Title("Work title 3"));
    orcidWork3.setWorkTitle(workTitle3);
    return orcidProfile;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Subtitle(org.orcid.jaxb.model.message.Subtitle) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle)

Example 24 with OrcidProfile

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

the class OrcidIndexManagerImplTest method solrDocFilteredByAffilliationVisibility.

private OrcidSolrDocument solrDocFilteredByAffilliationVisibility() {
    OrcidSolrDocument orcidSolrDocument = fullyPopulatedSolrDocumentForPersistence();
    OrcidProfile orcidProfile = orcidProfileLimitedVisiblityAffiliations();
    OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfile);
    orcidSolrDocument.setPublicProfileMessage(orcidMessage.toString());
    return orcidSolrDocument;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage)

Example 25 with OrcidProfile

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

the class OrcidIndexManagerTypeMatcherTestFactory method orcidBasicProfileCreate.

public static ArgumentMatcher<OrcidProfile> orcidBasicProfileCreate() {
    return new ArgumentMatcher<OrcidProfile>() {

        @Override
        public boolean matches(OrcidProfile orcidProfile) {
            if (!"4444-4444-4444-0001".equals(orcidProfile.getOrcidIdentifier().getPath())) {
                return false;
            }
            PersonalDetails personDetails = orcidProfile.getOrcidBio().getPersonalDetails();
            if (personDetails.getCreditName() != null || personDetails.getFamilyName() != null) {
                return false;
            }
            boolean matchesGivenNameCorrectly = "Reserved For Claim".equals(personDetails.getGivenNames().getContent());
            return matchesGivenNameCorrectly;
        }
    };
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ArgumentMatcher(org.mockito.ArgumentMatcher) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails)

Aggregations

OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)241 Test (org.junit.Test)118 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)77 Transactional (org.springframework.transaction.annotation.Transactional)50 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)45 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)43 DBUnitTest (org.orcid.test.DBUnitTest)43 Rollback (org.springframework.test.annotation.Rollback)40 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)36 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)35 Date (java.util.Date)27 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)27 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)25 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)23 Affiliations (org.orcid.jaxb.model.message.Affiliations)22 FundingTitle (org.orcid.jaxb.model.message.FundingTitle)22 Title (org.orcid.jaxb.model.message.Title)22 Email (org.orcid.jaxb.model.message.Email)21 GivenNames (org.orcid.jaxb.model.message.GivenNames)21 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)21