use of org.orcid.jaxb.model.message.ContributorOrcid in project ORCID-Source by ORCID.
the class CurrentWorkContributor method getContributor.
public Contributor getContributor() {
Contributor contributor = new Contributor();
if (StringUtils.isNotBlank(orcid)) {
contributor.setContributorOrcid(new ContributorOrcid(orcid));
}
if (StringUtils.isNotBlank(creditName)) {
contributor.setCreditName(new CreditName(creditName));
}
if (StringUtils.isNotBlank(email)) {
contributor.setContributorEmail(new ContributorEmail(email));
}
if (StringUtils.isNotBlank(role)) {
ContributorAttributes attributes = retrieveContributorAttributes(contributor);
ContributorRole contributorRole = ContributorRole.fromValue(role);
attributes.setContributorRole(contributorRole);
}
if (StringUtils.isNotBlank(sequence)) {
ContributorAttributes attributes = retrieveContributorAttributes(contributor);
SequenceType sequenceType = SequenceType.fromValue(sequence);
attributes.setContributorSequence(sequenceType);
}
return contributor;
}
use of org.orcid.jaxb.model.message.ContributorOrcid in project ORCID-Source by ORCID.
the class CheckAndFixContributorNameVisibility method processOrcid.
private void processOrcid(final String orcid) {
LOG.info("Checking and fixing profile: {}", orcid);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
OrcidProfile orcidProfile = orcidProfileManager.retrieveOrcidProfile(orcid);
OrcidWorks orcidWorks = orcidProfile.retrieveOrcidWorks();
if (orcidWorks != null) {
for (OrcidWork orcidWork : orcidWorks.getOrcidWork()) {
WorkContributors workContributors = orcidWork.getWorkContributors();
if (workContributors != null) {
for (Contributor contributor : workContributors.getContributor()) {
ContributorOrcid contributorOrcid = contributor.getContributorOrcid();
if (contributorOrcid != null) {
String orcid = contributorOrcid.getPath();
ProfileEntity contributorProfile = profileDao.find(orcid);
if (contributorProfile.getRecordNameEntity() != null && contributorProfile.getRecordNameEntity().getVisibility() != null) {
if (!Visibility.PUBLIC.value().equals(contributorProfile.getRecordNameEntity().getVisibility().value())) {
contributor.setCreditName(null);
}
}
}
}
}
}
}
orcidProfileManager.updateOrcidProfile(orcidProfile);
}
});
}
Aggregations