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;
}
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;
}
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());
}
}
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);
}
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;
}
Aggregations