Exemplo n.º 1
0
 /**
  * Returns a {@code DXDataObject} corresponding to an existing object with the specified ID, using
  * the specified environment.
  *
  * @param objectId DNAnexus object id
  * @param env environment to use to make subsequent API requests
  * @return a {@code DXDataObject} handle to the specified object
  */
 public static DXDataObject getInstanceWithEnvironment(String objectId, DXEnvironment env) {
   if (objectId.startsWith("record-")) {
     return DXRecord.getInstanceWithEnvironment(objectId, env);
   } else if (objectId.startsWith("file-")) {
     return DXFile.getInstanceWithEnvironment(objectId, env);
   } else if (objectId.startsWith("gtable-")) {
     return DXGTable.getInstanceWithEnvironment(objectId, env);
   } else if (objectId.startsWith("applet-")) {
     return DXApplet.getInstanceWithEnvironment(objectId, env);
   } else if (objectId.startsWith("workflow-")) {
     return DXWorkflow.getInstanceWithEnvironment(objectId, env);
   }
   throw new IllegalArgumentException(
       "The object ID " + objectId + " was of an unrecognized or unsupported class.");
 }
Exemplo n.º 2
0
 /**
  * Returns a {@code DXDataObject} corresponding to an existing object with the specified ID in the
  * specified project or container, using the specified environment, and with the specified cached
  * Describe data.
  *
  * @param objectId DNAnexus object id
  * @param project project or container in which the object resides
  * @param env environment to use to make subsequent API requests
  * @param describe cached Describe output
  * @return a {@code DXDataObject} handle to the specified object
  */
 static DXDataObject getInstanceWithCachedDescribe(
     String objectId, DXContainer project, DXEnvironment env, JsonNode describe) {
   Preconditions.checkNotNull(describe);
   if (objectId.startsWith("record-")) {
     return DXRecord.getInstanceWithCachedDescribe(objectId, project, env, describe);
   } else if (objectId.startsWith("file-")) {
     return DXFile.getInstanceWithCachedDescribe(objectId, project, env, describe);
   } else if (objectId.startsWith("gtable-")) {
     return DXGTable.getInstanceWithCachedDescribe(objectId, project, env, describe);
   } else if (objectId.startsWith("applet-")) {
     return DXApplet.getInstanceWithCachedDescribe(objectId, project, env, describe);
   } else if (objectId.startsWith("workflow-")) {
     return DXWorkflow.getInstanceWithCachedDescribe(objectId, project, env, describe);
   }
   throw new IllegalArgumentException(
       "The object ID " + objectId + " was of an unrecognized or unsupported class.");
 }