clone_package.Rd
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)
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 |
change_auth_node | (logical) Will change the authoritativeMemberNode in the system metadata to the cloned member node
if |
public | (logical) Optional. Will set public read access. Defaults to |
clone_children | (logical) Optional. Will clone all children recursively if |
new_pid | (logical) Optional. Will give the clone a new PID. Defaults to |
# 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) # }