All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dx::DXDataObject Class Referenceabstract

The abstract base class for all data object remote handlers. More...

#include <bindings.h>

Inheritance diagram for dx::DXDataObject:
dx::DXApplet dx::DXFile dx::DXRecord

Public Member Functions

 DXDataObject (const DXDataObject &to_copy)
 
 DXDataObject (const std::string &dxid)
 
 DXDataObject (const std::string &dxid, const std::string &proj)
 
std::string getID () const
 
 operator std::string ()
 
std::string getProjectID () const
 
virtual void setIDs (const std::string &dxid, const std::string &proj="default")
 
virtual void setIDs (const char *dxid, const char *proj=NULL)
 
virtual void setIDs (const JSON &dxlink)
 
JSON describe (bool incl_properties=false, bool incl_details=false) const
 
void addTypes (const JSON &types) const
 
void removeTypes (const JSON &types) const
 
JSON getDetails () const
 
void setDetails (const JSON &details) const
 
void hide () const
 
void unhide () const
 
void rename (const std::string &name) const
 
void setProperties (const JSON &properties) const
 
JSON getProperties () const
 
void addTags (const JSON &tags) const
 
void removeTags (const JSON &tags) const
 
virtual void close () const
 
JSON listProjects () const
 
void move (const std::string &dest_folder) const
 
void remove ()
 

Protected Member Functions

void waitOnState (const std::string &state="closed", const int timeout=std::numeric_limits< int >::max()) const
 
virtual JSON describe_ (const std::string &input_params) const =0
 
virtual void addTypes_ (const std::string &input_params) const =0
 
virtual void removeTypes_ (const std::string &input_params) const =0
 
virtual JSON getDetails_ (const std::string &input_params) const =0
 
virtual void setDetails_ (const std::string &input_params) const =0
 
virtual void setVisibility_ (const std::string &input_params) const =0
 
virtual void rename_ (const std::string &input_params) const =0
 
virtual void setProperties_ (const std::string &input_params) const =0
 
virtual void addTags_ (const std::string &input_params) const =0
 
virtual void removeTags_ (const std::string &input_params) const =0
 
virtual void close_ (const std::string &input_params) const =0
 
virtual JSON listProjects_ (const std::string &input_params) const =0
 
void clone_ (const std::string &dest_proj_id, const std::string &dest_folder) const
 

Protected Attributes

std::string dxid_
 
std::string proj_
 

Detailed Description

The abstract base class for all data object remote handlers.

DXDataObject contains the common methods to all handlers, such as creation, describing, setting of properties, tags, types, visibility, details, etc.

Each DXDataObject instance has two IDs associated with it: the ID of the data object ID it is associated with, and a project ID to indicate which project's copy of the data the handler will use. Note that it is possible to have two handlers with the same data object ID but different project IDs. Both will access the same underlying data, but the name, properties, and tags are local to the project and can be modified independently.

Constructor & Destructor Documentation

dx::DXDataObject::DXDataObject ( const DXDataObject to_copy)
inline

Copy constructor.

dx::DXDataObject::DXDataObject ( const std::string &  dxid)
inline

Creates a handler for the specified remote data object.

Parameters
dxidData object ID.
dx::DXDataObject::DXDataObject ( const std::string &  dxid,
const std::string &  proj 
)
inline

Creates a handler for the specified remote data object.

Parameters
dxidData object ID.
projID of of the project in which to access the object.

Member Function Documentation

void dx::DXDataObject::addTags ( const JSON &  tags) const

Adds the specified tags to the object.

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

Parameters
tagsJSON array of strings to add as tags.
void dx::DXDataObject::addTypes ( const JSON &  types) const

Adds the specified types to the object.

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

Parameters
typesJSON array of strings to add as types
void dx::DXDataObject::clone_ ( const std::string &  dest_proj_id,
const std::string &  dest_folder 
) const
protected

Clones the object into the specified project and folder.

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

Parameters
dest_proj_idID of the project into which the object should be cloned
dest_folderFolder route in which to put it in the destination project.
void dx::DXDataObject::close ( ) const
virtual

Closes the object.

JSON dx::DXDataObject::describe ( bool  incl_properties = false,
bool  incl_details = false 
) const

Returns a JSON object with, at minimum, the keys "id", "class", "types", and "createdAt". Other fields may also be included, depending on the class.

Parameters
incl_propertiesIf true, properties are included in the output.
incl_detailsIf true, details are included in the output.
Returns
JSON hash containing description
JSON dx::DXDataObject::getDetails ( ) const

Retrieves the details stored in the object.

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

Returns
JSON hash or array containing the remote object's details
std::string dx::DXDataObject::getID ( ) const
inline
Returns
ID of the associated object.
std::string dx::DXDataObject::getProjectID ( ) const
inline
Returns
ID of the project being used to access the data object.
dx::JSON dx::DXDataObject::getProperties ( ) const

Retrieves all properties of the object.

Returns
JSON hash mapping strings to strings, containing property names and their associated values.
void dx::DXDataObject::hide ( ) const

Ensures that the remote object is hidden.

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

JSON dx::DXDataObject::listProjects ( ) const

Lists all projects that contain a copy of the object.

Returns
JSON array of project IDs (strings) that contain a copy of the object.
void dx::DXDataObject::move ( const std::string &  dest_folder) const

Moves the object into the specified folder in the same project.

Parameters
dest_folderFolder route in which to put the object
dx::DXDataObject::operator std::string ( )
inline

This default conversion to string returns the object ID so a handler can always be passed in place of a string argument that expects an object ID.

void dx::DXDataObject::remove ( )

Removes the copy of the object from the associated project (see getProjectID()). Copies of the object in other projects are not affected.

void dx::DXDataObject::removeTags ( const JSON &  tags) const

Removes the specified tags from the object.

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

Parameters
tagsJSON array of strings to remove as tags.
void dx::DXDataObject::removeTypes ( const JSON &  types) const

Removes the specified types from the object.

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

Parameters
typesJSON array of strings to remove as types
void dx::DXDataObject::rename ( const std::string &  name) const

Renames the object.

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

Parameters
nameNew name for the object.
void dx::DXDataObject::setDetails ( const JSON &  details) const

Stores the given JSON in the details of the remote object.

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

Parameters
detailsArbitrary JSON hash or array to store as details
void dx::DXDataObject::setIDs ( const std::string &  dxid,
const std::string &  proj = "default" 
)
virtual

Sets the object and project IDs as specified. If not specified, the project ID will be set to the default workspace.

See setWorkspaceID() and loadFromEnvironment() for more information.

Parameters
dxidID of the associated object.
projID of the project whose copy of the data object should be accessed. If a value "default" is provided, then default workspace will be used.

Reimplemented in dx::DXFile.

void dx::DXDataObject::setIDs ( const char *  dxid,
const char *  proj = NULL 
)
virtual

Sets the object and project IDs as specified. If not specified, the project ID will be set to the default workspace.

See setWorkspaceID() and loadFromEnvironment() for more information.

Parameters
dxidID of the associated object.
projID of the project whose copy of the data object should be accessed. (if NULL, then default workspace will be used)

Reimplemented in dx::DXFile.

virtual void dx::DXDataObject::setIDs ( const JSON &  dxlink)
virtual

Sets the object and project IDs as specified by dxlink. If project is not specified in dxlink, the project ID will be set to the default workspace.

See setWorkspaceID() and loadFromEnvironment() for more information.

Parameters
dxlinkA JSON representing a DNAnexus link. You may also use the extended form: {"$dnanexus_link": {"project": proj-id, "id": obj-id}}.
void dx::DXDataObject::setProperties ( const JSON &  properties) const

Sets the specified properties.

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

Parameters
propertiesJSON hash mapping strings to strings, containing names and values of properties to set.
void dx::DXDataObject::unhide ( ) const

Ensures that the remote object is visible.

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


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