Search in sources :

Example 51 with OrcidProfile

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

the class CrossRefPublicationsForm method getOrcidProfile.

public OrcidProfile getOrcidProfile() {
    OrcidProfile profile = new OrcidProfile();
    profile.setOrcidIdentifier(orcid);
    OrcidWorks orcidWorks = new OrcidWorks();
    profile.setOrcidWorks(orcidWorks);
    orcidWorks.getOrcidWork().addAll(getOrcidWorks());
    return profile;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks)

Example 52 with OrcidProfile

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

the class PreferencesForm method getOrcidProfile.

public OrcidProfile getOrcidProfile() {
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier(orcid);
    OrcidInternal internal = new OrcidInternal();
    orcidProfile.setOrcidInternal(internal);
    Preferences preferences = new Preferences();
    internal.setPreferences(preferences);
    preferences.setSendChangeNotifications((sendChangeNotifications != null && !sendChangeNotifications.isEmpty()) ? new SendChangeNotifications(true) : null);
    preferences.setSendOrcidNews((sendOrcidNews != null && !sendOrcidNews.isEmpty()) ? new SendOrcidNews(true) : null);
    return orcidProfile;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) SendOrcidNews(org.orcid.jaxb.model.message.SendOrcidNews) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) Preferences(org.orcid.jaxb.model.message.Preferences) SendChangeNotifications(org.orcid.jaxb.model.message.SendChangeNotifications)

Example 53 with OrcidProfile

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

the class ValidationManagerImpl method checkMessage.

private void checkMessage(OrcidMessage orcidMessage) {
    OrcidProfile orcidProfile = orcidMessage != null ? orcidMessage.getOrcidProfile() : null;
    if (orcidProfile == null) {
        if (requireOrcidProfile) {
            throw new OrcidValidationException("There must be an orcid-profile element");
        }
    } else {
        checkBio(orcidProfile.getOrcidBio());
        checkActivities(orcidProfile.getOrcidActivities());
    }
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidValidationException(org.orcid.core.exception.OrcidValidationException)

Example 54 with OrcidProfile

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

the class ProfileEventManager method callOnceOnAll.

private void callOnceOnAll(final String classStr) throws InterruptedException {
    ProfileEvent dummyPe = (ProfileEvent) context.getBean(classStr, (ProfileEvent) null);
    long startTime = System.currentTimeMillis();
    @SuppressWarnings("unchecked") List<String> orcids = Collections.EMPTY_LIST;
    int doneCount = 0;
    do {
        orcids = getProfileDao().findByMissingEventTypes(CHUNK_SIZE, dummyPe.outcomes(), null, true);
        Set<ProfileEvent> callables = new HashSet<ProfileEvent>();
        for (final String orcid : orcids) {
            LOG.info("Calling bean " + classStr + " for " + orcid);
            // TODO: parameterize load options.
            OrcidProfile orcidProfile = getOrcidProfileManager().retrieveOrcidProfile(orcid, new LoadOptions(true, false, true));
            callables.add((ProfileEvent) context.getBean(classStr, orcidProfile));
            doneCount++;
        }
        List<Future<ProfileEventResult>> futures = pool.invokeAll(callables);
        for (Future<ProfileEventResult> future : futures) {
            ProfileEventResult per = null;
            try {
                per = future.get();
            } catch (ExecutionException e) {
                LOG.error("failed calling task ", e);
            }
            getProfileEventDao().persist(new ProfileEventEntity(per.getOrcidId(), per.getOutcome()));
        }
        LOG.info("Current done count: {}", doneCount);
    } while (!orcids.isEmpty());
    long endTime = System.currentTimeMillis();
    String timeTaken = DurationFormatUtils.formatDurationHMS(endTime - startTime);
    LOG.info("Profile Event " + classStr + ": doneCount={}, timeTaken={} (H:m:s.S)", doneCount, timeTaken);
}
Also used : ProfileEventEntity(org.orcid.persistence.jpa.entities.ProfileEventEntity) LoadOptions(org.orcid.core.manager.LoadOptions) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Future(java.util.concurrent.Future) ExecutionException(java.util.concurrent.ExecutionException) HashSet(java.util.HashSet)

Example 55 with OrcidProfile

use of org.orcid.jaxb.model.message.OrcidProfile 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)

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