@@ -15,6 +15,11 @@ function(action, entity, config){
15
15
collection_names = as.list(strsplit(MD_EDITOR_CONFIG $ properties $ collection_names , " ," )[[1 ]])
16
16
}
17
17
18
+ # options
19
+ depositWithFiles <- action $ getOption(" depositWithFiles" )
20
+ depositDataPattern <- action $ getOption(" depositDataPattern" )
21
+ depositMetadataPattern <- action $ getOption(" depositMetadataPattern" )
22
+
18
23
# basic function to map a geoflow_contact to a metadata editor contact
19
24
produce_md_contact = function (x ){
20
25
@@ -344,4 +349,30 @@ function(action, entity, config){
344
349
)
345
350
}
346
351
}
352
+
353
+ # files
354
+ if (depositWithFiles ){
355
+ # data
356
+ data_files <- list.files(file.path(getwd()," data" ), pattern = depositDataPattern )
357
+ for (data_file in data_files ){
358
+ config $ logger.info(sprintf(" Upload data file '%s'" , data_file ))
359
+ metadataeditr :: resources_add(
360
+ idno = entity $ identifiers [[" id" ]],
361
+ dctype = " dat" ,
362
+ title = data_file ,
363
+ file_path = file.path(getwd(), " data" , data_file )
364
+ )
365
+ }
366
+ # metadata
367
+ # metadata_files <- list.files(file.path(getwd(),"metadata"), pattern = depositMetadataPattern)
368
+ # for(metadata_file in metadata_files){
369
+ # config$logger.info(sprintf("Upload metadata file '%s'", metadata_file))
370
+ # metadataeditr::resources_add(
371
+ # idno = entity$identifiers[["id"]],
372
+ # dctype = "dat",
373
+ # title = metadata_file,
374
+ # file_path = file.path(getwd(), "metadata", metadata_file)
375
+ # )
376
+ # }
377
+ }
347
378
}
0 commit comments