Skip to content
Snippets Groups Projects

refactor[AOU-1940]: don't sync publication to orci that older than 1900

Merged Homada.Boumedane requested to merge aou-1940_dont_snyc_publication_older_than_1900 into master
1 unresolved thread
Files
2
@@ -82,6 +82,8 @@ public class OrcidSynchronizationService extends AouResourceService<OrcidSynchro
static final Logger log = LoggerFactory.getLogger(OrcidSynchronizationService.class);
private static final Integer PUBLICATION_LIMIT_DATE = 1900;
private final PersonService personService;
private final OrcidService orcidService;
@@ -439,7 +441,7 @@ public class OrcidSynchronizationService extends AouResourceService<OrcidSynchro
log.info("Publication '{}' ({}) wasn't sent to ORCID profile of {} ({}) (ORCID: {}) as it doesn't contain any external identifier",
publication.getTitle(), publication.getResId(), person.getFullName(), person.getResId(), person.getOrcid());
} catch (PublicationTooOldForOrcidException e) {
log.info("Publication '{}' ({}) wasn't sent to ORCID profile of {} ({}) (ORCID: {}) as it date prior to 1900",
log.info("Publication '{}' ({}) wasn't sent to ORCID profile of {} ({}) (ORCID: {}) because it is older than 1900",
publication.getTitle(), publication.getResId(), person.getFullName(), person.getResId(), person.getOrcid());
}
}
@@ -481,8 +483,8 @@ public class OrcidSynchronizationService extends AouResourceService<OrcidSynchro
}
public OrcidSynchronization sendToOrcidProfile(Person person, String publicationId) {
if (this.publicationService.getPublicationYear(publicationId).isEmpty()) {
Optional<Integer> publicationYearOpt = this.publicationService.getPublicationYear(publicationId);
if (publicationYearOpt.isEmpty() || publicationYearOpt.get() < PUBLICATION_LIMIT_DATE) {
throw new PublicationTooOldForOrcidException();
}
Loading