A generic container for data objects. More...
#include <dxproject.h>
Public Member Functions | |
DXContainer (const std::string &dxid=config::CURRENT_PROJECT()) | |
void | setID (const std::string &dxid) |
std::string | getID () const |
operator std::string () | |
dx::JSON | describe (bool folders=false) const |
void | move (const dx::JSON &objects, const dx::JSON &folders, const std::string &dest_folder) const |
void | clone (const dx::JSON &objects, const dx::JSON &folders, const std::string &dest_container, const std::string &dest_folder="/") const |
void | newFolder (const std::string &folder, bool parents=false) const |
dx::JSON | listFolder (const std::string &folder="/") const |
void | moveFolder (const std::string &folder, const std::string &dest_folder) const |
void | removeFolder (const std::string &folder, const bool recurse=false) const |
void | moveObjects (const dx::JSON &objects, const std::string &dest_folder) const |
void | removeObjects (const dx::JSON &objects) const |
void | cloneFolder (const std::string &folder, const std::string &dest_container, const std::string &dest_folder) const |
void | cloneObjects (const dx::JSON &objects, const std::string &dest_container, const std::string &dest_folder) const |
A generic container for data objects.
Every data object on the DNAnexus Platform must reside in a data container. When an object is first created, it may only reside in a single container. However, objects may be cloned into other containers once the objects have been closed (and their contents may no longer be modified). See Data Object Lifecycle in the API specification for more information.
Projects (DXProject) are containers that provide additional functionality for collaboration between users.
|
inline |
Creates a DXContainer handler for the specified data container ID.
dxid | A string containing a data container ID. |
void dx::DXContainer::clone | ( | const dx::JSON & | objects, |
const dx::JSON & | folders, | ||
const std::string & | dest_container, | ||
const std::string & | dest_folder = "/" |
||
) | const |
Clones the specified objects and/or folders from the associated data container to another data container.
See the /class-xxx/clone API method for more info.
objects | A JSON array of strings containing the object ID(s) to be cloned. |
folders | A JSON array of strings containing the folder route(s) to be cloned. |
dest_container | ID of the container into which the selected objects should be cloned. |
dest_folder | The full path of the destination folder in the destination container. |
|
inline |
Clones the specified folder to another data container. The of the folder is preserved in the destination data container.
Any hidden objects contained in a folder to be cloned are only cloned if a visible ancestor is also cloned.
See the /class-xxx/clone API method for more info.
folder | The full path of the folder to be cloned. |
dest_container | ID of the container into which the folder should be cloned. |
dest_folder | The full path of the destination folder in the destination container. |
|
inline |
Clones the specified object(s) from the associated data container to another data container.
See the /class-xxx/clone API method for more info.
objects | A JSON array of strings containing the object ID(s) to be cloned. |
dest_container | ID of the container into which the selected objects should be cloned. |
dest_folder | The full path of the destination folder in the destination container. |
JSON dx::DXContainer::describe | ( | bool | folders = false | ) | const |
Returns a description of the associated container as given by the /container-xxxx/describe API method.
folders | If true, a complete list of the folders in the data container is included in the output. |
|
inline |
JSON dx::DXContainer::listFolder | ( | const std::string & | folder = "/" | ) | const |
Lists the contents of a folder in the associated data container.
folder | A string representing the full path to the folder to be listed. |
{"objects": [{"id": id-1}, {"id": id-2}, ...], "folders": ["full-path-to-folder-1", "full-path-to-folder-2", ...]}
void dx::DXContainer::move | ( | const dx::JSON & | objects, |
const dx::JSON & | folders, | ||
const std::string & | dest_folder | ||
) | const |
Moves the specified objects and/or folders in the associated data container to the specified folder.
See the /class-xxxx/move API method for more info.
objects | A JSON array of strings containing the object ID(s) to be moved. |
folders | A JSON array of strings containing the folder route(s) to be moved. |
dest_folder | The full path of the destination folder. |
void dx::DXContainer::moveFolder | ( | const std::string & | folder, |
const std::string & | dest_folder | ||
) | const |
Moves a folder in the associated data container (and all the objects and subfolders it contains) to the specified destination folder.
See the /class-xxxx/move API method for more info.
folder | The full path of the folder to be moved. |
dest_folder | The full path of the destination folder. |
|
inline |
Move objects in the associated data container to the specified destination folder.
See the /class-xxxx/move API method for more info.
objects | A JSON array of strings containing the object ID(s) to be moved. |
dest_folder | The full path of the destination folder. |
void dx::DXContainer::newFolder | ( | const std::string & | folder, |
bool | parents = false |
||
) | const |
Creates a new folder in the associated data container.
folder | The full path of the new folder to be created. |
parents | Whether to create the parent folders if they do not already exist. |
|
inline |
This default conversion to string returns the container ID so a handler can always be passed in place of a string argument that expects a container or project ID.
void dx::DXContainer::removeFolder | ( | const std::string & | folder, |
const bool | recurse = false |
||
) | const |
Removes a given folder and all its data content.
The folder must be empty unless recurse
is set to true
.
folder | The full path of the folder to be removed. |
recurse | Boolean indicating whether to recursively remove all objects and folders contained in the target. |
void dx::DXContainer::removeObjects | ( | const dx::JSON & | objects | ) | const |
Removes the selected object(s) from the data container.
objects | A JSON array of strings containing the object ID(s) to be removed. |
|
inline |
dxid | Associates the handler with the given data container ID. |