This function copies a data package from one DataONE Member Node to another. Note: the dateUploaded, obsoletes, and obsoletedBy fields in the sysmeta will be reset on the cloned object. This will not update the information in the metadata object. This can also be used to restore an older version of a package to a Member Node, provided that the user subsequently obsoletes the version of the package that they used to create the clone.

clone_package(resource_map_pid, from, to, add_access_to, change_auth_node,
  public = FALSE, clone_children = FALSE, new_pid = TRUE)

Arguments

resource_map_pid

(character) PID for the package resource map.

from

(D1Client) D1Client to clone package from. (Package must be public)

to

(D1Client) D1Client to clone package to. (Token must be set for this node)

add_access_to

(character) Will give read, write, and changePermission access to all strings in vector. If no additional access is desired, set to NULL. Note: setting this to NULL could lead to situations where it is not possible to read, write, or changePermissions on the cloned object.

change_auth_node

(logical) Will change the authoritativeMemberNode in the system metadata to the cloned member node if TRUE. Setting this to TRUE will allow you to edit the package after cloning. Setting this to FALSE syncs the system metadata with the package on the Authoritative Member Node, and will only allow DataONE admins with special privileges to edit package system metadata.

public

(logical) Optional. Will set public read access. Defaults to FALSE.

clone_children

(logical) Optional. Will clone all children recursively if TRUE. Defaults to FALSE.

new_pid

(logical) Optional. Will give the clone a new PID. Defaults to TRUE.

See also

Examples

# NOT RUN {
# First set up the member nodes we're cloning between
# (in this example they are the same but could be different)
to <- dataone::D1Client("STAGING", "urn:node:mnTestARCTIC")
from <- dataone::D1Client("STAGING", "urn:node:mnTestARCTIC")

# Choose a package to clone (here a new one is created)
package <- arcticdatautils::create_dummy_package(to@mn)

# Clone object
cloned_package <- clone_package(resource_map_pid = package$resource_map
                          from = from,
                           to = to,
                           add_access_to = arcticdatautils:::get_token_subject(),
                           change_auth_node = TRUE,
                           public = TRUE,
                           new_pid = TRUE)
# }