diff --git a/DESCRIPTION b/DESCRIPTION index 7f1d6d32..ada1b636 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: geoflow -Version: 0.0.9003 -Date: 2019-10-18 +Version: 0.0.9004 +Date: 2019-10-19 Title: R engine to orchestrate and run geospatial (meta)data workflows Authors@R: c( person("Emmanuel", "Blondel", role = c("aut", "cre"), email = "emmanuel.blondel1@gmail.com", comment = c(ORCID = "0000-0002-5870-5762")), diff --git a/NAMESPACE b/NAMESPACE index 9051724d..bb0e32a5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -32,6 +32,7 @@ export(handle_entities_excel) export(handle_entities_gsheet) export(initWorkflow) export(initWorkflowJob) +export(list_action_options) export(list_actions) export(list_contact_handlers) export(list_entity_handlers) diff --git a/R/geoflow.R b/R/geoflow.R index c64e69a8..19b0c5e4 100644 --- a/R/geoflow.R +++ b/R/geoflow.R @@ -28,8 +28,8 @@ #' \tabular{ll}{ #' Package: \tab geoflow\cr #' Type: \tab Package\cr -#' Version: \tab 0.0.9003\cr -#' Date: \tab 2019-10-18\cr +#' Version: \tab 0.0.9004\cr +#' Date: \tab 2019-10-19\cr #' License: \tab MIT\cr #' LazyLoad: \tab yes\cr #' } diff --git a/R/geoflow_action.R b/R/geoflow_action.R index ac4b55f8..1eb812b1 100644 --- a/R/geoflow_action.R +++ b/R/geoflow_action.R @@ -28,19 +28,30 @@ register_actions <- function(){ id = "geometa-create-iso-19115", type = "Metadata production", def = "Produce an ISO/OGC 19115/19139 metadata object", - fun = geometa_create_iso_19115 + fun = geometa_create_iso_19115, + options = list( + doi = list(desc = "Add entity DOI - if defined - as metadata identifier and online resource", default = FALSE), + inspire = list(desc = "Validates ISO 19139 metadata with INSPIRE reference validator", default = FALSE), + logo = list(desc = "Add configure profile logo(s) - if defined - as metadata thumbnail(s)", default = FALSE) + ) ), geoflow_action$new( id="ows4R-publish-iso-19139", type = "Metadata publication", def = "Publish/Update an ISO/OGC 19139 metadata object using OGC CSW Protocol", - fun = ows4R_publish_iso_19139 + fun = ows4R_publish_iso_19139, + options = list( + geometa_inspire = list(desc = "Validates ISO 19139 metadata with INSPIRE reference validator before publication", default = FALSE) + ) ), geoflow_action$new( id = "geonapi-publish-iso-19139", type = "Metadata publication", def = "Publish/Update an ISO/OGC 19139 metadata object with GeoNetwork API", - fun = geonapi_publish_iso_19139 + fun = geonapi_publish_iso_19139, + options = list( + geometa_inspire = list(desc = "Validates ISO 19139 metadata with INSPIRE reference validator before publication", default = FALSE) + ) ), geoflow_action$new( id = "geosapi-publish-ogc-services", @@ -52,7 +63,15 @@ register_actions <- function(){ id = "zen4R-deposit-record", type = "Data publication", def = "Deposits/Publish data and/or metadata in the Zenodo infrastructure", - fun = zen4R_deposit_record + fun = zen4R_deposit_record, + options = list( + depositWithFiles = list(desc = "Indicates if the action is uploading files", default = FALSE), + publish = list(desc = "Indicates if the action should publish the deposit. Requires 'depositWithFiles' set to TRUE", default = FALSE), + deleteOldFiles = list(desc = "Indicates if the action should delete old files prior upload new files", default = TRUE), + update_metadata = list(desc = "For an existing deposit, indicates if metadata elements should be updated", default = TRUE), + update_files = list(desc = "For an existing deposit, indicates if files should be updated", default = TRUE), + communities = list(desc = "One or more communities to which the deposit should be associated", default = NA) + ) ) ) .geoflow$actions <- objs @@ -76,3 +95,25 @@ list_actions <- function(raw = FALSE){ } return(actions) } + +#'list_action_options +#'@export +list_action_options <- function(id){ + out <- NULL + actions <- list_actions(raw = TRUE) + action <- actions[sapply(actions, function(x){x$id == id})] + if(length(action)==0) stop(sprintf("No action with id '%s'!", id)) + action <- action[[1]] + if(length(action$options)>0){ + out <- data.frame( + name = names(action$options), + definition = sapply(action$options, function(x){x$desc}), + default = sapply(action$options, function(x){x$default}), + stringsAsFactors = FALSE + ) + row.names(out) <- 1:nrow(out) + }else{ + out <- data.frame(name = character(0), definition = character(0)) + } + return(out) +} diff --git a/R/geoflow_action_zen4R_deposit_record.R b/R/geoflow_action_zen4R_deposit_record.R index 942d0a61..99a20a48 100644 --- a/R/geoflow_action_zen4R_deposit_record.R +++ b/R/geoflow_action_zen4R_deposit_record.R @@ -21,7 +21,7 @@ zen4R_deposit_record <- function(entity, config, options){ deleteOldFiles <- if(!is.null(options$deleteOldFiles)) options$deleteOldFiles else TRUE update_metadata <- if(!is.null(options$update_metadata)) options$update_metadata else TRUE update_files <- if(!is.null(options$update_files)) options$update_files else TRUE - communities <- if(!is.null(options$community)) options$community else NULL + communities <- if(!is.null(options$community)) options$community else NA #zenodo object zenodo_metadata <- NULL @@ -170,7 +170,7 @@ zen4R_deposit_record <- function(entity, config, options){ #TODO myrec$setAccessRight #communities - if(!is.null(communities)){ + if(!is.na(communities)){ zenodo_metadata$metadata$communities <- list() for(community in communities) zenodo_metadata$addCommunity(community) } diff --git a/README.md b/README.md index dbf316b6..3002b0ef 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/eblondel/geoflow.svg?branch=master)](https://travis-ci.org/eblondel/geoflow) [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/geoflow)](https://cran.r-project.org/package=geoflow) -[![Github_Status_Badge](https://img.shields.io/badge/Github-0.0.9003-blue.svg)](https://github.com/eblondel/geoflow) +[![Github_Status_Badge](https://img.shields.io/badge/Github-0.0.9004-blue.svg)](https://github.com/eblondel/geoflow) [![DOI](https://zenodo.org/badge/DOI//10.5281/zenodo.3138920.svg)](https://doi.org//10.5281/zenodo.3138920) [![Gitter](https://img.shields.io/badge/chat%20room-for%20users-brown.svg?style=flat-square)](https://gitter.im/geoflow-users/community) diff --git a/man/geoflow.Rd b/man/geoflow.Rd index 0b69cab5..9237b75a 100644 --- a/man/geoflow.Rd +++ b/man/geoflow.Rd @@ -12,8 +12,8 @@ R engine to orchestrate and run geospatial (meta)data workflows \tabular{ll}{ Package: \tab geoflow\cr Type: \tab Package\cr - Version: \tab 0.0.9003\cr - Date: \tab 2019-10-18\cr + Version: \tab 0.0.9004\cr + Date: \tab 2019-10-19\cr License: \tab MIT\cr LazyLoad: \tab yes\cr } diff --git a/man/list_action_options.Rd b/man/list_action_options.Rd new file mode 100644 index 00000000..cc46be69 --- /dev/null +++ b/man/list_action_options.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/geoflow_action.R +\name{list_action_options} +\alias{list_action_options} +\title{list_action_options} +\usage{ +list_action_options(id) +} +\description{ +list_action_options +}