Skip to content

Commit

Permalink
fix #366
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 5, 2023
1 parent 25a403a commit 195ae13
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions inst/actions/geonapi_publish_iso_19139.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,24 @@ function(action, entity, config){
#publication
mdId = doPublish(metaFile, geometa_inspire)
if(create_doi_on_datacite){
config$logger.info("Creating DOI on DataCite...")
config$logger.info("Checking DOI registration pre-conditions...")
checked = GN$doiCheckPreConditions(mdId)
if(checked){
config$logger.info("DOI registration pre-conditions are met, proceed with DOI registration")
created = GN$createDOI(mdId)
if(created){
doi_report = attr(created, "report")
doi = doi_report$doi
entity$identifiers$doi = doi
config$logger.info(sprintf("DOI '%s' successfuly created for metadata '%s'", doi, mdId))
if(is.null(entity$identifiers[["doi"]])){
config$logger.info("Creating DOI on DataCite...")
config$logger.info("Checking DOI registration pre-conditions...")
checked = GN$doiCheckPreConditions(mdId)
if(checked){
config$logger.info("DOI registration pre-conditions are met, proceed with DOI registration")
created = GN$createDOI(mdId)
if(created){
doi_report = attr(created, "report")
doi = doi_report$doi
entity$identifiers$doi = doi
config$logger.info(sprintf("DOI '%s' successfuly created for metadata '%s'", doi, mdId))
}
}else{
config$logger.warn("Aborting DOI creation, pre-conditions are not met!")
}
}else{
config$logger.warn("Aborting DOI creation, pre-conditions are not met!")
config$logger.warn("A DOI is already declared as entity identifier, skip DOI creation on DataCite")
}
}

Expand Down

0 comments on commit 195ae13

Please sign in to comment.