Class DXDataObject
- java.lang.Object
-
- com.dnanexus.DXObject
-
- com.dnanexus.DXDataObject
-
- Direct Known Subclasses:
DXApplet,DXFile,DXRecord,DXWorkflow
public abstract class DXDataObject extends DXObject
Base class for all data object classes in the DNAnexus Platform.Instances of this class are JSON-serialized as a DNAnexus link, which makes it suitable to provide an object with references to DXDataObjects as the input when running a
DXApplet, etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDXDataObject.Builder<T extends DXDataObject.Builder<T,U>,U extends DXDataObject>Abstract builder class for creating a new data object of classU.static classDXDataObject.DescribeContains metadata for a data object (fields common to all data objects).static classDXDataObject.DescribeOptionsConfiguration options for a describe call on a data object (e.g.describe(DescribeOptions)) to control what optional fields get returned and what project to obtain project-specific metadata from.
-
Field Summary
Fields Modifier and Type Field Description protected com.fasterxml.jackson.databind.JsonNodecachedDescribe
-
Constructor Summary
Constructors Modifier Constructor Description protectedDXDataObject(String dxId, String className, DXContainer project, DXEnvironment env, com.fasterxml.jackson.databind.JsonNode cachedDescribe)Initializes theDXDataObjectto point to the object with the specified ID in the specified project.protectedDXDataObject(String dxId, String className, DXEnvironment env, com.fasterxml.jackson.databind.JsonNode cachedDescribe)Initializes theDXDataObjectto point to the object with the specified ID in the environment's workspace.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTags(List<String> tags)Adds the specified tags to the object.voidaddTypes(List<String> types)Adds the specified types to the object.protected voidcheckCachedDescribeAvailable()Verifies that this object carries cached describe data.protected static voidcheckDXLinkFormat(Map<String,Object> value)Verifies that the specified map has the format of a DNAnexus link.DXDataObjectclose()Closes the data object.DXDataObjectcloseAndWait()Closes the data object and waits until the close operation is complete.DXDataObject.Describedescribe()Returns metadata about the data object.DXDataObject.Describedescribe(DXDataObject.DescribeOptions options)Returns metadata about the data object, specifying which optional fields are to be returned and what project to obtain project-specific metadata from.booleanequals(Object obj)DXDataObject.DescribegetCachedDescribe()Returns metadata about the data object, likedescribe(), but without making an API call.static DXDataObjectgetInstance(String objectId)Returns aDXDataObjectcorresponding to an existing object with the specified ID.static DXDataObjectgetInstance(String objectId, DXContainer project)Returns aDXDataObjectcorresponding to an existing object with the specified ID in the specified project or container.static DXDataObjectgetInstanceWithEnvironment(String objectId, DXContainer project, DXEnvironment env)Returns aDXDataObjectcorresponding to an existing object with the specified ID in the specified project or container, using the specified environment.static DXDataObjectgetInstanceWithEnvironment(String objectId, DXEnvironment env)Returns aDXDataObjectcorresponding to an existing object with the specified ID, using the specified environment.com.fasterxml.jackson.databind.JsonNodegetLinkAsJson()Returns a DNAnexus link for this object.DXContainergetProject()Returns the object's project or container, if it was explicitly supplied.inthashCode()Map<DXContainer,AccessLevel>listProjects()Returns the set of projects that contain this object, and which the requesting user has permissions to access.voidputAllProperties(Map<String,String> properties)Sets properties on the object.voidputAllProperties(Map<String,String> propertiesToSet, List<String> propertiesToRemove)Sets and removes properties on the object.voidputProperty(String key, String value)Sets a property on the object.voidremoveProperty(String key)Removes a property from the object.voidremoveTags(List<String> tags)Removes the specified tags from the object.voidremoveTypes(List<String> types)Removes the specified types from the object.voidrename(String newName)Changes the name of the object in its project.voidsetDetails(Object details)Sets the details of the object.voidsetVisibility(boolean visible)Makes the object visible or hidden.-
Methods inherited from class com.dnanexus.DXObject
apiCallOnObject, apiCallOnObject, getId, toString
-
-
-
-
Constructor Detail
-
DXDataObject
protected DXDataObject(String dxId, String className, DXContainer project, DXEnvironment env, com.fasterxml.jackson.databind.JsonNode cachedDescribe)
Initializes theDXDataObjectto point to the object with the specified ID in the specified project.- Parameters:
dxId- DNAnexus ID of the data objectclassName- class name that should prefix the IDenv- environment to use for subsequent API requests from thisDXDataObject, or null to use the default environmentcachedDescribe- JSON hash of the describe output for this object if available, or null otherwise
-
DXDataObject
protected DXDataObject(String dxId, String className, DXEnvironment env, com.fasterxml.jackson.databind.JsonNode cachedDescribe)
Initializes theDXDataObjectto point to the object with the specified ID in the environment's workspace.Operations that use or retrieve project-specific metadata will fail if the object does not exist in the environment's workspace. When a project is available, you should prefer to set it explicitly via
DXDataObject(String, String, DXContainer, DXEnvironment, JsonNode).- Parameters:
dxId- DNAnexus ID of the data objectclassName- class name that should prefix the IDenv- environment to use for subsequent API requests from thisDXDataObject, or null to use the default environmentcachedDescribe- JSON hash of the describe output for this object if available, or null otherwise
-
-
Method Detail
-
checkDXLinkFormat
protected static void checkDXLinkFormat(Map<String,Object> value)
Verifies that the specified map has the format of a DNAnexus link.- Parameters:
value- putative DNAnexus link
-
getInstance
public static DXDataObject getInstance(String objectId)
Returns aDXDataObjectcorresponding to an existing object with the specified ID.- Parameters:
objectId- DNAnexus object id- Returns:
- a
DXDataObjecthandle to the specified object
-
getInstance
public static DXDataObject getInstance(String objectId, DXContainer project)
Returns aDXDataObjectcorresponding to an existing object with the specified ID in the specified project or container.- Parameters:
objectId- DNAnexus object idproject- project or container in which the object resides- Returns:
- a
DXDataObjecthandle to the specified object
-
getInstanceWithEnvironment
public static DXDataObject getInstanceWithEnvironment(String objectId, DXContainer project, DXEnvironment env)
Returns aDXDataObjectcorresponding to an existing object with the specified ID in the specified project or container, using the specified environment.- Parameters:
objectId- DNAnexus object idproject- project or container in which the object residesenv- environment to use to make subsequent API requests- Returns:
- a
DXDataObjecthandle to the specified object
-
getInstanceWithEnvironment
public static DXDataObject getInstanceWithEnvironment(String objectId, DXEnvironment env)
Returns aDXDataObjectcorresponding to an existing object with the specified ID, using the specified environment.- Parameters:
objectId- DNAnexus object idenv- environment to use to make subsequent API requests- Returns:
- a
DXDataObjecthandle to the specified object
-
addTags
public void addTags(List<String> tags)
Adds the specified tags to the object.The tags are modified in the project or container associated with this
DXDataObject, or the environment's workspace if no project or container was explicitly specified.- Parameters:
tags- List of tags to add to the object- Throws:
NullPointerException- if this object has no associated project and no workspace is set
-
addTypes
public void addTypes(List<String> types)
Adds the specified types to the object.- Parameters:
types- List of types to add to the object
-
checkCachedDescribeAvailable
protected void checkCachedDescribeAvailable() throws IllegalStateExceptionVerifies that this object carries cached describe data.- Throws:
IllegalStateException- if cachedDescribe is not set.
-
close
public DXDataObject close()
Closes the data object.Returns the same object so you can chain calls.
- Returns:
- the same
DXDataObject
-
closeAndWait
public DXDataObject closeAndWait()
Closes the data object and waits until the close operation is complete.Returns the same object so you can chain calls.
- Returns:
- the same
DXDataObject
-
describe
public DXDataObject.Describe describe()
Returns metadata about the data object.The properties and details fields will not be returned, and any project-specific metadata fields will be selected from an arbitrary project in which the requesting user has access to this object. To change either of these aspects of this behavior, use
describe(DescribeOptions)instead.- Returns:
- a
Describecontaining the data object's metadata.
-
describe
public DXDataObject.Describe describe(DXDataObject.DescribeOptions options)
Returns metadata about the data object, specifying which optional fields are to be returned and what project to obtain project-specific metadata from.- Parameters:
options-DescribeOptionsobject specifying how thedescriberequest is to be made.- Returns:
- a
Describecontaining the data object's metadata.
-
getCachedDescribe
public DXDataObject.Describe getCachedDescribe()
Returns metadata about the data object, likedescribe(), but without making an API call.This cached describe info is only available if this object appears in the result of a
DXSearch.findDataObjects()call that specifiedDXSearch.FindDataObjectsRequestBuilder.includeDescribeOutput(), and the describe info that is returned reflects the state of the object at the time that the search was performed.- Returns:
- a
Describecontaining the data object's metadata - Throws:
IllegalStateException- if no cached describe info is available
-
getLinkAsJson
public com.fasterxml.jackson.databind.JsonNode getLinkAsJson()
Returns a DNAnexus link for this object.- Returns:
- a DNAnexus link
-
getProject
public DXContainer getProject()
Returns the object's project or container, if it was explicitly supplied.- Returns:
- project or container, or
nullif none was specified at object creation time
-
listProjects
public Map<DXContainer,AccessLevel> listProjects()
Returns the set of projects that contain this object, and which the requesting user has permissions to access.- Returns:
- Mapping from project ID to the user's access level in that project.
-
putAllProperties
public void putAllProperties(Map<String,String> properties)
Sets properties on the object.The properties are modified in the project or container associated with this
DXDataObject, or the environment's workspace if no project or container was explicitly specified.- Parameters:
properties- Map from key to value for each property to be set- Throws:
NullPointerException- if this object has no associated project and no workspace is set
-
putAllProperties
public void putAllProperties(Map<String,String> propertiesToSet, List<String> propertiesToRemove)
Sets and removes properties on the object.The properties are modified in the project or container associated with this
DXDataObject, or the environment's workspace if no project or container was explicitly specified.- Parameters:
propertiesToSet- Map from key to value for each property to be setpropertiesToRemove- List of property keys to be removed- Throws:
NullPointerException- if this object has no associated project and no workspace is set
-
putProperty
public void putProperty(String key, String value)
Sets a property on the object.The properties are modified in the project or container associated with this
DXDataObject, or the environment's workspace if no project or container was explicitly specified.- Parameters:
key- property key to setvalue- property value to set- Throws:
NullPointerException- if this object has no associated project and no workspace is set
-
removeProperty
public void removeProperty(String key)
Removes a property from the object.The properties are modified in the project or container associated with this
DXDataObject, or the environment's workspace if no project or container was explicitly specified.- Parameters:
key- property key to be removed- Throws:
NullPointerException- if this object has no associated project and no workspace is set
-
removeTags
public void removeTags(List<String> tags)
Removes the specified tags from the object.The tags are modified in the project or container associated with this
DXDataObject, or the environment's workspace if no project or container was explicitly specified.- Parameters:
tags- List of tags to remove- Throws:
NullPointerException- if this object has no associated project and no workspace is set
-
removeTypes
public void removeTypes(List<String> types)
Removes the specified types from the object.- Parameters:
types- List of types to remove
-
rename
public void rename(String newName)
Changes the name of the object in its project. The basename of the object is changed to the specified name and it remains in the same folder.The object is renamed in the project or container associated with this
DXDataObject, or the environment's workspace if no project or container was explicitly specified.- Parameters:
newName- The new name of the object- Throws:
NullPointerException- if this object has no associated project and no workspace is set
-
setDetails
public void setDetails(Object details)
Sets the details of the object.- Parameters:
details- an object whose JSON serialized form will be set as the details
-
setVisibility
public void setVisibility(boolean visible)
Makes the object visible or hidden.- Parameters:
visible-
-
-