Public Member Functions | List of all members
dx::DXContainer Class Reference

A generic container for data objects. More...

#include <dxproject.h>

Inheritance diagram for dx::DXContainer:
dx::DXProject

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
 

Detailed Description

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.

Constructor & Destructor Documentation

dx::DXContainer::DXContainer ( const std::string &  dxid = config::CURRENT_PROJECT())
inline

Creates a DXContainer handler for the specified data container ID.

Parameters
dxidA string containing a data container ID.

Member Function Documentation

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.

Parameters
objectsA JSON array of strings containing the object ID(s) to be cloned.
foldersA JSON array of strings containing the folder route(s) to be cloned.
dest_containerID of the container into which the selected objects should be cloned.
dest_folderThe full path of the destination folder in the destination container.
void dx::DXContainer::cloneFolder ( const std::string &  folder,
const std::string &  dest_container,
const std::string &  dest_folder 
) const
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.

Parameters
folderThe full path of the folder to be cloned.
dest_containerID of the container into which the folder should be cloned.
dest_folderThe full path of the destination folder in the destination container.
void dx::DXContainer::cloneObjects ( const dx::JSON &  objects,
const std::string &  dest_container,
const std::string &  dest_folder 
) const
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.

Parameters
objectsA JSON array of strings containing the object ID(s) to be cloned.
dest_containerID of the container into which the selected objects should be cloned.
dest_folderThe 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.

Parameters
foldersIf true, a complete list of the folders in the data container is included in the output.
Returns
JSON hash containing the output of the describe call.
std::string dx::DXContainer::getID ( ) const
inline
Returns
ID of the associated data container.
JSON dx::DXContainer::listFolder ( const std::string &  folder = "/") const

Lists the contents of a folder in the associated data container.

Parameters
folderA string representing the full path to the folder to be listed.
Returns
A JSON hash of the form: {"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.

Parameters
objectsA JSON array of strings containing the object ID(s) to be moved.
foldersA JSON array of strings containing the folder route(s) to be moved.
dest_folderThe 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.

Parameters
folderThe full path of the folder to be moved.
dest_folderThe full path of the destination folder.
void dx::DXContainer::moveObjects ( const dx::JSON &  objects,
const std::string &  dest_folder 
) const
inline

Move objects in the associated data container to the specified destination folder.

See the /class-xxxx/move API method for more info.

Parameters
objectsA JSON array of strings containing the object ID(s) to be moved.
dest_folderThe 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.

Parameters
folderThe full path of the new folder to be created.
parentsWhether to create the parent folders if they do not already exist.
dx::DXContainer::operator std::string ( )
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.

Returns
ID of the associated data container.
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.

Parameters
folderThe full path of the folder to be removed.
recurseBoolean 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.

Parameters
objectsA JSON array of strings containing the object ID(s) to be removed.
void dx::DXContainer::setID ( const std::string &  dxid)
inline
Parameters
dxidAssociates the handler with the given data container ID.
Note
No error checking is done in this function.

The documentation for this class was generated from the following files: